[rrd-users] Returning nan values

Matthew M. Boedicker matthewm at boedicker.org
Thu Jun 19 20:10:39 CEST 2008


Sorry, disregard the part about checking for errors. I was thinking of the perl
bindings, the Python bindings throw exceptions.

I just did a test and rrdtool does allow updates with values that are not
numbers. It must silently discard the data? It seems like checking this might
be a good idea.

On Thu, Jun 19, 2008 at 01:45:02PM -0400, Matthew M. Boedicker wrote:
> If your update statement is:
> 
> rrdtool.update('cpu.rrd','N:+user+:+nice+:+sys+:+idle+')
> 
> it's trying to update with the string N:+user+:+nice+:+sys+:+idle+ every time
> and not putting in the actual numbers.
> 
> It should be something like:
> 
> rrdtool.update('cpu.rrd',"N:%s:%s:%s:%s" % (user, nice, sys, idle))
> 
> Are you checking for errors after update? I would think it would say something
> if you are trying to update with values like "+user+".
> 
> On Thu, Jun 19, 2008 at 01:36:55PM -0400, Emily Chouinard wrote:
> > So I've got my code all done but my update function doesn't work. I want 
> > to take the values from the /proc/stat file and update my rrd with them 
> > but when I do an rrdtool fetch cpu.rrd AVERAGE and several interations I 
> > get:
> >  fetch cpu.rrd AVERAGE
> >                            user                nice                 
> > sys               idle
> > 
> > 1213810500: nan nan nan nan
> > 1213810800: nan nan nan nan
> > 1213811100: nan nan nan nan
> > 
> > (but that is just a small glip of all the nan values I get) I was 
> > wondering if my update function was correct, my rrd is created properly 
> > using
> > rrdtool.create('cpu.rrd',
> >      'DS:user:DERIVE:30:0:U',
> >      'DS:nice:DERIVE:30:0:U',
> >      'DS:sys:DERIVE:30:0:U',
> >      'DS:idle:DERIVE:30:0:U',
> >      'RRA:AVERAGE:0.5:1:576',
> >      'RRA:AVERAGE:0.5:6:672',
> >      'RRA:AVERAGE:0.5:24:732',
> >      'RRA:AVERAGE:0.5:144:1460')
> > 
> > and then I run a loop to extract the data from a file
> >  infile= open('/proc/stat', 'r')
> >     #for x in range(0,1):
> >     line = infile.readline()
> >     if line.startswith('cpu'):
> >     info = line.split()   
> >     user = info[1]
> >     nice = info[2]    
> >     sys = info[3]
> >     idle = info[4]
> > and then I try to update these values from user, nice sys and idle into 
> > my rrd with
> > rrdtool.update('cpu.rrd','N:+user+:+nice+:+sys+:+idle+')
> > 
> > but it only gives my nan values, any suggestions on why this is?
> > 
> > _______________________________________________
> > rrd-users mailing list
> > rrd-users at lists.oetiker.ch
> > https://lists.oetiker.ch/cgi-bin/listinfo/rrd-users
> 
> _______________________________________________
> rrd-users mailing list
> rrd-users at lists.oetiker.ch
> https://lists.oetiker.ch/cgi-bin/listinfo/rrd-users



More information about the rrd-users mailing list