InfluxDB Shunya API

Grafana#

Grafana is a data visualization tool used to display and represent the data.

InfluxDB configuration in Shunya#

ConfigDescriptions
Influx DB URLurl to the Influx DB instance.
Database NameName of the database in which the data gets stored.

The configurations need to be set manually by the user before using the API's

For example:

A sample JSON snippet should contain

"influxdb" : {
"influxdbUrl": "",
"influxdbDBName": ""

Commonly configured parameters#

For example:

A typical Influxdb configuration without security will look like this

"test-db" : {
"influxdbUrl": "http://148.251.91.253:8086/",
"influxdbDBName": "test-db"
}

API's#

APIDescriptionDetails
newInfluxdb()Create a new Influx DB Instance.Read More
writeDbInflux()Send Data to Influx DB.Read More

newInfluxdb()#

Description : Creates a new Influxdb Instance

Parameters

  • name (char *) - Name of the JSON object.

Return-type : influxdbObj

Returns : influxdbObj Instance for Influxdb

Usage :

For example: Lets say your /etc/shunya/config.json JSON file looks like

"test-db" : {
"influxdbUrl": "http://148.251.91.253:8086/",
"influxdbDBName": "test-db"
}

So the usage of the API's will be

influxdbObj testdb = newInfluxdb("test-db");

writeDbInflux()#

Description : Send Data to Influx DB.

Parameters

  • obj(influxdbObj) - the InfulxDB Instance
  • data(char) - the data to be sent to Influxdb in Influx db line format
  • ...

Return-type : int8_t

Usage :

influxdbObj testdb = newInfluxdb("test-db");
writeDbInflux (testdb, "measurement,tag1,tag2 value1=%d,value2=%d %ld", temp, pressure, unix_timestamp);