[rrd-users] Perl Interface Problem

Koaps koaps at yahoo.com
Tue Mar 30 20:11:03 CEST 2010


When in doubt, use Data::Dumper.

print Dumper($answer);
$VAR1 = \undef;

RRDp isn't that friendly to use, I think RRDs is by far much superior.


Try out the demo for it, and if you are comfortable with perl references, you can check out the code I wrote using RRDs.

http://koaps.angrypacket.com/code/fst.pl.txt

The last function does all the rrd stuff, it also turns on HW so unless you want that, don't copy the code exactly.

-c



--- On Tue, 3/30/10, Lutzi <lutz at bickhardt.fr> wrote:

> From: Lutzi <lutz at bickhardt.fr>
> Subject: [rrd-users] Perl Interface Problem
> To: rrd-users at lists.oetiker.ch
> Date: Tuesday, March 30, 2010, 6:14 AM
> 
> Hi,
> have tried to find a solution in the web, the problems have
> been mentioned
> but do not seem to have been solved in a way I could
> understand.
> 
> Decription:
> Using the example right out of the documentation of the
> Perl interface I
> seem to have (de)refencing problems with Perl variables.
> Even the example
> does not work correctly!
> 
> Environment: rddtool 1.4.3, Ubuntu 9.10, eeePC1201
> 
> Hint: After installing rrdtool via apt-get the RRDp.pm
> module would not be
> found. The web at first (including the rrdtool docs) did
> not reveal where to
> find it. Then I stumbled upon a rrdlib-perl5, after
> installing the module
> was found.
> 
> Question: What do I do wrong or what is wrong?
> 
> Log (yes more than 10 lines but not too much; test1 and
> test2 identical but
> for comments at end):
> 
> Program test1:
> --------------
> #! /usr/bin/perl
> #test 1
> 
> use strict;
> use warnings;
> 
> use RRDp;
> 
>  RRDp::start "/usr/bin/rrdtool";
>  RRDp::cmd   qw(create demo.rrd --step 100 
>            
>    DS:in:GAUGE:100:U:U
>            
>    DS:in1:GAUGE:100:U:U
>            
>    RRA:AVERAGE:0.5:1:10);
> my $answer = RRDp::read;
> 
> print "Uninitialised?\n";
> print $$answer;
> print "Uninitialised!!!\n";   
>         
> 
> print "with constant: N:100:200\n";
> RRDp::cmd qw(update "demo.rrd" "N:100:200");
> my $RRDanswer=RRDp::read;
> #
> #my $a=100;
> #my $b=200;
> #print "with constant and variable: N:$a:$b\n";
> #RRDp::cmd qw(update "demo.rrd" "N:$a:$b");
> #$answer=RRDp::read;
> #
> my $string= "N:100:200";
> print "with variable: $string\n";
> RRDp::cmd qw(update "demo.rrd" $string);
> $answer=RRDp::read;
> 
> print "fin\n";
>  
> Log:
> --------------------------
> lutzi at ubuntu:~/rrd$ ./test1
> Uninitialised?
> Use of uninitialized value in print at ./test1 line 17.
> Uninitialised!!!
> with constant: N:100:200
> with variable: N:100:200
> ERROR: demo.rrd: expected timestamp not found in data
> source from $string at
> ./test1 line 33
> ==============
> Program test2:
> ----------------
> 
> #! /usr/bin/perl
> #test 2
> 
> use strict;
> use warnings;
> 
> use RRDp;
> 
>  RRDp::start "/usr/bin/rrdtool";
>  RRDp::cmd   qw(create demo.rrd --step 100 
>            
>    DS:in:GAUGE:100:U:U
>            
>    DS:in1:GAUGE:100:U:U
>            
>    RRA:AVERAGE:0.5:1:10);
> my $answer = RRDp::read;
> 
> print "Uninitialised?\n";
> print $$answer;
> print "Uninitialised!!!\n";   
>         
> 
> print "with constant: N:100:200\n";
> RRDp::cmd qw(update "demo.rrd" "N:100:200");
> my $RRDanswer=RRDp::read;
> #
> my $a=100;
> my $b=200;
> print "with constant and variable: N:$a:$b\n";
> RRDp::cmd qw(update "demo.rrd" "N:$a:$b");
> $answer=RRDp::read;
> #
> #my $string= "N:100:200";
> #print "with variable: $string\n";
> #RRDp::cmd qw(update "demo.rrd" $string);
> #$answer=RRDp::read;
> 
> print "fin\n";
> -------------
> Log:
> ------
> 
> lutzi at ubuntu:~/rrd$ ./test2
> Uninitialised?
> Use of uninitialized value in print at ./test2 line 17.
> Uninitialised!!!
> with constant: N:100:200
> with constant and variable: N:100:200
> ERROR: demo.rrd: conversion of '$a' to float not complete:
> tail '$a' at
> ./test2 line 28
> lutzi at ubuntu:~/rrd$
> 
> -- 
> View this message in context: http://n2.nabble.com/Perl-Interface-Problem-tp4824386p4824386.html
> Sent from the RRDtool Users Mailinglist mailing list
> archive at Nabble.com.
> 
> _______________________________________________
> 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