Skip to content

offero/telegrafjs

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

TelegrafJS

A Promise-based TCP/UDP client for sending application metrics to Telegraf/InfluxDB.

Install

npm install --save telegrafjs

Example

const telegraf = require('telegrafjs');
const Measurement = telegraf.Measurement;
const Int = telegraf.Int;
const Float = telegraf.Float;
const TelegrafUDPClient = telegraf.TelegrafUDPClient;
const TelegrafTCPClient = telegraf.TelegrafTCPClient;

let m1 = new Measurement(
    "metric-name",
    { tag1: "tagval1" },
    {
        integer_field: new Int(integer_field),
        float_field: new Float(10.1),
        boolean_field: true,
        string_field: "yoohoo"
    }
);

let client = new TelegrafUDPClient(); // or TelegrafTCPClient()
client.connect()
.then(() => {
    return client.sendMeasurement(m1);
})
.then(() => {
    client.close();
});

Links

License

Apache 2.0

About

Telegraf/InfluxDB TCP/UDP Client for NodeJS

Resources

License

Stars

Watchers

Forks

Packages

No packages published