[rrd-users] RRD Newbee needs help with RRD Perl script

Koaps koaps at yahoo.com
Wed Nov 4 21:13:39 CET 2009


Hi Mark,

You're missing the module, did you build rrdtool from source or use a RPM/YUM?

To check you can do:

updatedb
locate RRDs

If the perl module is installed you should get something like:

/usr/lib/perl5/vendor_perl/5.8.8/i386-linux-thread-multi/RRDs.pm

If you find the module but it's not in a perl ISA path you will need to add a line like this to tell perl where the module is:

use lib qw( /path/to/RRDs );


I tend to build rrdtool from source per the rrdbuild:

http://oss.oetiker.ch/rrdtool/doc/rrdbuild.en.html

If you are on centos, you can yum install perl-rrdtool and that should get you want you need.

-Chris


--- On Wed, 11/4/09, Mark Woodruff <n3hf at yahoo.com> wrote:

> From: Mark Woodruff <n3hf at yahoo.com>
> Subject: Re: [rrd-users] RRD Newbee needs help with RRD Perl script
> To: "Koaps" <koaps at yahoo.com>, rrd-users at lists.oetiker.ch
> Date: Wednesday, November 4, 2009, 10:52 AM
> 
> Chris, Thank you for the feedback. I tried rewriting
> something with RRDs but no success, something must be
> missing from the installation (I think!).
>  
> Can't locate loadable object for module RRDs in @INC
> (@INC contains: /usr/lib/perl5/5.8.5/i386-linux-thread-multi
> /usr/lib/perl5/5.
> .5
> /usr/lib/perl5/site_perl/5.8.5/i386-linux-thread-multi
> /usr/lib/perl5/site_perl/5.8.5 /usr/lib/perl5/site_perl
> /usr/lib/perl5/ve
> dor_perl/5.8.5/i386-linux-thread-multi
> /usr/lib/perl5/vendor_perl/5.8.5 /usr/lib/perl5/vendor_perl
> .) at ./temp-one.cgi line 27
> Compilation failed in require at ./temp-one.cgi line
> 27.
>  
> Mark
> 
> 
> 
> 
> 
> From: Koaps
> <koaps at yahoo.com>
> To: Mark
> Woodruff <n3hf at yahoo.com>
> Sent: Tue,
> November 3, 2009 8:42:04 PM
> Subject: Re:
> [rrd-users] RRD Newbee needs help with RRD Perl script
> 
> I have no idea about RRDp but I have used RRDs with no
> issues in perl scripts.
> 
> The graph subroutine I used looked like this:
> 
> #    print "Creating
> graph\n";
>     RRDs::graph
> ("$png_path/$k.png",
>            
>     "--title=$TITLE $k",
>            
>     "--vertical-label=$VLABEL",
>        
> "--color=$BACK",
>        
> "--color=$SHADEA",
>        
>  "--color=$SHADEB",
>        
> "--color=$FONT",
>        
> "--color=$CANVAS",
>        
> "--color=$GRID",
>        
> "--color=$MGRID",
>        
> "--color=$FRAME",
>        
> "--color=$ARROW",
>            
>     "--base=$BASE",
>            
>    
> "DEF:avg=$rrd_path/$k.rrd:$ds:AVERAGE",
>            
>    
> "DEF:pred=$rrd_path/$k.rrd:$ds:HWPREDICT",
>            
>    
> "DEF:dev=$rrd_path/$k.rrd:$ds:DEVPREDICT",
>            
>    
> "DEF:fail=$rrd_path/$k.rrd:$ds:FAILURES",
>         "COMMENT: 
>   \\n",
>    
>      "CDEF:mbs=avg,1048576,/",
>        
> "LINE2:$AVG_LINE:Average MB/s",
>        
> "GPRINT:mbs:AVERAGE:\\: %5.2lf",
>        
> "GPRINT:mbs:LAST:    Last\\:
> %5.2lf\\n",
>        
> "TICK:$TICK:1.0:Failures",
>        
> "CDEF:upper=pred,dev,2,*,+",
>        
> "CDEF:lower=pred,dev,2,*,-",
>        
> "LINE1:$UPPER_LINE:Upper Bound",
>        
> "LINE1:$LOWER_LINE:Lower Bound",
>        
> "\\n",
>        
> "COMMENT:$date",
>             );
>         $err=RRDs::error;
>         if ($err) {print
> "problem generating the graph: $err\n";}
> 
> 
> with
>  variables defined like this:
> NOTE: $k for me was pulled from a reference I generated,
> you should be able to set it to your RRD without any
> issues.
> 
> 
> #--------------#
> # RRDTool vars #
> #--------------#
> my $png_path = "/var/www/html/";
> my $TITLE =  "IO Test:";
> my $VLABEL = "Bytes per second (B/s)";
> my $BACK = "BACK#000000";
> my $SHADEA = "SHADEA#FFFFFF";
> my $SHADEB = "SHADEB#FFFFFF";
> my $FONT = "FONT#DDDDDD";
> my $CANVAS = "CANVAS#202020";
> my $GRID = "GRID#666666";
> my $MGRID = "MGRID#AAAAAA";
> my $FRAME = "FRAME#202020";
> my $ARROW = "ARROW#FFFFFF";
> my $BASE = 1024;
> my $AVG_LINE = "AVG#0000FF";
> my $TICK = "FAIL#FFFFA0";
> my $UPPER_LINE = "UPPER#ff0000";
> my $LOWER_LINE = "LOWER#ff0000";
> 
> 
> -Chris
> 
> --- On Tue, 11/3/09, Mark Woodruff <n3hf at yahoo.com>
> wrote:
> 
> > From: Mark Woodruff <n3hf at yahoo.com>
> > Subject: [rrd-users] RRD Newbee needs help with RRD
> Perl script
> > To: rrd-users at lists.oetiker.ch
> > Date: Tuesday, November 3, 2009, 5:03 PM
> > Recently installed Version 1.3.8
> > and have been trying to make a Perl script wrritten by
> Brian
> > Lane (Digitemp) from what I have been able to
> determine the
> > scripts hangs up on the line containing:
> >  
> >  $answer=RRDp::read;
> >  
> > # Output a HTML header for the PNG
> > image to follow
> > 
> > print $cgi->header('image/png');
> > # Generate the graph
> > RRDp::cmd "graphv - --imgformat PNG",
> > "--start '$starttime' --end
> > '$endtime'",
> > "--width $width --height $height",
> >
>  "DEF:temp_c=$rrd:$var:AVERAGE",
> > "CDEF:temp_f=temp_c,9,*,5,/,32,+",
> > "LINE1:temp_f$color:'$label'";
> > $answer=RRDp::read;
> > print $$answer;
> > RRDp::end;
> >  
> > After reading rrd tutiorial I wrote a
> > shorten bash script which works fine which tells
> me my
> > RRD datafile is fine. Is there a bug and/or do I have
> > installation issue?? 
> >  
> > Mark
> > 
> > 
> >      
> > -----Inline Attachment Follows-----
> > 
> > _______________________________________________
> > rrd-users mailing list
> > rrd-users at lists.oetiker.ch
> > https://lists.oetiker.ch/cgi-bin/listinfo/rrd-users
> > 
> 
> 
> 
> 
> 
> 
>       


      



More information about the rrd-users mailing list