CDEF to remove decimal for RRD Graph?

Post general support questions here that do not specifically fall into the Linux or Windows categories.

Moderators: Developers, Moderators

Post Reply
malken00
Posts: 34
Joined: Wed Jan 17, 2007 1:22 pm
Contact:

CDEF to remove decimal for RRD Graph?

Post by malken00 »

Hey there,

I am creating a graph from a source that typically puts out numbers such as 13413.5456642154522413 I am getting the error: Error: not a simple integer: 13413.5456642154522413

I've done a lot of searching on here, and found that other people have run into the issue, but not so much on resolving it. I tried to create a CDEF that took the current_data_source and applied the FLOOR function to it, then applied that to each one of the items on my graph template, but it doesn't appear to fix the problem.

Anyone else resolve this issue before?
User avatar
gandalf
Developer
Posts: 22383
Joined: Thu Dec 02, 2004 2:46 am
Location: Muenster, Germany
Contact:

Post by gandalf »

Please visit graph management, select your graph and switch to DEBUG. Post the whole rrdtool graph statement
Reinhard
malken00
Posts: 34
Joined: Wed Jan 17, 2007 1:22 pm
Contact:

Post by malken00 »

Thanks for the response, Reinhard.

Here is the requested output:

c:/rrdtool/rrdtool.exe graph - \
--imgformat=PNG \
--start=-86400 \
--end=-300 \
--title="Mencken - Traffic" \
--rigid \
--base=1000 \
--height=120 \
--width=500 \
--alt-autoscale-max \
--lower-limit=0 \
--vertical-label="bytes per second" \
DEF:a="C\:/Inetpub/wwwroot/cacti/rra/mencken_traffic_in_256.rrd":traffic_in:AVERAGE \
CDEF:cdefa=a,FLOOR \
AREA:cdefa#00CF00:"Total Bytes" \
GPRINT:cdefa:LAST:"Current\:%8.0lf" \
GPRINT:cdefa:AVERAGE:"Average\:%8.0lf" \
GPRINT:cdefa:MAX:"Maximum\:%8.0lf" \
COMMENT:"Total: 4.32 GB\n"
RRDTool Says:

OK
User avatar
BSOD2600
Cacti Moderator
Posts: 12171
Joined: Sat May 08, 2004 12:44 pm
Location: USA

Post by BSOD2600 »

Why have you changed the default CDEF output? the default should be have "8.2lf %"
malken00
Posts: 34
Joined: Wed Jan 17, 2007 1:22 pm
Contact:

Post by malken00 »

I tried both Exact number and Normal... neither seem to be working.
User avatar
BSOD2600
Cacti Moderator
Posts: 12171
Joined: Sat May 08, 2004 12:44 pm
Location: USA

Post by BSOD2600 »

What rrdtool version? That 8.2f should've limited it to 2 decimal places.
malken00
Posts: 34
Joined: Wed Jan 17, 2007 1:22 pm
Contact:

Post by malken00 »

1.0
malken00
Posts: 34
Joined: Wed Jan 17, 2007 1:22 pm
Contact:

Post by malken00 »

Just updated to RRDTool 1.2.15

I removed all the extras from the CDEF... except Bytes to Bits:

RRDTool Command:

c:/rrdtool2/rrdtool.exe graph - \
--imgformat=PNG \
--start=-86400 \
--end=-300 \
--title="Traffic" \
--rigid \
--base=1000 \
--height=120 \
--width=500 \
--alt-autoscale-max \
--lower-limit=0 \
--vertical-label="bytes per second" \
--slope-mode \
DEF:a="C\:/Inetpub/wwwroot/cacti/rra/traffic_in_256.rrd":traffic_in:AVERAGE \
CDEF:cdefa=a,8,* \
AREA:cdefa#00CF00:"Total Bytes" \
GPRINT:cdefa:LAST:"Current\:%8.2lf %s" \
GPRINT:cdefa:AVERAGE:"Average\:%8.2lf %s" \
GPRINT:cdefa:MAX:"Maximum\:%8.2lf %s" \
COMMENT:"Total\: 0 bytes\n"
RRDTool Says:

OK


Still getting a NAN for the graph -- the cacti log does not show an error in polling, but I still get something like the following when running the poller:

OK u:0.19 s:0.38 r:2.73
OK u:0.19 s:0.38 r:2.73
OK u:0.19 s:0.38 r:2.75
ERROR: not a simple integer: '2379.09991593749'
OK u:0.19 s:0.38 r:2.75
OK u:0.19 s:0.39 r:2.77
OK u:0.19 s:0.39 r:2.77

And then of course, the graph isn't updated.
User avatar
BSOD2600
Cacti Moderator
Posts: 12171
Joined: Sat May 08, 2004 12:44 pm
Location: USA

Post by BSOD2600 »

Are you running custom scripts to return the data? Turn the logging level in cacti to medium or high. What data query does the 2379.09991593749 type values come from?
malken00
Posts: 34
Joined: Wed Jan 17, 2007 1:22 pm
Contact:

Post by malken00 »

No custom scripts, I'm just directly pulling the value from an OID via SNMP.

One note: It is pulling this digit, and lists it as a STRING: instead of a Counter64: or Integer:, etc.. should that matter?

02/18/2008 01:44:03 PM - POLLER: Poller[0] CACTI2RRD: c:/rrdtool2/rrdtool.exe update C:\Inetpub\wwwroot\cacti\rra\traffic_in_256.rrd --template traffic_in 1203371039:11458.592182769

02/18/2008 01:45:08 PM - POLLER: Poller[0] CACTI2RRD: c:/rrdtool2/rrdtool.exe update C:\Inetpub\wwwroot\cacti\rra\traffic_in_256.rrd --template traffic_in 1203371104:23014.8761223344


That is the poller running twice in a row..
malken00
Posts: 34
Joined: Wed Jan 17, 2007 1:22 pm
Contact:

Post by malken00 »

Also, here is a direct snmpget to that OID:

SNMPv2-SMI::enterprises.15.69.6.90.2 = STRING: "17170.4285860183"




It appears that the poller is not inserting the value into the RRD file at all. I think I may be looking to fix this in the wrong place. I don't think I have a graphing problem, but instead a poller issue, where the poller will not insert this long decimal placed number into the RRD file. The RRD file is actually just full of NANs
User avatar
BSOD2600
Cacti Moderator
Posts: 12171
Joined: Sat May 08, 2004 12:44 pm
Location: USA

Post by BSOD2600 »

malken00 wrote:One note: It is pulling this digit, and lists it as a STRING: instead of a Counter64: or Integer:, etc.. should that matter?
I believe this is the problem

Google for 'rrdtool not a simple integer', and you'll find lots of others with this issue.
User avatar
gandalf
Developer
Posts: 22383
Joined: Thu Dec 02, 2004 2:46 am
Location: Muenster, Germany
Contact:

Post by gandalf »

COUNTERs are clean integers by definition. GAUGEs may be floats. If anyone implemented a COUNTER to spit out floats instead of integers and then used STRING to avoid the COUNTER issue, this would simple be weird. RRDTool does not like it. If you need to get this solved, IMHO the only chance is to write a wrapper that rounds/cuts off decimals and to call this wrapper from cacti
Reinhard
Post Reply

Who is online

Users browsing this forum: No registered users and 5 guests