GPRINT error - returns zero value when set to Exact Numbers

Post support questions that directly relate to Linux/Unix operating systems.

Moderators: Developers, Moderators

garyb
Posts: 15
Joined: Tue Apr 17, 2012 6:04 am

GPRINT error - returns zero value when set to Exact Numbers

Post by garyb »

Hello,

I've written a data query to return some information that we would like to graph. This works absolutely fine, and in the past I've had this working with cacti.

I've added this data source into a simple graph which should output the numerical values via GPRINT from the script at the bottom of the graph.

If I set the GPRINT Type to either Exact Numbers or Normal, then the graph will only output "0".

If this is changed back to Load Average, we start to get output to two decimal places?

How can I get this working as whole numbers?

Can anyone help

Thanks
User avatar
gandalf
Developer
Posts: 22383
Joined: Thu Dec 02, 2004 2:46 am
Location: Muenster, Germany
Contact:

Re: GPRINT error - returns zero value when set to Exact Numb

Post by gandalf »

Please post the output from Graph Management for the given graph when switching to DEBUG mode for both types of graph
R.
garyb
Posts: 15
Joined: Tue Apr 17, 2012 6:04 am

Re: GPRINT error - returns zero value when set to Exact Numb

Post by garyb »

## With GPRINT (current) set to Exact numbers ##

RRDTool Command:

/usr/bin/rrdtool graph - \
--imgformat=PNG \
--start=-86400 \
--end=-300 \
--title='Codian MCU001' \
--base=1000 \
--height=120 \
--width=500 \
--alt-autoscale-max \
--lower-limit=0 \
--vertical-label='' \
--slope-mode \
--font TITLE:12: \
--font AXIS:8: \
--font LEGEND:10: \
--font UNIT:8: \
DEF:a="/var/lib/cacti/rra/mcu001_vid_use1_13.rrd":vid_use1:AVERAGE \
DEF:b="/var/lib/cacti/rra/mcu001_vid_use1_13.rrd":vid_use1:MAX \
COMMENT:"Video usage\n" \
GPRINT:a:LAST:"Current\:%8.0lf" \
GPRINT:a:AVERAGE:"Average\:%8.2lf %s" \
GPRINT:b:MAX:"Maximum\:%8.2lf %s\n" \
LINE2:a#FF0000FF:"Average" RRDTool Says:

RRDTool Says:

OK

## With GPRINT (current) set to Load average ##

RRDTool Command:

/usr/bin/rrdtool graph - \
--imgformat=PNG \
--start=-86400 \
--end=-300 \
--title='Codian MCU001' \
--base=1000 \
--height=120 \
--width=500 \
--alt-autoscale-max \
--lower-limit=0 \
--vertical-label='' \
--slope-mode \
--font TITLE:12: \
--font AXIS:8: \
--font LEGEND:10: \
--font UNIT:8: \
DEF:a="/var/lib/cacti/rra/mcu001_vid_use1_13.rrd":vid_use1:AVERAGE \
DEF:b="/var/lib/cacti/rra/mcu001_vid_use1_13.rrd":vid_use1:MAX \
COMMENT:"Video usage\n" \
GPRINT:a:LAST:"Current\:%8.2lf" \
GPRINT:a:AVERAGE:"Average\:%8.2lf %s" \
GPRINT:b:MAX:"Maximum\:%8.2lf %s\n" \
LINE2:a#FF0000FF:"Average" RRDTool Says:

RRDTool Says:
OK
User avatar
gandalf
Developer
Posts: 22383
Joined: Thu Dec 02, 2004 2:46 am
Location: Muenster, Germany
Contact:

Re: GPRINT error - returns zero value when set to Exact Numb

Post by gandalf »

That looks fine. It won't work for numbers < 1. Which numbers do you want to GPRINT?
R.
garyb
Posts: 15
Joined: Tue Apr 17, 2012 6:04 am

Re: GPRINT error - returns zero value when set to Exact Numb

Post by garyb »

Currently the script is out putting numbers >5

And still it shows as zero :cry:
garyb
Posts: 15
Joined: Tue Apr 17, 2012 6:04 am

Re: GPRINT error - returns zero value when set to Exact Numb

Post by garyb »

And if I set the Avg and Max GPRINT functions to Round numbers.. they also then start to show as zero.
User avatar
gandalf
Developer
Posts: 22383
Joined: Thu Dec 02, 2004 2:46 am
Location: Muenster, Germany
Contact:

Re: GPRINT error - returns zero value when set to Exact Numb

Post by gandalf »

Would it be possible to email that very rrd file?
R.
garyb
Posts: 15
Joined: Tue Apr 17, 2012 6:04 am

Re: GPRINT error - returns zero value when set to Exact Numb

Post by garyb »

In order to email it across, I would need to check the content of the file first (security policy here :( )

What tool can decode it, as it can't be read as clear text?

Edit.

I've dumped it out to xml via rrdtool - what email address please?
User avatar
gandalf
Developer
Posts: 22383
Joined: Thu Dec 02, 2004 2:46 am
Location: Muenster, Germany
Contact:

Re: GPRINT error - returns zero value when set to Exact Numb

Post by gandalf »

garyb wrote:I've dumped it out to xml via rrdtool - what email address please?
That's indeed the required format. Please use the email address provided underneath each of my posts; gzip the file before posting, please
R.
garyb
Posts: 15
Joined: Tue Apr 17, 2012 6:04 am

Re: GPRINT error - returns zero value when set to Exact Numb

Post by garyb »

File sent.

Thanks!
garyb
Posts: 15
Joined: Tue Apr 17, 2012 6:04 am

Re: GPRINT error - returns zero value when set to Exact Numb

Post by garyb »

Did you get my email gandalf ?

Thanks
User avatar
gandalf
Developer
Posts: 22383
Joined: Thu Dec 02, 2004 2:46 am
Location: Muenster, Germany
Contact:

Re: GPRINT error - returns zero value when set to Exact Numb

Post by gandalf »

Yep, but need more time. Not before end of weekend.
R.
User avatar
gandalf
Developer
Posts: 22383
Joined: Thu Dec 02, 2004 2:46 am
Location: Muenster, Germany
Contact:

Re: GPRINT error - returns zero value when set to Exact Numb

Post by gandalf »

I just verified in production environment, that the basic idea is working. So I need to find out, in which way your environment is "special" ...
R.
User avatar
gandalf
Developer
Posts: 22383
Joined: Thu Dec 02, 2004 2:46 am
Location: Muenster, Germany
Contact:

Re: GPRINT error - returns zero value when set to Exact Numb

Post by gandalf »

garyb wrote:Currently the script is out putting numbers >5

And still it shows as zero :cry:
Unfortunately, this statement is NOT correct. Next time I will request a screenshot. I'll attach what I've created with your rrd file.

Do you see the "m", denoting "milli" == "1/1000"?
So, your numbers are indeed below 1. Printing the integer part of such a number indeed yields 0.
R.
Attachments
cacti.png
cacti.png (14.63 KiB) Viewed 1837 times
garyb
Posts: 15
Joined: Tue Apr 17, 2012 6:04 am

Re: GPRINT error - returns zero value when set to Exact Numb

Post by garyb »

I beg to differ... Unless I'm not understanding.

Here is the latest log entry from cacti.log - showing the script returning a value of 26

Code: Select all

04/23/2012 10:30:03 AM - CMDPHP: Poller[0] Host[2] DS[13] CMD: sh /usr/share/cacti/site/scripts/Scrape-mcu001.sh <ipaddress> <username> <password>, output: vid_use1:26
Post Reply

Who is online

Users browsing this forum: No registered users and 0 guests