[mrtg] Re: APC Powernet mib and TimeTicks

David Gabler dgabler at americomusa.net
Tue Jun 6 17:42:34 MEST 2000


Write a script that takes the time and returns the data.


e.g.

#!/usr/bin/perl
#
# Written by David Gabler.
# dgabler at americomusa.net
# No warranty is given whatsoever.
# This program is not fully tested.
#  DO NOT use it for mission critical
#  applications or where human life
#  is at stake.
# Enjoy!
# (Target Platform: UNIX)

$data = `programThatGetsSNMPData 1.3.6.1.4.1.318.1.1.1.2.2.3`;

($day, $hour, $minute, $second, $milliSecond) = split/\s+|\:|\./, $data;

#Get rid of the d in days
chop($day);

#Do our calculations.
$minDay = $day * 60 * 24;
$minHour = $hour * 60;
$minSec = $second / 60;
$minMilli = ( $milliSecond / 1000 ) / 60;

#Get the sum.
$totalMin = $minDay + $minHour + $minute + $minSec + $minMilli;

#Now lets get rid of the decimals!
($totalMin, $totalSec) = split/\./, $totalMin;

print $totalMin, "\n";
print "0\n";
print "0\n";
print "0\n";

--End Code--


-----Original Message-----
From: mrtg-bounce at list.ee.ethz.ch [mailto:mrtg-bounce at list.ee.ethz.ch]On
Behalf Of Brian Walters
Sent: Monday, June 05, 2000 5:22 PM
To: mrtg at list.ee.ethz.ch
Subject: [mrtg] APC Powernet mib and TimeTicks


I'm trying to use Mrtg to monitor my APC UPS's with the snmp management
cards. Everything is working really well thanks to the examples from so many
others who have already done this.

I've come across a problem that I just can't solve. The
upsAdvBatteryRunTimeRemaining(1.3.6.1.4.1.318.1.1.1.2.2.3) OID is supposed
to return the amount of time you have in your batteries based on current
system load and results from load tests. The problem is the format in which
the value is returned. The powernet mib lists it as TimeTicks, basically it
looks like this
0d 3:27:00.00
So what's happening when I run this through mrtg 2.8.9 is that it picks up
the 3 and dumps the rest.

Can anyone suggest a way to convert the value above into just minutes, then
a much smoother curve could be plotted. It's pretty safe to leave out any
processing of the 0d as I certainly don't plan to add enough extra batteries
to get there.

TIA,
Brian


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



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



More information about the mrtg mailing list