[mrtg] Re: Problems graphing values from a Perl script

Ulf Viney ulf at vineyfamily.com
Wed Jun 19 22:06:15 MEST 2002


Why not just let mrtg's cron grab the values by having the mrtg config
file point to the location of your perl script?

For eg mine looks as follows...

Target[temp]: `/usr/local/mrtg-2/run/weather.pl`
Directory[temp]: temp
Options[temp]: nopercent,growright,gauge,noinfo
Unscaled[temp]: wmy
Title[temp]: Temperature
WithPeak[temp]: ymwd
PageTop[temp]: <h1>Ottawa Weather (Temperature)</h1>
MaxBytes[temp]: 50
YLegend[temp]: Temperature
ShortLegend[temp]: Celcius
LegendI[temp]: &nbsp;Temperature:
LegendO[temp]:
Legend1[temp]: Temperature, in C
Colours[temp]: RED#C00000,BLUE#0000ff,GRAY#AAAAAA,VIOLET#ff00ff

Where weather.pl is the location of the perl script that gets my weather
data.

Ulf Viney 
Systems
Blueair Networks Inc.
Ottawa, ON Canada
uviney at blueairnetworks.com

-----Original Message-----
From: mrtg-bounce at list.ee.ethz.ch [mailto:mrtg-bounce at list.ee.ethz.ch]
On Behalf Of darek
Sent: Wednesday, June 19, 2002 2:27 PM
To: mrtg at list.ee.ethz.ch
Subject: [mrtg] Problems graphing values from a Perl script



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

--
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