[mrtg] Problems graphing values from a Perl script

darek darek at nyi.net
Wed Jun 19 20:27:17 MEST 2002


Hey guys, I have a perl script that returns the capacity of a UPS' 
battery in minutes as such:

# /usr/local/bin/mrtg-battremaining.pl upsA
15 #capacity in min
15 #capacity in min
 4 days, 1:44:32.76 #uptime
A #Name

The permissions:
-rwxr-x---  1 root  wheel  794 Apr 13 01:36 
/usr/local/bin/mrtg-battremaining.pl

Inside MRTG configs:
Target[A.BattRem]: `/usr/local/bin/mrtg-battremaining.pl upsA`
... etc ...

Crontab (as root) runs:
 -rwxr-x---  1 root  wheel  2847 Jun 18 16:54 
/usr/local/bin/mrtg-cron.sh (tried -r-x------ too)

which issues mrtg and indexmaker commands on the 12 UPSes that I monitor:

/usr/local/bin/mrtg /usr/local/etc/mrtg/A.conf
...
/usr/local/bin/indexmaker --output=/usr/local/www/data/mrtg/A/index.html 
--show=day --columns 1 --title "Stats for UPS [A]" 
/usr/local/etc/mrtg/A.conf
...etc...

Now, when ran by crontab, I do not get any values for the battery life. 
But when I issue /usr/local/bin/mrtg-cron.sh manually, I get the correct 
values for all the UPSes. So I end up with a graph empty for the most 
part, with peaks when I ran the script manually. Anyone have an idea why 
this is?

Additionally, this battery Perl script has been pretty unreliable in 
graphing, even though every time it returns the correct info. Is there 
anythihing undocumented that I should know about external reporting 
scripts besides the fact they have to return 4 lines, last 2 being 
uptime and hostname?

--
Unsubscribe mailto:mrtg-request at list.ee.ethz.ch?subject=unsubscribe
Archive     http://www.ee.ethz.ch/~slist/mrtg
FAQ         http://faq.mrtg.org    Homepage     http://www.mrtg.org
WebAdmin    http://www.ee.ethz.ch/~slist/lsg2.cgi



More information about the mrtg mailing list