[rrd-users] Re: problems with "float" to rrd
mrugan
mrugan at softhome.net
Sun Feb 22 09:03:54 MET 2004
Thanks.
i was aware of the tabs ... but prior to rrdtool 1.0.46 i was using
1.0.40 (every time i upgrade i replace the perl-shared things with the
new ones ...) and my script line is like:
listed the processes in the system;
@check_out=("httpd","proftpd","named","sshd","mysqld");
foreach check_out ... get the number ...
....
here the error comes up.
>>
RRDs::update("$rrd/procs_$host.rrd","--template",
"procs:httpd:proftpd:named:sshd:mysqld","N:$procs:$processes{'httpd'}:$processes{'proftpd'}:$processes{'named'}:$processes{'sshd'}:$processes{'mysqld'}");
my $ERR=RRDs::error;
die "ERROR $ERR\n" if $ERR;
>>
[of course "-t" was used in 1.0.40 .. so no syntax error]
i doubt RRDs is changing over every new rrdtool comes up ... i've
searched for a version in the pod / package file ... no release-date to
clear this out ...
version 1.0.40 didn't complain about the syntax i was using with
ls .... but version 1.0.46 complains.
i am aware that i was wrong and i might have even corrected the syntax
from the first place if happend to be a RRDs:error .. but it
wasn't. so it's strictly related to rrdtool binary / shared module.
thanks again.
>> in my perl script it would complain about:
>> $procs=(`find /proc -maxdepth 1 -name '[1-9]*' -print | wc -l |
>> sed 's/\t +//' | sed 's/ *//'`);
>> which outputs with couple blank spaces.(if u try it u will see what i
>> am talking about) ... and the error was scalar to float ... something.
AvdB> You are having problems with the usual unix tools.
AvdB> First of all:
AvdB> "\t +" ... this matches a tab followed by one or more spaces. Why?
AvdB> Check if your sed really cannot handle this more efficiently:
AvdB> sed 's/[\t ]*//'
AvdB> (match tab or space, zero or more times)
AvdB> sed 's/\s*//'
AvdB> (match whitespace, zero or more times)
AvdB> Try to use a more efficient pipe:
AvdB> ls -d /proc/[1-9]* | wc -l
AvdB> in stead of
AvdB> find /proc -maxdepth 1 -name '[1-9]*' -print | wc -l
AvdB> OTOH I cannot reproduce your problem with both perl and bash:
AvdB> [long lines wrapped; commands are all on one line]
AvdB> bash$ find /proc -maxdepth 1 -name '[1-9]*' -print | wc -l |
AvdB> sed 's/\t +//' | sed 's/ *//'|od -tx1
AvdB> 0000000 32 39 35 0a
AvdB> 0000004
AvdB> bash$ perl -e '$procs=(`find /proc -maxdepth 1 -name "[1-9]*" -print |
AvdB> wc -l | sed "s/\t +//" | sed "s/ *//"`);' -e 'print $procs' | od -tx1
AvdB> 0000000 32 39 32 0a
AvdB> 0000004
AvdB> cheers,
AvdB> Alex
--
Best regards,
mrugan mailto:mrugan at softhome.net
--
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