No commit activity in last 3 years
No release in over 3 years
This is a very basic gem that provides a library that, via Excon, reliably publishes metrics to InfluxDB 0.9.0rc33+ via the LineProtocol Interface. This is alpha-quality. I wrote this so that I can integrate it into our Sensu infrastructure easily.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

>= 0
>= 1.1.0, ~> 1.1

Runtime

>= 0.45.3, ~> 0.45
 Project Readme

influxdb-lineprotocol-writer-ruby

A Ruby Library for Writing to InfluxDB v0.9+ using the new Line Protocol (influxdata/influxdb#2696)

This is alpha-quality code

Currently supports all param options made available except SSL b/c I'm too lazy to test that at this time.

Likewise, this sorts the keys and fields to further hopefully make this the fastest writer currently out there (sorting is strongly recommended in the referenced PR).

If you fork this and make it better, I'll review, merge, increment version, and push an updated gem in a reasonable timeframe.

Default URI params are documented in lib/influxdb-lineprotocol-writer-ruby/core.rb in the class initializer.

Install

$ gem install influxdb-lineprotocol-writer

Usage

require 'influxdb-lineprotocol-writer'


client = InfluxDB::LineProtocolWriter::Core.new host: '<host/IP>', 
                                                  db: '<DB>', 
                                                user: '<USER>', 
                                                pass: '<PASS>'
client.debug = true # Enable debug Excon output
client.connect

client.add_metric 'test', {test: 'test', test2: 'test2', a: 'val'}, {value: 1.0}
sleep 0.1
client.add_metric 'test', {z: 'val2', test: 'test', test2: 'test2'}, {value: 2.0}
sleep 0.1
client.add_metric 'test', {z: 'val2', test: 'test', test2: 'test2'}, {value: 2.0}
client.add_metric 'test', {test: 'test', test2: 'test2'}, {value: 3.0}
sleep 0.1
client.add_metric 'test', nil, {value: 3.0}
client.add_metric 'test3', nil, {value: 3.0, test: 'string', deploy: 'v2.0'}
sleep 0.1
client.add_metric 'test3', nil, {value: 3.0, test: 'string', deploy: 'v2.1'}, 1434077536000

client.write