[rrd-users] Update error
Riccardo Burhenne
qbur at oce.nl
Wed Aug 25 09:30:52 MEST 2004
Hello all,
i'm having problems with updating my RRDs.
I get the following error:
Get_Backup_Data.pl: unable to update
/opt/iplanet/docs/fs3test/cgi-data/ms_wfps.rrd: conversion of '906932
' to float not complete: tail '
'
I just cannot trace the problem. Maybe you can help me.
I use the following code:
RRDs::create ($rrdname, "--start", $start, "--step", "86400",
"DS:size:GAUGE:172800:0:U",
"RRA:MAX:0.5:1:364");
# Error message if the database cannot be created
my $error = RRDs::error;
die "$0: unable to create $rrdname: $error\n" if $error;
sub get_data # Get the backup size, then update
{
my ($backup, $rrdname) = @_; # Get the parameters
# Save the old paths before untainting this variable
my $oldpath = $ENV{PATH};
# Empty the path (untaint it)
$ENV{PATH} = '';
# Get the backup size by using the unix commands grep and tail to
# find the backup entry we need. Then grab the size of the backup
out # of this by using split command.
my @entries = split(/ /, `/usr/bin/grep $backup $file | /usr/bin/tail
-1`);
# Restore the path
$ENV{PATH} = $oldpath;
my $update = $entries[-1]; # Grab the backup size
$update =~ s/\s*//; # Remove any spaces
# Update the database by adding the last value into the database
# Syntax: database name:time that the value is entered (N=now):value
RRDs::update ($rrdname, "N:$update");
# Error message if the database cannot be updated
my $error = RRDs::error;
die "$0: unable to update $rrdname: $error\n" if $error;
}
Thanks!
Riccardo Burhenne
--
Unsubscribe mailto:rrd-users-request at list.ee.ethz.ch?subject=unsubscribe
Help mailto:rrd-users-request at list.ee.ethz.ch?subject=help
Archive http://www.ee.ethz.ch/~slist/rrd-users
WebAdmin http://www.ee.ethz.ch/~slist/lsg2.cgi
More information about the rrd-users
mailing list