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']);
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']);
The problem is not in the ds name, but in the next command.
db.update(start + 0, 15);
If you leave only the lines that you provided the code will compile without errors. To correct the error from the update method go to the proc.js file (node_modules/rrdtool/lib/proc.js) and change the update method to something like this.
exports.update = function (file, ts, values, cb) {
var cmd = [ts];
cmd.push(values);
exec(['update', file, cmd.join(':')], function (err) {
cb(err);
});
};
Before the change, it did not form the rrdtool command correctly, the command looked like update --template timestamp
, instead of update timestamp:value
. In my example the timestamp is start + 0, and the value is 15.
The issue is in update method. If you try to do something like this:
db.update(start + 1, 90)
It will produce the error. You should pass the object instead of the value. Something like this will work:
db.update(start + 0, {test: 15});