[rrd-developers] RRDs:create($string); strange eror when using a string variable but not when using the content of the variable.

AllSort ofQuestions allsortofquestions at yahoo.com
Thu Jan 7 06:57:54 CET 2010


Hi everybody

I am sorry if I am posting on the wrong list, I am writing a perl script (beginner level) and I believe that this is the right place to ask my question.
If I am wrong please let me know and I will ask on the other lists.

Here is the code I am using


use RRDs;
@DataSources=('input','output','memory','CPU');
for ($i=0; $i<$#DataSources+1; $i=$i+1)
 {
    $DS=($DS.'"DS:'.$DataSources[$i].':GAUGE:6300:0:100000",');
 }
$string='"databse.rrd",'.$DS.'"RRA:AVERAGE:0.5:120:360"';
RRDs::create ($string);
my $error = RRDs::error;
warn "ERROR: $error\n" if $error;

In the end, before creating the database, $string  has the value: "database.rrd","DS:input:GAUGE:6300:0:100000","DS:output:GAUGE:6300:0:100000","DS:memory:GAUGE:6300:0:100000","DS:CPU:GAUGE:6300:0:100000","RRA:AVERAGE:0.5:120:360"
and I receive this error: "ERROR: you must define at least one Round Robin Archive"

If I use


use RRDs;
RRDs::create ("databse.rrd","DS:input:GAUGE:6300:0:100000","DS:output:GAUGE:6300:0:100000","DS:memory:GAUGE:6300:0:100000","DS:CPU:GAUGE:6300:0:100000","RRA:AVERAGE:0.5:120:360");
my $error = RRDs::error;
warn "ERROR: $error\n" if $error;

I just used the string instead of creating it like in the first example and now I am not receiving any errors and the file is created.

What am I doing wrong??

Thank you 
PF


      __________________________________________________________________
Ask a question on any topic and get answers from real people. Go to Yahoo! Answers and share what you know at http://ca.answers.yahoo.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.oetiker.ch/pipermail/rrd-developers/attachments/20100106/a268d37b/attachment.htm 


More information about the rrd-developers mailing list