Script with multi-input.out graphs as -nan.

Templates, scripts for templates, scripts and requests for templates.

Moderators: Moderators, Developers

Post Reply
Author
Message
Epx998
Posts: 19
Joined: Wed Oct 12, 2011 2:48 pm

Script with multi-input.out graphs as -nan.

#1 Post by Epx998 » Mon Oct 24, 2011 1:23 pm

Hi All,

I am still not sure why a custom script shows graphed output as -nan values. As far as I know I set it correctly, the debugg doesn't show anything that I see as an error. The debug FAQdoesn't really go into debugging -nan results.

Basicaly it is a test bash script, it runs the lines below. Are there any examples that show how to set it up correctly? I followed a guide in the docs that have the random number graph, I get -nan with that as well following the how-to step by step.

Code: Select all

#!/bin/bash

netstat -a --numeric-ports | grep -c :$1
netstat -a --numeric-ports | grep -c :$2
netstat -a --numeric-ports | grep -c :$3
Here is the graph debug output;

Code: Select all

RRDTool Command:

/usr/bin/rrdtool graph - \
--imgformat=PNG \
--start=-86400 \
--end=-300 \
--title='Multi Ports Open' \
--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="/usr/share/cacti/rra/localhost_port_one_8.rrd":port_one:AVERAGE \
DEF:b="/usr/share/cacti/rra/localhost_port_one_8.rrd":port_two:AVERAGE \
DEF:c="/usr/share/cacti/rra/localhost_port_one_8.rrd":port_three:AVERAGE \
AREA:a#FFAB00FF:"Port 80"  \
GPRINT:a:LAST:" Current\:%8.2lf %s"  \
GPRINT:a:AVERAGE:"Average\:%8.2lf %s"  \
GPRINT:a:MAX:"Maximum\:%8.2lf %s\n"  \
AREA:b#F5F800FF:"Port 22":STACK \
GPRINT:b:LAST:" Current\:%8.2lf %s"  \
GPRINT:b:AVERAGE:"Average\:%8.2lf %s"  \
GPRINT:b:MAX:"Maximum\:%8.2lf %s\n"  \
AREA:c#C4FD3DFF:"Port 161":STACK \
GPRINT:c:LAST:"Current\:%8.2lf %s"  \
GPRINT:c:AVERAGE:"Average\:%8.2lf %s"  \
GPRINT:c:MAX:"Maximum\:%8.2lf %s\n" 

RRDTool Says:

OK

Epx998
Posts: 19
Joined: Wed Oct 12, 2011 2:48 pm

Re: Script with multi-input.out graphs as -nan.

#2 Post by Epx998 » Mon Oct 24, 2011 1:44 pm

Ok. "-nan" is a database error "not a number". So Cacti thinks the output isn't a number. Where would I start for debugging that, here is the output when I run the script manually;

Code: Select all

/multi-out.sh 80 22 161
7
2
1
So clearly they are numbers. Do the returns in the output cause a problem?

noname
Cacti Guru User
Posts: 1566
Joined: Thu Aug 05, 2010 2:04 am
Location: Japan

Re: Script with multi-input.out graphs as -nan.

#3 Post by noname » Mon Oct 24, 2011 11:55 pm

Such an output across multiple lines is accepted for data input methods?
- Data Input Methods - Cacti Docs

Post Reply