[rrd-users] Perl Interface Problem

Lutzi lutz at bickhardt.fr
Tue Mar 30 15:14:15 CEST 2010


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.



More information about the rrd-users mailing list