Hi All,
I have perl script which is used for updating the rrd file, but i got the following error
ERROR: expected 1 data source readings (got 6) from 1327287766:82:0:0:0:0:0
Check my script:
# Users By ID
my $rrddata = "/path to store rrd file/";
`/usr/bin/curl --silent
http://example.com -o /tmp/userscount.txt`;
open(CURL, "/tmp/userscount.txt") || die "Unable to open /tmp/userscount.txt\n";
$ts = time();
while(my $line = <CURL>){
if ($line =~ m/^[^\d]{20}/){
next;
}
print $line;
my ($example_id,$count,$name) = split(":",$line, 3);
my $rrdfile = sprintf("%s%s.rrd",$rrddata, $example_id);
# print $rrdfile . "\n";
if (!-f $rrdfile){
print "=> creating file $rrdfile\n";
my $command = "/usr/bin/rrdtool create $rrdfile --step 300 --start now
DS:user_count:GAUGE:620:0:5000
RRA:MIN:0:360:576
RRA:MIN:0:30:576
RRA:MIN:0:7:576
RRA:AVERAGE:0.5:144:1460
RRA:AVERAGE:0.5:24:732
RRA:AVERAGE:0.5:6:672
RRA:AVERAGE:0.5:1:576
RRA:MIN:0:360:576";
$command =~ s/\n//g;
system($command);
}
my $command = sprintf("/usr/bin/rrdtool update %s %d:%d:%d:%d:%d:%d:%d", $rrdfile, $ts, $count);
system ($command);
#print $command . "\n";
}
close(CURL);
# } @ for
Please any one help me on this.
Thanks,
Hariharan V.