RRD Newbee needs help with RRD Perl script

View: New views
4 Messages — Rating Filter:   Alert me  

RRD Newbee needs help with RRD Perl script

by Mark Woodruff-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Some parts of this message have been removed. Learn more about Nabble's security policy.
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


_______________________________________________
rrd-users mailing list
rrd-users@...
https://lists.oetiker.ch/cgi-bin/listinfo/rrd-users

Parent Message unknown Re: RRD Newbee needs help with RRD Perl script

by Mark Woodruff-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Some parts of this message have been removed. Learn more about Nabble's security policy.
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@...>
To: Mark Woodruff <n3hf@...>
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@...> wrote:

> From: Mark Woodruff <n3hf@...>
> Subject: [rrd-users] RRD Newbee needs help with RRD Perl script
> To: rrd-users@...
> 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@...
> https://lists.oetiker.ch/cgi-bin/listinfo/rrd-users
>





_______________________________________________
rrd-users mailing list
rrd-users@...
https://lists.oetiker.ch/cgi-bin/listinfo/rrd-users

Re: RRD Newbee needs help with RRD Perl script

by Koaps :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

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@...> wrote:

> From: Mark Woodruff <n3hf@...>
> Subject: Re: [rrd-users] RRD Newbee needs help with RRD Perl script
> To: "Koaps" <koaps@...>, rrd-users@...
> 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@...>
> To: Mark
> Woodruff <n3hf@...>
> 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@...>
> wrote:
>
> > From: Mark Woodruff <n3hf@...>
> > Subject: [rrd-users] RRD Newbee needs help with RRD
> Perl script
> > To: rrd-users@...
> > 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@...
> > https://lists.oetiker.ch/cgi-bin/listinfo/rrd-users
> >
>
>
>
>
>
>
>      


     

_______________________________________________
rrd-users mailing list
rrd-users@...
https://lists.oetiker.ch/cgi-bin/listinfo/rrd-users

Re: RRD Newbee needs help with RRD Perl script

by Joe Loiacono :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


Here are some instructions I use for fixing the RRDs location problem (which I think is what you're experiencing). >From FlowViewer FAQ:

http://ensight.eos.nasa.gov/FlowViewer/faq.html#16

   If the FlowTracker Group page appears but there is no sample graph at the top, or you
   receive an "Internal Server Error" (most likely Perl compilation problem, it could be that
   you haven't correctly installed RRDs.pm. A quick way to check for this is to issue a
   'perl -c FlowTracker_Group.cgi' from a command line. If there is a RRDs.pm location problem
   the script will not compile.

   This problem can be tricky and I will try to make it easier in the next version. In the meantime
   the easiest way to fix this is:

      1. Do a 'perl -V' from a command line, and look at the @INC array
   
         @INC:
           /usr/lib/perl5/5.8.5/i386-linux-thread-multi
           /usr/lib/perl5/5.8.5
           /usr/lib/perl5/site_perl/5.8.5/i386-linux-thread-multi
           ( ... more )
   
      2. Identify the most likely directory into which to put a copy of RRDs.pm
   
         probably: /usr/lib/perl5/site_perl/5.8.5/i386-linux-thread-multi
   
      3. Copy RRDs.pm into that directory
   
         from: /usr/local/rrdtool-1.2.26/lib/perl/5.8.5/i386-linux-thread-multi/RRDs.pm
           to: /usr/lib/perl5/site_perl/5.8.5/i386-linux-thread-multi/RRDs.pm
   
      4. Copy the RRDs and RRDp 'auto' subdirectories and their contents into the Perl 'auto' subdirectory
   
         from: /usr/local/rrdtool-1.2.26/lib/perl/5.8.5/i386-linux-thread-multi/auto/RRDp
           to: /usr/lib/perl5/site_perl/5.8.5/i386-linux-thread-multi/auto/RRDp
   
         from: /usr/local/rrdtool-1.2.26/lib/perl/5.8.5/i386-linux-thread-multi/auto/RRDs
           to: /usr/lib/perl5/site_perl/5.8.5/i386-linux-thread-multi/auto/RRDs

   Note: the above can be accomplished using links instead of copying.



Joe



From: Mark Woodruff <n3hf@...>
To: Koaps <koaps@...>, rrd-users@...
Date: 11/04/2009 01:52 PM
Subject: Re: [rrd-users] RRD Newbee needs help with RRD Perl script





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@...>
To:
Mark Woodruff <n3hf@...>
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@...> wrote:

> From: Mark Woodruff <
n3hf@...>
> Subject: [rrd-users] RRD Newbee needs help with RRD Perl script
> To:
rrd-users@...
> 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@...
>
https://lists.oetiker.ch/cgi-bin/listinfo/rrd-users
>



_______________________________________________
rrd-users mailing list
rrd-users@...
https://lists.oetiker.ch/cgi-bin/listinfo/rrd-users



_______________________________________________
rrd-users mailing list
rrd-users@...
https://lists.oetiker.ch/cgi-bin/listinfo/rrd-users