influxdb-v1
v1.0.4
Published
A light-weight library to write data to InfluxDB v1
Downloads
4,156
Readme
influxdb-v1
A light-weight library to write data to InfluxDB.
- Parse Special Characters
- Inbuilt Retry Mechanisms
Example
const influx = require('influxdb-v1');
await influx.write(
{
url: 'http://influx.url',
db: 'database name'
},
[
{
measurement: 'web',
fields: {
load: 12.34
}
},
{
measurement: 'web',
fields: {
load: 5.4
},
tags: {
host: 'linux'
},
timestamp: Date.now()
}
]
);
// or
const db = influx.db({ url: 'http://influx.url', db: 'database name'});
await db.write({
measurement: 'web',
fields: {
load: 12.34
}
});
// query
const db = influx.db({ url: 'http://influx.url', db: 'database name', username: 'user', password: 'pass' });
await db.query('SELECT * FROM measurement');
await db.flux('from(bucket:"telegraf")');
CLI
Insert Data
npx influxdb-v1 insert --url <influx-base-url> --username <user> --password <pass> --db <database> --measurement <measurement> --tags "key=value" --fields "key=value" --ts <timestamp>
Note
Inspired from influxdb-v2