Skip to content

InfluxDB file pusher (based on InfluxDB line protocol format)

Notifications You must be signed in to change notification settings

barasher/influxdb-pusher

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

InfluxDB-pusher

Build Status go report card GoDoc

influxdb-pusher is tool that push InfluxDB line protocol to InfluxDB.

It is released as :

  • a Golang library
  • an executable binary

Golang library

Install

go get github.com/barasher/influxdb-pusher

Documentation and example

package main

import (
	pusher "github.com/barasher/influxdb-pusher"
)

func main() {
	p, err := pusher.NewPusher("http://127.0.0.1:8086", "myDatabase")
	if err != nil {
		// deal with error
	}
	err = p.Push("/tmp/someData.txt")
	if err != nil {
        // deal with error
	}
}

Executable binary

Compilation

go build -o pusher cmd/pusher_cli.go

Execution

barasher@Linux:/tmp/$ ./pusher -h
Usage of Pusher:
  -c string
    	Consistency (any|all|one|quorum)
  -d string
    	Database, required
  -f string
    	File to push, required
  -p string
    	Password
  -pr string
    	Precision (ns|u|ms|s|m|h)
  -r string
    	Retention policy
  -t string
    	Timeout duration (50s, 120ms, 1m, ...)
  -u string
    	URL, required (sample: http://1.2.3.4:8086)
  -us string
    	Username

Parameters :

  • -c specifies the consistency required for the push
  • -d specifies the database that has to be used
  • -f specifies the path containing the data
  • -p specifies the password to use
  • -pr specifies the precision ot consider for the data
  • -u specifies the URL of the InfluxDB API
  • -us specifies the username to use
  • -t specifies the timeout (300ms : 300 milliseconds, 2h30m : 2 hours and 30 minutes, ...)

Return codes :

  • 0: everything was OK
  • 1: configuration failure
  • 2: execution failure