Git Product home page Git Product logo

influxdb-lite's Introduction

influxdb-lite

A light-weight library to write data to InfluxDB.

  • Parse Special Characters
  • Inbuilt Retry Mechanisms

Example

Influx DB v1

const influx = require('influxdb-lite');

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")');

Influx DB v2

const influx = require('influxdb-lite');

await influx.write(
    {
      url: 'http://influx.url',
      version: 'v2',
      bucket: 'bucket name',
      org: 'org',
      token: 'token',
    },
    [
      {
        measurement: 'web',
        fields: {
          load: 12.34
        }
      },
      {
        measurement: 'web',
        fields: {
          load: 5.4
        },
        tags: {
          host: 'linux'
        },
        timestamp: Date.now()
      }
    ]
  );

CLI

Insert Data

npx influxdb-lite 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

influxdb-lite's People

Contributors

asaianudeep avatar

Stargazers

Roman avatar NaveenKumar Namachivayam ⚡ avatar

Watchers

James Cloos avatar NaveenKumar Namachivayam ⚡ avatar  avatar

influxdb-lite's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.