[rrd-users] Re: Error - ERROR: expected 2 data source readings (got 1) from a:a:...

Leif Neland leif at neland.dk
Tue Jul 12 21:33:15 MEST 2005


> Hi,
> 
> I have written a very simple C program which will feed random data to
> the RRD tool for graphing. But, I am getting the error
> 
> ERROR: expected 2 data source readings (got 1) from a:a:...
> 
> 
> My Create command is :
> 
>    system("rrdtool create test_data.rrd --step 3 DS:a:GAUGE:600:0:U
> DS:b:GAUGE:600:0:U RRA:AVERAGE:0.
> 5:1:200");
> 
> 
> In update, I would like to update the values of a and b with values 1
> and 2. Is this the right update command?
> 
>    system("rrdtool update test_data.rrd a:1 b:2 N");
> 
> If so, why am I getting an error?
> 
The syntax is 
 rrdtool update filename
                --template|-t ds-name:ds-name:...
                time|N:value[:value...]

                at-time at value[:value...]

                [ time:value[:value...] ..]

In your case system("rrdtool update test_data.rrd N:1:2");
or, if you want to name your variables:
system("rrdtool update test_data.rrd -t a:b N:1:2");

Leif


> Also, what if I want to update a and b with not constants like 1, 2
> but with some value returned by a function say fn1() and fn2(). Is
> this how I write the update command?
> 
>    ret1 = fn1();
>    ret2 = fn2();
> 
>   system("rrdtool update test_data.rrd a:ret1 b:ret2 N");
> 
> Is this ok? Please correct me.

probably:
system(sprintf("rrdtool update test_date.rrd N:%d:%d",ret1,ret2));

Leif
> Thanks!

-- 
Denne mail er kontrolleret for spam og virus af http://www.MailCare.dk

--
Unsubscribe mailto:rrd-users-request at list.ee.ethz.ch?subject=unsubscribe
Help        mailto:rrd-users-request at list.ee.ethz.ch?subject=help
Archive     http://lists.ee.ethz.ch/rrd-users
WebAdmin    http://lists.ee.ethz.ch/lsg2.cgi



More information about the rrd-users mailing list