influxdb-nodejs
An InfluxDB Node.js Client.
Installation
$ npm install influxdb-nodejs
Examples
View the ./examples directory for working examples.
API
New Client
// no authconst Influx = ;const client = 'http://127.0.0.1:8086/mydb';
// normal auth (user and password will be added to URL query parameters)const Influx = ;const client = 'http://user:pwd@127.0.0.1:8086/mydb';
// basic auth (will be used http basic auth)const Influx = ;const client = 'http://user:pwd@127.0.0.1:8086/mydb?auth=basic';
Write point
const Influx = ;const client = 'http://127.0.0.1:8086/mydb';// i --> integer// s --> string// f --> float// b --> booleanconst fieldSchema = use: 'i' bytes: 'i' url: 's';const tagSchema = spdy: 'speedy' 'fast' 'slow' method: '*' // http stats code: 10x, 20x, 30x, 40x, 50x type: '1' '2' '3' '4' '5';client;client ;
Query influxdb with multi where condition
const Influx = ;const client = 'http://127.0.0.1:8086/mydb';client ;// => influx ql: select * from "http" where "spdy" = '1' and "use" >= 300 and ("method" = 'GET' or "method" = 'POST')
Query influxdb using functon
const Influx = ;const client = 'http://127.0.0.1:8086/mydb';client ;// => select count("url") from "http" where "spdy" = '1' client ;// select bottom("use",5) from "http" where "spdy" = '1'
Write points to influxdb in queue
const Influx = ;const client = 'http://127.0.0.1:8086/mydb'; { client ; if clientwriteQueueLength >= 10 client ; } ;
Sub query
const Influx = ;const client = 'http://127.0.0.1:8086/mydb';client ;
Multi query
const Influx = ;const client = 'http://127.0.0.1:8086/mydb';const reader = client;reader;reader;readermeasurement = 'login';reader;reader;reader;
Use influxdb for express
const express = ;const app = ;const _ = ;const Influx = ;const client = 'http://127.0.0.1:8086/mydb';const onHeaders = ; // set the http stats schemaclient;client; { const start = Date; ; ;} client; app; app; app; app; app; app; let server;const finish = { console;};if processenvPORT server = app; else server = app;
Influxdb Charts
HTTP Spdy(experss demo)
HTTP Type(experss demo)
HTTP Error(experss demo)
Comparison
-
influx
It's complex for me. Before developing this module, I used influx, which was not straightforward; and its batch function can not be saved as queue. What's more, the function of query is too simple, just like I write influx ql. -
influent
I have never used this module, but I have read its API. In my opinion, this module is not so convenient.
License
MIT