[rrd-users] Returning nan values
Emily Chouinard
cousin17 at msu.edu
Thu Jun 19 20:04:50 CEST 2008
Sorry, that didn't work for me,
here's what I get when I rrdtool info cpu.rrd
filename = "cpu.rrd"
rrd_version = "0003"
step = 300
last_update = 1213898459
ds[user].type = "DERIVE"
ds[user].minimal_heartbeat = 30
ds[user].min = 0.0000000000e+00
ds[user].max = NaN
ds[user].last_ds = "279440"
ds[user].value = NaN
ds[user].unknown_sec = 59
ds[nice].type = "DERIVE"
ds[nice].minimal_heartbeat = 30
ds[nice].min = 0.0000000000e+00
ds[nice].max = NaN
ds[nice].last_ds = "72951"
ds[nice].value = NaN
ds[nice].unknown_sec = 59
ds[sys].type = "DERIVE"
ds[sys].minimal_heartbeat = 30
ds[sys].min = 0.0000000000e+00
ds[sys].max = NaN
ds[sys].last_ds = "130885"
ds[sys].value = NaN
ds[sys].unknown_sec = 59
ds[idle].type = "DERIVE"
ds[idle].minimal_heartbeat = 30
ds[idle].min = 0.0000000000e+00
ds[idle].max = NaN
ds[idle].last_ds = "130602495"
ds[idle].value = NaN
ds[idle].unknown_sec = 59
rra[0].cf = "AVERAGE"
rra[0].rows = 576
rra[0].pdp_per_row = 1
rra[0].xff = 5.0000000000e-01
rra[0].cdp_prep[0].value = NaN
rra[0].cdp_prep[0].unknown_datapoints = 0
rra[0].cdp_prep[1].value = NaN
rra[0].cdp_prep[1].unknown_datapoints = 0
rra[0].cdp_prep[2].value = NaN
rra[0].cdp_prep[2].unknown_datapoints = 0
rra[0].cdp_prep[3].value = NaN
rra[0].cdp_prep[3].unknown_datapoints = 0
rra[1].cf = "AVERAGE"
rra[1].rows = 672
rra[1].pdp_per_row = 6
rra[1].xff = 5.0000000000e-01
rra[1].cdp_prep[0].value = NaN
rra[1].cdp_prep[0].unknown_datapoints = 0
rra[1].cdp_prep[1].value = NaN
rra[1].cdp_prep[1].unknown_datapoints = 0
rra[1].cdp_prep[2].value = NaN
rra[1].cdp_prep[2].unknown_datapoints = 0
rra[1].cdp_prep[3].value = NaN
rra[1].cdp_prep[3].unknown_datapoints = 0
rra[2].cf = "AVERAGE"
rra[2].rows = 732
rra[2].pdp_per_row = 24
rra[2].xff = 5.0000000000e-01
rra[2].cdp_prep[0].value = NaN
rra[2].cdp_prep[0].unknown_datapoints = 0
rra[2].cdp_prep[1].value = NaN
rra[2].cdp_prep[1].unknown_datapoints = 0
rra[2].cdp_prep[2].value = NaN
rra[2].cdp_prep[2].unknown_datapoints = 0
rra[2].cdp_prep[3].value = NaN
rra[2].cdp_prep[3].unknown_datapoints = 0
rra[3].cf = "AVERAGE"
rra[3].rows = 1460
rra[3].pdp_per_row = 144
rra[3].xff = 5.0000000000e-01
rra[3].cdp_prep[0].value = NaN
rra[3].cdp_prep[0].unknown_datapoints = 72
rra[3].cdp_prep[1].value = NaN
rra[3].cdp_prep[1].unknown_datapoints = 72
rra[3].cdp_prep[2].value = NaN
rra[3].cdp_prep[2].unknown_datapoints = 72
rra[3].cdp_prep[3].value = NaN
rra[3].cdp_prep[3].unknown_datapoints = 72
my rrdtool.update is within an if statement, I don't think it matters,
but does that have an affect on it? After the update command I
time.sleep(60) and I guess I can't figure out why I'm only getting nan
values
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
>>
>
>
>
More information about the rrd-users
mailing list