[mrtg] Re: UPS Runtime Remaining

Jerry Heidtke jheidtke at fmlh.edu
Wed Jan 15 15:20:54 MET 2003


Here's what I use with APC UPS to graph time remaining.

This is the perl script. It's a slightly modified version of the script
included in the contrib directory with mrtg. The main modification is that
it accepts the target IP address and community name as command line
parameters.

It uses snmpget.exe from the net-snmp package. It could rather easily be
rewritten to use the SNMP_util perl library included with mrtg. This is left
for an exercise for the reader...

Jerry

--------------------------------------------
#!d:\perl\bin\perl
#
# Script to convert runtime MIB variable for UPS into minutes
# eg. perl upsdata01.pl host-addr snmp-community
$x=$ARGV[0];
@y=split(/@/,$x);
$a=`d:/usr/bin/snmpget $y[1] $y[0] .1.3.6.1.4.1.318.1.1.1.2.2.3.0`;
chomp $a;
@b=split(/ /,$a);
@c=split(/:/,$b[4]);
@d=split(/ /,`d:/usr/bin/snmpget $y[1] $y[0]
.1.3.6.1.4.1.318.1.1.1.4.2.3.0`);
chomp $d;
print eval($c[0] * 60 + $c[1]),"\n";
print $d[3];
--------------------------------------------

Here is a sample mrtg config to call it.

--------------------------------------------
MaxBytes[_]: 600
Options[_]: growright, gauge, nopercent, noo, integer
WithPeak[_]: wmy
Unscaled[_]:
YLegend[_]: UPS Run Time
ShortLegend[_]: minutes
LegendI[_]: UPS Run Time Remaining:
LegendO[_]:
Legend1[_]: UPS Run Time
Legend2[_]:
Legend3[_]: Max. UPS Run Time
Legend4[_]:

Target[UPSTime]: `d:\perl\bin\wperl d:\mrtgcfg\cfg\template\upsdata01.pl
xxx.xxx.xxx.xxx community`
Title[UPSTime]:  UPS Run Time Remaining for
PageTop[UPSTime]:  UPS Run Time Remaining for
--------------------------------------------


-----Original Message-----
From: Leonard Miller [mailto:Leonard_Miller at udlp.com] 
Sent: Wednesday, January 15, 2003 7:37 AM
To: mrtg at list.ee.ethz.ch
Subject: [mrtg] UPS Runtime Remaining



Me again with another UPS question.  So far I have been able
to get everything I need from my UPSssssss, temperature, status, capacity
and about 8 other values I needed, except runtime remaining.  I assumed it
would return a value like this "546000" and I had the config file setup to
calculate the result based on that. But it doesn't.  It returns the actual
time remaining, HH:MM:SS.

Is there a way to get it to read and graph the returned value? Or will I
have to look to an external perl script to do this?  

Thanks
Leonard

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


Confidentiality Notice: This e-mail message, including any attachments, is 
for the sole use of the intended recipient(s) and may contain confidential 
and privileged information.  Any unauthorized review, use, disclosure or 
distribution is prohibited.  If you are not the intended recipient, please 
contact the sender by reply e-mail and destroy all copies of the original 
message.


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