[mrtg] Re: monitoring battery time remaining on APC ups?

Pete Templin templin at urdirect.net
Fri Aug 25 21:35:46 MEST 2000



On Fri, 25 Aug 2000, Jim Jones, Jr. wrote:

> Below is an example of what I am trying...
> When I walk that OID, it returns the number of 1/100s of seconds remaining
> in battery time... (eg, 318000, or 53 minutes)
> When I run this MRTG config, i get an empty graph.

See the sample config and script below.  You'll need to convert the return
value of the runtime OID into an integer value of minutes (or seconds if
you prefer).  See targets 9 & 10 (10 is time on battery - you'll probably
know this anyway, but it's a great visual reference to see how linear
battery discharge is).  See http://noc.urdirect.net/mrtg/ups for the
output. 

HTH,

Pete

--
Peter J. Templin, Jr., CCNA, CCDA
VP Networking

On-Line Internet Services - URDirect.net
A division of Global On-Line Computers
5606 Randolph Blvd		templin at urdirect.net
San Antonio, TX 78233		(210)692-9911


Workdir: /usr/local/mrtg/ups
Icondir: /mrtg/icons
Interval: 5
Refresh: 300
WriteExpires: yes

#---------------------------------------------------------------
Target[ups1-noc2.1]:1.3.6.1.4.1.318.1.1.1.3.2.1.0&1.3.6.1.4.1.318.1.1.1.4.2.1.0:
MaxBytes[ups1-noc2.1]: 250
Title[ups1-noc2.1]: UPS1 At NOC2: Current AC Line Voltage
PageTop[ups1-noc2.1]: <H1>Current Line Voltage for NOC2 UPS1</H1>
WithPeak[ups1-noc2.1]: wmy
Options[ups1-noc2.1]:absolute, gauge, nopercent
Ylegend[ups1-noc2.1]:Voltage
LegendI[ups1-noc2.1]:Input Voltage
LegendO[ups1-noc2.1]:Output Voltage
#---------------------------------------------------------------
Target[ups1-noc2.2]: 1.3.6.1.4.1.318.1.1.1.3.2.3.0&1.3.6.1.4.1.318.1.1.1.3.2.2.0:
MaxBytes[ups1-noc2.2]: 250
Title[ups1-noc2.2]: UPS1 At NOC2: Min and Max AC Line Voltage
PageTop[ups1-noc2.2]: <H1>Min and Max Line Voltage for NOC2 UPS1</H1>
WithPeak[ups1-noc2.2]: wmy
Options[ups1-noc2.2]:absolute, gauge, nopercent
Ylegend[ups1-noc2.2]:Voltage
LegendI[ups1-noc2.2]:Min Voltage
LegendO[ups1-noc2.2]:Max Voltage
#---------------------------------------------------------------
Target[ups1-noc2.3]: 1.3.6.1.4.1.318.1.1.1.3.2.5.0&1.3.6.1.4.1.318.1.1.1.3.2.5.0:
MaxBytes[ups1-noc2.3]: 32
Title[ups1-noc2.3]: UPS1 At NOC2: Last Reason On-Battery
PageTop[ups1-noc2.3]: <H1>Last Reason On-Battery for NOC2 UPS1</H1>
	See the <a href="reasons.txt">reasons</a> for on-battery.
WithPeak[ups1-noc2.3]: wmy
Options[ups1-noc2.3]:absolute, gauge
Ylegend[ups1-noc2.3]:Cause
LegendI[ups1-noc2.3]:Cause
LegendO[ups1-noc2.3]:Cause
#---------------------------------------------------------------
Target[ups1-noc2.4]: 1.3.6.1.4.1.318.1.1.1.2.2.1.0&1.3.6.1.4.1.318.1.1.1.2.2.1.0:
MaxBytes[ups1-noc2.4]: 100
Title[ups1-noc2.4]: UPS1 at NOC2: Battery Capacity
PageTop[ups1-noc2.4]: <H1>Battery Capacity for NOC2 UPS1</H1>
WithPeak[ups1-noc2.4]: wmy
Options[ups1-noc2.4]:absolute, gauge
Ylegend[ups1-noc2.4]:Capacity
LegendI[ups1-noc2.4]:Capacity
LegendO[ups1-noc2.4]:Capacity
#---------------------------------------------------------------
Target[ups1-noc2.5]: 1.3.6.1.4.1.318.1.1.1.2.2.2.0&1.3.6.1.4.1.318.1.1.1.2.2.2.0:
MaxBytes[ups1-noc2.5]: 100
Title[ups1-noc2.5]: UPS1 at NOC2: Battery Temperature
PageTop[ups1-noc2.5]: <H1>Battery Temperature for NOC2 UPS1</H1>
WithPeak[ups1-noc2.5]: wmy
Options[ups1-noc2.5]:absolute, gauge
Ylegend[ups1-noc2.5]:Temperature
LegendI[ups1-noc2.5]:Temperature
LegendO[ups1-noc2.5]:Temperature
#---------------------------------------------------------------
Target[ups1-noc2.6]: 1.3.6.1.4.1.318.1.1.1.3.2.4.0&1.3.6.1.4.1.318.1.1.1.4.2.2.0:
MaxBytes[ups1-noc2.6]: 250
Title[ups1-noc2.6]: UPS1 At NOC2: AC Frequency
PageTop[ups1-noc2.6]: <H1>In and Out Frequency for NOC2 UPS1</H1>
WithPeak[ups1-noc2.6]: wmy
Options[ups1-noc2.6]:absolute, gauge, nopercent
Ylegend[ups1-noc2.6]:Frequency
LegendI[ups1-noc2.6]:Input Frequency
LegendO[ups1-noc2.6]:Output Frequency
#---------------------------------------------------------------
Target[ups1-noc2.7]: 1.3.6.1.4.1.318.1.1.1.4.2.4.0&1.3.6.1.4.1.318.1.1.1.4.2.4.0:
MaxBytes[ups1-noc2.7]: 250
Title[ups1-noc2.7]: UPS1 At NOC2: Output Current
PageTop[ups1-noc2.7]: <H1>Output Current for NOC2 UPS1</H1>
WithPeak[ups1-noc2.7]: wmy
Options[ups1-noc2.7]:absolute, gauge, nopercent
Ylegend[ups1-noc2.7]:Current
LegendI[ups1-noc2.7]:Current
LegendO[ups1-noc2.7]:Current
#---------------------------------------------------------------
Target[ups1-noc2.8]: 1.3.6.1.4.1.318.1.1.1.4.2.3.0&1.3.6.1.4.1.318.1.1.1.4.2.3.0:
MaxBytes[ups1-noc2.8]: 10000
Title[ups1-noc2.8]: UPS1 at NOC2: Load
PageTop[ups1-noc2.8]: <H1>Load for NOC2 UPS1</H1>
WithPeak[ups1-noc2.8]: wmy
Options[ups1-noc2.8]:gauge, nopercent
Ylegend[ups1-noc2.8]:Load
LegendI[ups1-noc2.8]:Load
LegendO[ups1-noc2.8]:Load
#---------------------------------------------------------------
Target[ups1-noc2.9]: `/usr/local/mrtg/ups/getruntime UPS SNMPCOMM .1.3.6.1.4.1.318.1.1.1.2.2.3.0`
MaxBytes[ups1-noc2.9]: 10000
Title[ups1-noc2.9]: UPS1 at NOC2: Runtime Available
PageTop[ups1-noc2.9]: <H1>Runtime Available for NOC2 UPS1</H1>
WithPeak[ups1-noc2.9]: wmy
Options[ups1-noc2.9]:gauge, nopercent
Ylegend[ups1-noc2.9]:Runtime
LegendI[ups1-noc2.9]:Runtime
LegendO[ups1-noc2.9]:Runtime
#---------------------------------------------------------------
Target[ups1-noc2.10]: `/usr/local/mrtg/ups/getruntime UPS SNMPCOMM .1.3.6.1.4.1.318.1.1.1.2.1.2.0`
MaxBytes[ups1-noc2.10]: 10000
Title[ups1-noc2.10]: UPS1 at NOC2: Time on Battery
PageTop[ups1-noc2.10]: <H1>Time on Battery for NOC2 UPS1</H1>
WithPeak[ups1-noc2.10]: wmy
Options[ups1-noc2.10]:gauge, nopercent
Ylegend[ups1-noc2.10]:Time
LegendI[ups1-noc2.10]:Time
LegendO[ups1-noc2.10]:Time
#---------------------------------------------------------------


#!/usr/bin/perl
#
#

$host = shift;
$community = shift;
$oid = shift;

open(GET,"snmpget $host $community $oid|");
while(<GET>) {
    $data = $_;
}

$data =~ s/\s$//;
$data =~ s/.*\s//;

@timeinfo = split/\s+|\:|\./, $data;

if (@timeinfo) {
    $milliSecond = pop(@timeinfo);
}

if (@timeinfo) {
    $second = pop(@timeinfo);
}

if (@timeinfo) {
    $minute = pop(@timeinfo);
}

if (@timeinfo) {
    $hour = pop(@timeinfo);
}

if (@timeinfo) {
    $day = pop(@timeinfo);
}


#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";



Pete

--
Peter J. Templin, Jr., CCNA, CCDA
VP Networking

On-Line Internet Services - URDirect.net
A division of Global On-Line Computers
5606 Randolph Blvd		templin at urdirect.net
San Antonio, TX 78233		(210)692-9911


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