GithubHelp home page GithubHelp logo

node-rrdtool's Introduction

node-rrdtool

Usage

var rrdtool = require('rrdtool');

var start = rrdtool.now() - 10;
var db = rrdtool.create('test.rrd', { start: start, step: 1 }, [
  'DS:test:GAUGE:1:0:100',
  'RRA:AVERAGE:0.5:1:10'
]);

db.update(start + 0, 15);
db.update(start + 1, 90);
db.update(start + 2, 35);
db.update(start + 3, 45);
db.update(start + 4, 85);
db.update(start + 5, 10);
db.update(start + 6, 60);
db.update(start + 7, 55);
db.update(start + 8, 75);
db.update(start + 9, 25);

db.fetch('AVERAGE', start, start + 9, function (err, data) {
  if (err) { throw err; }

  console.log(data);
});

API

rrdtool

.create(file, opts, args)

Creates a new database.

  • file: Filename where to save the db
  • opts
    • step: Seconds between each update
    • start: Unix timestamp of the first data point
    • force: Overwrite file if it exists
  • args: Array of Data Sources and Round Robin Archives

.open(file)

Loads an existing database.

  • file: Filename of the db

.now()

Returns the current unix timestamp

DB

.update([ts, ]values[, cb])

Insert data into the database.

  • ts: Unix timestamp of the data
  • values: Object with one entry per data source to insert into
  • cb: Callback to call when the data is inserted (err)

.fetch(cf, start, stop[, res], cb)

Fetch a span of data from the database.

  • cf: Consolidation function (AVERAGE, MIN, MAX, LAST)
  • start: Unix timestamp from where to start
  • stop: Unix timestamp of which to stop at
  • res: Resolution of the data, specified in seconds
  • cb: Callback to call when the data is ready (err, data)

node-rrdtool's People

Contributors

linusu avatar molaux avatar

Stargazers

 avatar

Watchers

 avatar  avatar  avatar  avatar

node-rrdtool's Issues

Error on test

Error when testing open.js

assert.js:85
throw new assert.AssertionError({
^
AssertionError: NaN == 95

Error when testing basic.js

assert.js:85
throw new assert.AssertionError({
^
AssertionError: NaN == 98.9047

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.