[rrd-users] RRDs::Graph issue

Justin Ellison justin at techadvise.com
Mon Aug 18 00:52:38 MEST 2003


Hi all,
	I'm writing a perl script plugin for nagios that will store router
traffic info in a rrd, and print out the LAST values from the previous 5
minutes.  I will be using Cacti to actually generate and display the
graph, so I just need textual LAST values via a PRINT for what I'm
trying to do.  The code is generating and updating the rrd correctly,
but the RRDs::graph command is generating the following error:


ERROR while updating
/var/www/html/cacti/rra/xxx.xxx.xxx.xxx.1_Ethernet0.rrd: unknown
function 'SCALAR'

Here is the related code:

my ($start,$end) = (time-86400,time-300);
my ($averages,$xsize,$ysize) = RRDs::graph ("$dbfile.png", \
		       "--start=$start", \
		       "--end=$end", \
		       "DEF:bytesin=$dbfile:traffic_in:AVERAGE", \
		       "DEF:bytesout=$dbfile:traffic_out:AVERAGE", \
		       "CDEF:bitsin=bytesin,8,*", \
		       "CDEF:bitsout=bytesout,8,*", \
		       'PRINT:bitsin:LAST:%8.2lf%s', \
		       'PRINT:bitsout:LAST:%8.2lf%s'
		       );

my $ERR=RRDs::error;
die "ERROR while updating $dbfile: $ERR\n" if $ERR;

But running the command line equivalent as the nagios user works fine:

nagios at laptop libexec $ rrdtool graph test.png --start=-86400 --end=-300
DEF:bytesin=/var/www/html/cacti/rra/xxx.xxx.xxx.1_Ethernet0.rrd:traffic_in:AVERAGE DEF:bytesout=/var/www/html/cacti/rra/xxx.xxx.xxx.1_Ethernet0.rrd:traffic_out:AVERAGE CDEF:bitsin=bytesin,8,* CDEF:bitsout=bytesout,8,* PRINT:bitsin:LAST:"%8.2lf%s" PRINT:bitsout:LAST:"%8.2lf%s"
0x0
  602.34k
  863.21k



I've been working all weekend on these few lines, and I know it's gotta
be right in front of me...  any takers?

-- 
Justin Ellison <justin at techadvise.com>

-- Attached file removed by Ecartis and put at URL below --
-- Type: application/pgp-signature
-- Desc: This is a digitally signed message part
-- Size: 190 bytes
-- URL : http://www.ee.ethz.ch/~slist/p/51-signature.asc


--
Unsubscribe mailto:rrd-users-request at list.ee.ethz.ch?subject=unsubscribe
Help        mailto:rrd-users-request at list.ee.ethz.ch?subject=help
Archive     http://www.ee.ethz.ch/~slist/rrd-users
WebAdmin    http://www.ee.ethz.ch/~slist/lsg2.cgi



More information about the rrd-users mailing list