[rrd-users] problem with RRDs::graph

Rodolphe Pineau pineau at rti-zone.org
Thu Apr 14 03:09:56 MEST 2005


I'm trying to use the perl module
the RRDs:update works fine but RRDs:graph alays give me the same error 
on 2 different machines, a linux debian with rrdtool 1.0.49, perl 5.8.4
and on Mac OS X with rrdtool 1.0.49, perl 5.8.1
here is the script with the error (I'm aperl beginner so ... might not 
be the best code you've seen):

===== SCRIPT =======
#!/usr/bin/perl -w

use SNMP;
use RRDs;

die "usage :\n\t snmp.pl host community nb_cpu rrd_file graph_path\n\n" 
if(@ARGV <5);

$ENV{'MIBS'}="ALL";  #Load all available MIBs
($SNMP_TARGET, $SNMP_COMMUNITY, $NBCPU, $RRD_FILE, $RRD_GRAPH_PATH) = 
@ARGV;


$SESSION = new SNMP::Session (DestHost => $SNMP_TARGET,
                               Community => $SNMP_COMMUNITY,
                               Version => '2c');

#
# Get the snmp values
#

   $user=$SESSION->get('ssCpuRawUser.0');
   $system=$SESSION->get('ssCpuRawSystem.0');
   $idle=$SESSION->get('ssCpuRawIdle.0');
   $kernel=$SESSION->get('ssCpuRawKernel.0');
   $nice=$SESSION->get('ssCpuRawNice.0');

#
# update the RDD
#

RRDs::update($RRD_FILE,"N:$user:$system:$idle:$kernel:$nice:$NBCPU");
my $ERR=RRDs::error;
die "ERROR while updating mem.rrd: $ERR\n" if $ERR;
#
# Crate the graph
#

RRDs::graph ( "$RRD_GRAPH_PATH/sys_day.gif ", \
             "--title=Dayly system use", \
             "--start -84600", \
             "-u 100", \
             "-r",\
             "-M", \
             "DEF:User=$RRD_FILE:user:AVERAGE", \
             "DEF:System=$RRD_FILE:system:AVERAGE", \
             "DEF:Idle=$RRD_FILE:idle:AVERAGE", \
             "DEF:Kernel=$RRD_FILE:kernel:AVERAGE", \
             "DEF:Nice=$RRD_FILE:nice:AVERAGE", \
             "DEF:Cpu=$RRD_FILE:cpu:AVERAGE", \
             "CDEF:pUser=User,Cpu,/", \
             "CDEF:pSystem=System,Cpu,/", \
             "CDEF:pIdle=Idle,Cpu,/", \
             "CDEF:pKernel=Kernel,Cpu,/", \
             "CDEF:pNice=Nice,Cpu,/", \
             "AREA:pUser#00FF00:user", \
             "LINE1:pSystem#FF8080:system", \
             "LINE1:pIdle#0000FF:idle");

  my $err=RRDs::error;
  die "problem generating the graph: $err\n" if ($err) ;

====== END SCRIPT =========

and here is the error :
problem generating the graph: unknown function 'SCALAR'

if I doing the same graph using the command line (rrdtol graph ...) 
either from perl (`rrdtool graph ....`) or bash it works


anybody has any idea how to help me out of this ?!

thanks
Rodolphe

--

|        Rodolphe Pineau    RTI-Zone        |
|         http://www.rti-zone.org/          |
| Coldfire Robot / Unix / Atari / Astronomy |

-- Attached file removed by Ecartis and put at URL below --
-- Type: application/pkcs7-signature
-- Size: 2k (2367 bytes)
-- URL : http://lists.ee.ethz.ch/p/425DC2F328784-smime.p7s


--
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://lists.ee.ethz.ch/rrd-users
WebAdmin    http://lists.ee.ethz.ch/lsg2.cgi



More information about the rrd-users mailing list