Hi
Ive installed cacti and have got it graphing using the built in scripts which are all working fine, Ive also got it graph network traffic on our cisco switches and routers alhtough I couldnt get it to graph the cpu utilization.
Problem Im having is that Im wanting to write various scripts that will return a value which I want to graph. As a test Im trying 2 scripts 1 in bash and the other in perl that return values but are not getting graphed.
1st script:
#!/usr/bin/perl
$input=`lynx -dump http://weather.noaa.gov/weather/current/EGLC.html |grep "Relative Humidity" |awk '\{print \$3 \}'|sed 's/%//g'`;
chomp $input;
print $input;
This runs fine from the cmd line as the user that apache runs as
bash-2.05a$ ./gethum.sh
74bash-2.05a$
And in the cacti log there are no errors for it:
12/10/2002 11:15 AM - CMD: /opt/rrdtool/bin/rrdtool update /export/www/cacti.telecom1.com//rra/relative_humidity.rrd --template relative_humidity N:U
Although I do see that its value is unknown, but not always as every now and then I do see a value in there but hasnt been graphed.
2nd script: (based on script from ultra)
#!/bin/bash
ret=`lynx -dump http://weather.noaa.gov/weather/current/$1.html | grep Temperature | sed 's/[a-z|A-Z|()]//g' | sed -e '2,3d' | awk '{ print $2 }'`
echo $ret
The exact same happens with this script
12/10/2002 11:20 AM - CMD: /opt/rrdtool/bin/rrdtool update /export/www/cacti.telecom1.com//rra/temperature.rrd --template temperature N:U
Ive set up the data input similar to the way that the system_procs has been set up and setup the graphs in a similar fashion
Any other info to help?
script or setup error?
Moderators: Developers, Moderators
found the problem
crap was going in after values
added this to script
#!/usr/local/bin/perl
#PATH=$PATH:/usr/bin:/usr/local/bin:/usr/sbin:/bin:/sbin
#export PATH
$ret = `lynx -dump http://weather.noaa.gov/weather/current/EGLC.html | grep Temperature | sed 's/[a-z|A-Z|()]//g' | sed -e '2,3d' | awk '\{ print \$2 \}'`;
#my @plop = split //,$ret;
#foreach $a (@plop) {
#print " -- " . ord($a) . " -- \n";
#}
$ret =~ s/ +//;
$ret =~s/\r*//g;
$ret =~s/\n*//g;
#print "---------------------------\n";
#my @plop = split //,$ret;
#foreach $a (@plop) {
#print " -- " . ord($a) . " -- \n";
#}
chomp $ret;
$ret--;
print $ret;
crap was going in after values
added this to script
#!/usr/local/bin/perl
#PATH=$PATH:/usr/bin:/usr/local/bin:/usr/sbin:/bin:/sbin
#export PATH
$ret = `lynx -dump http://weather.noaa.gov/weather/current/EGLC.html | grep Temperature | sed 's/[a-z|A-Z|()]//g' | sed -e '2,3d' | awk '\{ print \$2 \}'`;
#my @plop = split //,$ret;
#foreach $a (@plop) {
#print " -- " . ord($a) . " -- \n";
#}
$ret =~ s/ +//;
$ret =~s/\r*//g;
$ret =~s/\n*//g;
#print "---------------------------\n";
#my @plop = split //,$ret;
#foreach $a (@plop) {
#print " -- " . ord($a) . " -- \n";
#}
chomp $ret;
$ret--;
print $ret;
found another prob
Now it works fine from the cmd line but returns a value of -1 when run from cron???
Who is online
Users browsing this forum: No registered users and 0 guests