[rrd-users] Little trouble with rrd_create_r

Geoff Garside geoff.garside at openhosting.co.uk
Wed Jun 13 14:20:58 CEST 2007


> -----Original Message-----
> From: rrd-users-bounces at lists.oetiker.ch [mailto:rrd-users-
> bounces at lists.oetiker.ch] On Behalf Of Geoff Garside
> Sent: 13 June 2007 12:46
> To: 'Alex van den Bogaerdt'; rrd-users at lists.oetiker.ch
> Subject: Re: [rrd-users] Little trouble with rrd_create_r
> 
> > -----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
> 
> 
> _______________________________________________
> rrd-users mailing list
> rrd-users at lists.oetiker.ch
> https://lists.oetiker.ch/cgi-bin/listinfo/rrd-users

Replying to my own message but it relates to the content.

I've modified by rrd error wrapper functions to use the rrd_get_error
function and also added a quick wrapper around the rrd_test_error function
and am using that to see if there is an error in RRD before printing out as
I was above.
The majority of the RRDs are now being created properly though nearing the
end of the list of rrds created I am getting errors (again from
rrd_update.c) of 

	illegal attempt to update using time 1181736640 when last update
time 	is 1181736640 (minimum one second step)

Within the main body of code which creates then updates the RRD it should
only do an update if there if the result of rrd_create_r == 0 &&
!rrd_test_error().

One thing which has occurred to me, is that when I am getting the SNMP
results I am storing a time_t in the structure with the results for each
switch port. This value is then used when creating the RRD update string. Is
it possible that I would need to set the initial time when creating the RRD
to the same time_t I stored when I obtained the SNMP results? I am currently
as shown before taking `time(NULL) - 600` which may well not be long enough.

Regards,
Geoff Garside
 
Open Hosting Ltd




More information about the rrd-users mailing list