[rrd-users] Little trouble with rrd_create_r

Geoff Garside geoff.garside at openhosting.co.uk
Wed Jun 13 13:46:17 CEST 2007


> -----Original Message-----
> From: rrd-users-bounces at lists.oetiker.ch [mailto:rrd-users-
> bounces at lists.oetiker.ch] On Behalf Of Alex van den Bogaerdt
> Sent: 13 June 2007 12:06
> To: rrd-users at lists.oetiker.ch
> Subject: Re: [rrd-users] Little trouble with rrd_create_r
> 
> On Wed, Jun 13, 2007 at 11:35:22AM +0100, Geoff Garside wrote:
> 
> > The errors I am getting when creating the RRDs is "expected 2 data
> source
> > readings (got 1) from 0:". I've got my code printing out the equivalent
> > `rrdtool create` command from the same arguments passed to the
> > `rrd_create_r` function and it prints out the following
> 
> $ grep 'expected.*data source' *
> Binary file librrd_th_la-rrd_update.o matches
> Binary file rrdupdate matches
> rrd_update.c:       rrd_set_error("expected timestamp not found in data
> source from %s:...",
> rrd_update.c:       rrd_set_error("expected %lu data source readings (got
> %lu) from %s:...",
> Binary file rrd_update.o matches
> $
> 
> In other words: there's no way this error message is generated while
> creating your database.
> 
> Check your update routines.  Try not calling rrd if your input
> data is incomplete; see if rrdtool still complains (probably not!)
> Do not assume snmpget (or -walk, or whatever) returns data. Verify
> this.  Before calling "rrdtool update ${rrd} ${timestamp}:${data}",
> verify that these variables contain something useful. And do write
> those commands to a file for debugging purposes (make sure timestamp
> is numeric, not "N").
> 
> HTH
> --
> Alex van den Bogaerdt
> http://www.vandenbogaerdt.nl/rrdtool/
> 
> _______________________________________________
> rrd-users mailing list
> rrd-users at lists.oetiker.ch
> https://lists.oetiker.ch/cgi-bin/listinfo/rrd-users

Thanks I'll take a look at that. It has certainly been puzzling me why I
seem to be getting this error on create.

Within the actual program which calls my rrd wrapper functions I have this.
As a context rrd_filename is a character array and err in an int. The
sc_warning function prints out to stderr.

	if (!sc_rrd_file_exists(rrd_filename))
	    if ((err = sc_rrd_create(rrd_filename)) != 0)
	        sc_warning("Unable to create rrd: %s: %s", 
	            rrd_filename, sc_rrd_get_last_error());

which is where I am getting the expected 2 data sources errors from. It is
printed on the line with "Unable to create rrd". The sc_rrd_get_last_error()
function is just a wrapper which returns

	rrd_get_context()->rrd_error

I am sort of assuming the rrd_error member of the context will be set by the
rrd_create_r function provided it doesn't return a value of 0. Am I correct
in this assumption?

Regards,
Geoff Garside

Open Hosting Ltd




More information about the rrd-users mailing list