[mrtg] Re: UPS Battery Time Question

Herold Heiko Heiko.Herold at previnet.it
Tue Jan 21 14:06:20 MET 2003


If you are using upsAdvBatteryRunTimeRemaining you probably need to convert
the data with an external command, unless I'm not up to date with current
mrtg.
Personally I invoke a perl script like this (watch the wrap)

Target[apc-symmetra.upsAdvBatteryRunTimeRemaining]:
`/home/mrtg/run/convtimeticks.pl apchostname password -m ~/Mibs/powernet.mib
upsAdvBatteryRunTimeRemaining.0`

which in turn runs a ucd-snmp tool like this

snmpget -Oq -Ot -m ~/Mibs/powernet.mib apchostname password
upsAdvBatteryRunTimeRemaining.0

The key is the -Ot, which means:  "Output timeticks values as raw numbers."
snmpget would print something like
enterprises.apc.products.hardware.ups.upsBattery.upsAdvBattery.upsAdvBattery
RunTimeRemaining.0 84000

while convtimeticks.pl would print the 4-line output mrtg expects:
840
0

apc

The script is like this:

#!/usr/bin/perl 
#invoke like $0 host <snmpcommand-args> community sysUpTime.0
$host = $ARGV[0] || " ";
$command="snmpget -Oq -Ot ".join " ", at ARGV;
$in=`$command`;
$_=((split /\s+/,$in)[1] or 0);
$_ /= 100;
print	int($_),"\n","0\n"," \n","$host\n",;

Bye
Heiko

-- 
-- PREVINET S.p.A.            Heiko.Herold at previnet.it
-- Via Ferretto, 1            ph  x39-041-5907073
-- I-31021 Mogliano V.to (TV) fax x39-041-5907472
-- ITALY

> -----Original Message-----
> From: Will Krause [mailto:will at krauses.net]
> Sent: Monday, January 20, 2003 10:29 PM
> To: 'mrtg at list.ee.ethz.ch'
> Subject: UPS Battery Time Question
> 
> 
> I'm monitoring a number of things on an APC Symmetra UPS system.  I am
> trying to get "Bettery Time Remaining" from it and MRTG tells 
> me that what
> it's getting back is not a number (it's supposed to be 
> timetics) but my MIB
> browser handles it OK.   I have the options set as 'gauge, nopercent,
> unknaszero'.
>  Is there something I am missing?
>  
> Will
> 
> 
> --
> 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