Board index

Cheshire Cat Software

Steve Shipway's Discussion Groups
Locations of visitors to this page
It is currently Wed 08 Sep, 2010 11:48 pm

All times are UTC - 5 hours




Post new topic Reply to topic  [ 8 posts ] 
Author Message
 Post subject: host template for Liebert UPS
PostPosted: Thu 21 Aug, 2008 6:41 am 
Offline
Silver User

Joined: Fri 03 Oct, 2003 11:47 am
Posts: 28
Location: Austin, TX
(notes added by Steve S)

This Host template also adds extended directives for the Big Brother agent - if you don't use Big Brother you can safely ignore these as the template will still work correctly.

It requires you to have the MIBs ups.mib, LIEBERT_GP_REG.MIB and LIEBERT_GP_POWER.MIB installed in /usr/share/snmp/mibs for it to work correctly.

Code:
$head_lines .= <<ECHO
#.....................................................................
ECHO
;

my $target_name=$router_name.".min";
my ( $maxmins, $maxsec, $absmin, $yellowvolts, $redvolts, $absvolts, @basis );
snmpMIB_to_OID("/usr/share/snmp/mibs/ups.mib");
snmpMIB_to_OID("/usr/share/snmp/mibs/LIEBERT_GP_REG.MIB");
snmpMIB_to_OID("/usr/share/snmp/mibs/LIEBERT_GP_POWER.MIB");
my ($model) = snmpget($router_connect,"upsIdentModel.0");
my ($version) = snmpget($router_connect,"upsIdentAgentSoftwareVersion.0");

push @basis, 'upsEstimatedMinutesRemaining.0';
push @basis, 'upsConfigInputVoltage.0';
push @basis, 'upsConfigOutputVoltage.0';
push @basis, 'upsInputNumLines.0';
push @basis, 'upsOutputNumLines.0';
push @basis, 'upsConfigOutputFreq.0';
push @basis, 'upsConfigOutputVA.0' if $model !~ /Nfinity/;
#push @basis, 'lgpPwrLineMeasurementVoltsLL.3.1' if $model !~ /Nfinity/ and $version !~ /^(1|2.0)/;
my ($remain,$volts,$ovolts,$ilines,$olines,$freq,$va)=
   snmpget($router_connect,@basis);
my ($two,$two6k);
($two) = snmpget($router_connect,"lgpPwrLineMeasurementVoltsLL.3.1") if $version !~ /^[12]/;
($two6k) = snmpget($router_connect,"lgpPwrLineMeasurementVolts.3.1") if $version !~ /^1/;
if ($model =~ /Nfinity/ and not defined($va)) {
   $va =20000;
}
if (defined($two)) {
   $volts = $two;
   $ovolts =$two;
   $ilines = 1;
   $olines = 1;
} elsif (defined($two6k)) {
   $volts = $two6k;
   $ovolts = $two6k;
   $ilines = 1;
   $olines = 1;
} elsif ($model =~ /GXT2-6000RT208/) {
   $volts=208;
   $ovolts=120;
   $ilines = 1;
   $olines = 1;
}
if ($remain) {
   $maxmins = int($remain / .9);
   $maxsec = $maxmins * 60;
   $absmin = $remain * 10;
}
else {
   $maxmins= 510;
   $maxsec= $maxmins * 60;
   $absmin = 1000;
}
if ($volts) {
   if ($volts != $ovolts) {
      $yellowvolts = int($volts/1.10) . ":" . int($volts/.9)
         . ":" . int($ovolts/1.10) . ":" . int($ovolts/.9);
      $redvolts = int($volts/1.2) . ":" . int($volts/.8)
         . ":" . int($ovolts/1.20) . ":" . int($ovolts/.8);
      $absvolts = $volts*2;
   }
   else {
      $yellowvolts = int($volts/1.10) . ":" . int($volts/.9);
      $redvolts = int($volts/1.2) . ":" . int($volts/.8);
      $absvolts = $volts*2;
   }
}
else {
   $volts=120;
   $yellowvolts = "114:126";
   $redvolts = "109:135";
   $absvolts= 240;
}
   
$target_lines .= <<MINUTES
Target[$target_name]: upsEstimatedMinutesRemaining.0&upsEstimatedMinutesRemaining.0:$router_connect
bb*host[$target_name]: $router_name
bb*svc[$target_name]: upsmin
bb*yellow[$target_name]: 60:$absmin
bb*red[$target_name]: 30:$absmin
routers.cgi*Options[$target_name]: nototal
Directory[$target_name]: $directory_name
MaxBytes[$target_name]: $maxmins
AbsMax[$target_name]: $absmin
RouterUptime[$target_name]: $router_connect
Options[$target_name]: Gauge noi
Title[$target_name]: UPS Estimated Run Time
YLegend[$target_name]: minutes
ShortLegend[$target_name]: m
LegendI[$target_name]: remaining

PageTop[$target_name]: <H1>UPS Estimated Run-Time</H1>
   <TABLE>
   <TR><TD>System:</TD><TD>$sysname  </TD></TR>
   <TR><TD>Location:</TD><TD>$syslocation </TD></TR>
   </TABLE>
MINUTES
;
$target_name=$router_name.".sec";
$target_lines .= <<SECONDS
#.....................................................................
Target[$target_name]: upsSecondsOnBattery.0&upsSecondsOnBattery.0:$router_connect
bb*host[$target_name]: $router_name
bb*svc[$target_name]: upsrun
bb*yellow[$target_name]: 300
bb*red[$target_name]: 600
routers.cgi*Options[$target_name]: nototal
Directory[$target_name]: $directory_name
MaxBytes[$target_name]: $maxsec
RouterUptime[$target_name]: $router_connect
Options[$target_name]: Gauge noi
Title[$target_name]: UPS Actual Run Time
YLegend[$target_name]: seconds
ShortLegend[$target_name]: s
LegendI[$target_name]: run time

PageTop[$target_name]: <H1>UPS Actual Time on Battery</H1>
   <TABLE>
   <TR><TD>System:</TD><TD>$sysname  </TD></TR>
   <TR><TD>Location:</TD><TD>$syslocation </TD></TR>
   </TABLE>
SECONDS
;
my $i = 0;
while ( ++$i le $ilines) {
   $target_name=$router_name.".volt";
   my $phase = '';    
   $target_name=$router_name.".volt.".$i if $ilines > 1;
   $phase = "Phase # $i" if $ilines > 1;
my $custtarg = <<STANDARD
Target[$target_name]: upsInputVoltage.$i&upsOutputVoltage.$i:$router_connect
STANDARD
;
if (defined($two) ) {
$custtarg =<<NEWMIB
Target[$target_name]: lgpPwrLineMeasurementVoltsLL.1.1&lgpPwrLineMeasurementVoltsLL.3.1:$router_connect
NEWMIB
;
} elsif (defined($two6k)) {
$custtarg =<<6KMIB
Target[$target_name]: lgpPwrLineMeasurementVolts.1.1&lgpPwrLineMeasurementVolts.3.1:$router_connect
6KMIB
;
}

$target_lines .= <<VOLTAGE
#.....................................................................
$custtarg
bb*host[$target_name]: $router_name
bb*svc[$target_name]: voltage
bb*yellow[$target_name]: $yellowvolts
bb*red[$target_name]: $redvolts
routers.cgi*Options[$target_name]: nototal
Directory[$target_name]: $directory_name
MaxBytes[$target_name]: $volts
AbsMax[$target_name]: $absvolts
RouterUptime[$target_name]: $router_connect
Options[$target_name]: Gauge
Title[$target_name]: UPS Voltages $phase
YLegend[$target_name]: volts
ShortLegend[$target_name]: vac
LegendI[$target_name]: input
LegendO[$target_name]: output

PageTop[$target_name]: <H1>UPS Voltages $phase </H1>
   <TABLE>
   <TR><TD>System:</TD><TD>$sysname  </TD></TR>
   <TR><TD>Location:</TD><TD>$syslocation </TD></TR>
   </TABLE>
VOLTAGE
;
}
($volts) = snmpget($router_connect,'upsBatteryVoltage.0');
if ($volts) {
   $yellowvolts = int($volts/10.5) . ":" . int($volts/9.5);
   $redvolts = int($volts/11) . ":" . int($volts/9);
   $absvolts = int($volts/7);
   $volts = int($volts/10);
}
else {
   $volts=55;
   $yellowvolts = "52:57";
   $redvolts = "48:60";
   $absvolts= 80;
}
$target_name=$router_name.".batt";
$target_lines .= <<BATTERY
#.....................................................................
Target[$target_name]: upsBatteryVoltage.0&upsBatteryVoltage.0:$router_connect / 10
bb*host[$target_name]: $router_name
bb*svc[$target_name]: voltage
bb*red[$target_name]: $redvolts
bb*yellow[$target_name]: $yellowvolts
routers.cgi*Options[$target_name]: nototal
Directory[$target_name]: $directory_name
MaxBytes[$target_name]: $volts
AbsMax[$target_name]: $absvolts
RouterUptime[$target_name]: $router_connect
Options[$target_name]: Gauge noi
Title[$target_name]: UPS Battery Voltage
YLegend[$target_name]: volts
ShortLegend[$target_name]: vdc
LegendI[$target_name]: battery level

PageTop[$target_name]: <H1>UPS Battery Voltage</H1>
   <TABLE>
   <TR><TD>System:</TD><TD>$sysname  </TD></TR>
   <TR><TD>Location:</TD><TD>$syslocation </TD></TR>
   </TABLE>
BATTERY
;
if (($version !~ /^(1|2.0)/) and ($model !~ /Npower/))  {
   $target_name=$router_name.".current";
   my $redcurrent = int($va/1.1);
   my $yelcurrent = int($va/1.6);

$target_lines .= <<CURRENT
#.....................................................................
Target[$target_name]: lgpPwrMeasurementPointApparentPower.3&lgpPwrMeasurementPointApparentPower.3:$router_connect
bb*host[$target_name]: $router_name
bb*svc[$target_name]: current
bb*yellow[$target_name]: $yelcurrent
bb*red[$target_name]: $redcurrent
routers.cgi*Options[$target_name]: nototal
Directory[$target_name]: $directory_name
MaxBytes[$target_name]: $va
RouterUptime[$target_name]: $router_connect
Options[$target_name]: Gauge noi
Title[$target_name]: UPS Current
YLegend[$target_name]: va
ShortLegend[$target_name]: va
LegendI[$target_name]: input
LegendO[$target_name]: output

PageTop[$target_name]: <H1>UPS Current </H1>
   <TABLE>
   <TR><TD>System:</TD><TD>$sysname  </TD></TR>
   <TR><TD>Location:</TD><TD>$syslocation </TD></TR>
   </TABLE>
CURRENT
;
} else {
$i = 0;
while (++$i le $ilines) {
   my $addgraph;
   $target_name=$router_name.".current";
   my $redcurrent = int($va/1.1);
   my $yelcurrent = int($va/1.6);
   my $multgraph = $target_name;
   my $phase = '';
   $target_name=$router_name.".current.".$i if $ilines > 1;
   $phase = "Phase # $i" if $ilines > 1;
   $addgraph = "routers.cgi*Graph[$target_name]: $multgraph total"
      if $ilines > 1;
   my $custarget = <<TARSINGLE
Target[$target_name]: upsOutputVoltage.$i&upsOutputVoltage.$i:$router_connect
  * upsOutputCurrent.$i&upsOutputCurrent.$i:$router_connect / 10
TARSINGLE
;
   $custarget = <<TARMULTIPLE
Target[$target_name]: upsInputVoltage.$i&upsOutputVoltage.$i:$router_connect
  * upsInputCurrent.$i&upsOutputCurrent.$i:$router_connect / 10
TARMULTIPLE
   if $ilines > 1;
my $noi ='';
$noi = 'noi' if $ilines >1;

$target_lines .= <<CURRENT
#.....................................................................
$custarget
bb*host[$target_name]: $router_name
bb*svc[$target_name]: current
bb*yellow[$target_name]: $yelcurrent
bb*red[$target_name]: $redcurrent
routers.cgi*Options[$target_name]: nototal
$addgraph
Directory[$target_name]: $directory_name
MaxBytes[$target_name]: $va
RouterUptime[$target_name]: $router_connect
Options[$target_name]: Gauge $noi
Title[$target_name]: UPS Current $phase
YLegend[$target_name]: va
ShortLegend[$target_name]: va
LegendI[$target_name]: input
LegendO[$target_name]: output

PageTop[$target_name]: <H1>UPS Current $phase </H1>
   <TABLE>
   <TR><TD>System:</TD><TD>$sysname  </TD></TR>
   <TR><TD>Location:</TD><TD>$syslocation </TD></TR>
   </TABLE>
CURRENT
;

}
}
$target_name=$router_name.".freq";
$freq =  $freq / 10;
my $freqlow = $freq - .4;
my $freqyel = $freq - .2;
my $freqhigh = $freq + .4;
my $freqyeh = $freq + .2;
my $freqmax = int($freq /.9);
$target_lines .= <<FREQ
#.....................................................................
Target[$target_name]: upsOutputFrequency.0&upsOutputFrequency.0:$router_connect / 10
bb*host[$target_name]: $router_name
bb*svc[$target_name]: freq
bb*red[$target_name]: $freqlow:$freqhigh
bb*yellow[$target_name]: $freqyel:$freqyeh
routers.cgi*Options[$target_name]: nototal
Directory[$target_name]: $directory_name
MaxBytes[$target_name]: $freq
AbsMax[$target_name]: $freqmax
RouterUptime[$target_name]: $router_connect
Options[$target_name]: Gauge noi
Title[$target_name]: UPS Frequency
YLegend[$target_name]: Hertz
ShortLegend[$target_name]: Hz
LegendI[$target_name]: Frequency

PageTop[$target_name]: <H1>UPS Output Frequency</H1>
   <TABLE>
   <TR><TD>System:</TD><TD>$sysname  </TD></TR>
   <TR><TD>Location:</TD><TD>$syslocation </TD></TR>
   </TABLE>
FREQ
;
$target_name=$router_name.".source";
$target_lines .= <<SOURCE
#.....................................................................
Target[$target_name]: upsOutputSource.0&upsOutputSource.0:$router_connect
bb*host[$target_name]: $router_name
bb*svc[$target_name]: source
bb*red[$target_name]: 2.1:3.9
routers.cgi*Options[$target_name]: nototal
Directory[$target_name]: $directory_name
MaxBytes[$target_name]: 7
AbsMax[$target_name]:  10
RouterUptime[$target_name]: $router_connect
Options[$target_name]: Gauge noi
Title[$target_name]: Output Source
YLegend[$target_name]: Source
ShortLegend[$target_name]: Source
LegendI[$target_name]: Source

PageTop[$target_name]: <H1>UPS Output Source</H1>
   <TABLE>
     <tr><td>1</td><td>Other</td>
     <tr><td>2</td><td>None</td>
     <tr><td>3</td><td>Normal</td>
     <tr><td>4</td><td>Bypass</td>
     <tr><td>5</td><td>Battery</td>
     <tr><td>6</td><td>Booster</td>
     <tr><td>7</td><td>Reducer</td>
   </TABLE>
SOURCE
;

_________________
Daniel J McDonald, CCIE #2495, CISSP # 78281, CNX
Austin Energy


Top
 Profile  
 
 Post subject: Re: host template for Liebert UPS
PostPosted: Thu 06 Nov, 2008 2:13 pm 
Offline
User

Joined: Thu 06 Nov, 2008 2:09 pm
Posts: 1
Hey, thanks for this post, but having some trouble getting it to work. I was able to get all the Liebert mibs in my system but i am still getting this error when trying use this host template.

Unknown SNMP var lgpPwrLineMeasurementVolts.3.1
at (eval 8) line 26
miclark@mnbm01-nmc:/home/nagios/Routers$ vi liebert.template
reading liebert.template


Any help would be great...


Top
 Profile  
 
 Post subject: Re: host template for Liebert UPS
PostPosted: Thu 06 Nov, 2008 4:33 pm 
Offline
Site Admin
User avatar

Joined: Mon 28 Jul, 2003 5:42 pm
Posts: 3005
Location: Auckland, New Zealand
Looks like there may be some need for a LoadMIB directive?

This script appears to assume the existance of several MIB files in a certain directory. I've added comments to the top to specify which files must exist for it to work. I've also changed it to 'code' quoting so that the leading spaces on the PageTop directives are preserved.

_________________
Steve Shipway
UNIX Systems, ITSS, University of Auckland, NZ
Woe unto them that rise up early in the morning... -- Isaiah 5:11


Top
 Profile  
 
 Post subject: Re: host template for Liebert UPS
PostPosted: Mon 12 Jan, 2009 7:55 am 
Offline
Silver User

Joined: Fri 03 Oct, 2003 11:47 am
Posts: 28
Location: Austin, TX
The lgpPwrLineMeasurementVolts.3.1 item was added in a fairly recent version of the MIB, so you may have to download a fresh copy of the MIB from Emerson if you are relying on the CD version. It also requires Version 3.x of the webcard firmware, so you might see errors when you run cfgmaker, but the template will still generate a proper config. It is mainly looking for that OID to see if it is supported, as it provides a much more accurate measurement on certain platforms (mainly the GXT-6K and GXT-10K)

_________________
Daniel J McDonald, CCIE #2495, CISSP # 78281, CNX
Austin Energy


Top
 Profile  
 
 Post subject: Re: host template for Liebert UPS
PostPosted: Mon 12 Jan, 2009 4:09 pm 
Offline
Site Admin
User avatar

Joined: Mon 28 Jul, 2003 5:42 pm
Posts: 3005
Location: Auckland, New Zealand
Although the symbolic names are easier to read, it may be better to use the numerical OIDs in the template as this will allow you to check for an OIDs existance, and run the subsequently generated CFG file, even if you don't have the MIBs installed on your system. See how the generic host template uses numeric OIDs for existance checks to avoid any error messages when the MIB is unavailable.

_________________
Steve Shipway
UNIX Systems, ITSS, University of Auckland, NZ
Woe unto them that rise up early in the morning... -- Isaiah 5:11


Top
 Profile  
 
 Post subject: Re: host template for Liebert UPS
PostPosted: Mon 12 Jan, 2009 5:43 pm 
Offline
Silver User

Joined: Fri 03 Oct, 2003 11:47 am
Posts: 28
Location: Austin, TX
stevesh wrote:
See how the generic host template uses numeric OIDs for existance checks to avoid any error messages when the MIB is unavailable.


Actually, it's the use of oid_pick to do existence checks. The symbolic name is irrelevant to that issue. The oid_pick function wasn't available when I started writing these templates. I should probably go back and rewrite them to use it - I've often considered that for the myriad CPU and Memory OID's used in various versions of IOS.

_________________
Daniel J McDonald, CCIE #2495, CISSP # 78281, CNX
Austin Energy


Top
 Profile  
 
 Post subject: Re: host template for Liebert UPS
PostPosted: Mon 12 Jan, 2009 6:16 pm 
Offline
Site Admin
User avatar

Joined: Mon 28 Jul, 2003 5:42 pm
Posts: 3005
Location: Auckland, New Zealand
If you post an updated version, I'll try and add some amendments to add the Routers2-specific directives to give nice stacked power graphs (we've done it here for the generic UPS MIB to stack the multiple input lines power consumption)

_________________
Steve Shipway
UNIX Systems, ITSS, University of Auckland, NZ
Woe unto them that rise up early in the morning... -- Isaiah 5:11


Top
 Profile  
 
 Post subject: Re: host template for Liebert UPS
PostPosted: Thu 06 May, 2010 7:52 pm 
Offline
User

Joined: Thu 06 May, 2010 7:43 pm
Posts: 2
This is a slightly updated version of the UPS template above, with the following modifications:

  • a preliminary hack to recognize Npower UPSes
  • SNMP options are preserved and used if specified (used $router versus $router_connect)
  • SNMP object names are translated to OIDs and used, so that you don't have to use a Load_MIB line in mrtg.
  • The target names were changed slightly, from router.subject to router_subject (i.e. the separator was changed from a "." to a "_").
  • The MIBs are assumed to be in the same directory, and a single variable points to that directory.

Code:
#
# Host configuration template for a Leibert UPS
#

$head_lines .= <<ECHO
#.....................................................................
ECHO
;

my $mib_base = "/usr/local/share/snmp/mibs";
snmpMIB_to_OID("${mib_base}/ups.mib");
snmpMIB_to_OID("${mib_base}/LIEBERT_GP_REG.MIB");
snmpMIB_to_OID("${mib_base}/LIEBERT_GP_POWER.MIB");

my %loidmap;
foreach my $var ( qw ( upsEstimatedMinutesRemaining upsSecondsOnBattery lgpPwrLineMeasurementVolts lgpPwrLineMeasurementVoltsLL upsBatteryVoltage lgpPwrMeasurementPointApparentPower upsInputVoltage upsOutputVoltage upsOutputFrequency upsInputCurrent upsOutputCurrent upsOutputSource ) )
{
my ($oid, $name) = SNMP_util::Check_OID($var);
if (!defined $oid) { printf STDERR "WARNING: Unable to map %s to an OID!  Not generating a host template.\n", $var; exit (1); }
$loidmap{$var} = $oid;
}


my $target_name=$router_name."_min";
my ( $maxmins, $maxsec, $absmin, $yellowvolts, $redvolts, $absvolts, @basis );
my ($model) = snmpget($router,"upsIdentModel.0");
my ($version) = snmpget($router,"upsIdentAgentSoftwareVersion.0");

push @basis, 'upsEstimatedMinutesRemaining.0';
push @basis, 'upsConfigInputVoltage.0';
push @basis, 'upsConfigOutputVoltage.0';
push @basis, 'upsInputNumLines.0';
push @basis, 'upsOutputNumLines.0';
push @basis, 'upsConfigOutputFreq.0';
push @basis, 'upsConfigOutputVA.0' if $model !~ /Nfinity/;
#push @basis, 'lgpPwrLineMeasurementVoltsLL.3.1' if $model !~ /Nfinity/ and $version !~ /^(1|2.0)/;
my ($remain,$volts,$ovolts,$ilines,$olines,$freq,$va)=
   snmpget($router,@basis);
my ($two,$two6k);
($two) = snmpget($router,"lgpPwrLineMeasurementVoltsLL.3.1") if $version !~ /^[12]/;
($two6k) = snmpget($router,"lgpPwrLineMeasurementVolts.3.1") if ($version !~ /^1/ && $model !~ /Npower/);
if ($model =~ /Nfinity/ and not defined($va)) {
   $va =20000;
}
if (defined($two)) {
   $volts = $two;
   $ovolts =$two;
   $ilines = 1;
   $olines = 1;
} elsif (defined($two6k)) {
   $volts = $two6k;
   $ovolts = $two6k;
   $ilines = 1;
   $olines = 1;
} elsif ($model =~ /GXT2-6000RT208/) {
   $volts=208;
   $ovolts=120;
   $ilines = 1;
   $olines = 1;
}
if ($remain) {
   $maxmins = int($remain / .9);
   $maxsec = $maxmins * 60;
   $absmin = $remain * 10;
}
else {
   $maxmins= 510;
   $maxsec= $maxmins * 60;
   $absmin = 1000;
}
if ($volts) {
   if ($volts != $ovolts) {
      $yellowvolts = int($volts/1.10) . ":" . int($volts/.9)
         . ":" . int($ovolts/1.10) . ":" . int($ovolts/.9);
      $redvolts = int($volts/1.2) . ":" . int($volts/.8)
         . ":" . int($ovolts/1.20) . ":" . int($ovolts/.8);
      $absvolts = $volts*2;
   }
   else {
      $yellowvolts = int($volts/1.10) . ":" . int($volts/.9);
      $redvolts = int($volts/1.2) . ":" . int($volts/.8);
      $absvolts = $volts*2;
   }
}
else {
   $volts=120;
   $yellowvolts = "114:126";
   $redvolts = "109:135";
   $absvolts= 240;
}
   
$target_lines .= <<MINUTES
Target[$target_name]: $loidmap{'upsEstimatedMinutesRemaining'}.0&$loidmap{'upsEstimatedMinutesRemaining'}.0:$router
bb*host[$target_name]: $router_name
bb*svc[$target_name]: upsmin
bb*yellow[$target_name]: 60:$absmin
bb*red[$target_name]: 30:$absmin
routers.cgi*Options[$target_name]: nototal
Directory[$target_name]: $directory_name
MaxBytes[$target_name]: $maxmins
AbsMax[$target_name]: $absmin
RouterUptime[$target_name]: $router_connect
Options[$target_name]: Gauge noi
Title[$target_name]: UPS Estimated Run Time
YLegend[$target_name]: minutes
ShortLegend[$target_name]: m
LegendI[$target_name]: remaining

PageTop[$target_name]: <H1>UPS Estimated Run-Time</H1>
   <TABLE>
   <TR><TD>System:</TD><TD>$sysname  </TD></TR>
   <TR><TD>Location:</TD><TD>$syslocation </TD></TR>
   </TABLE>
MINUTES
;
$target_name=$router_name."_sec";
$target_lines .= <<SECONDS
#.....................................................................
Target[$target_name]: $loidmap{'upsSecondsOnBattery'}.0&$loidmap{'upsSecondsOnBattery'}.0:$router
bb*host[$target_name]: $router_name
bb*svc[$target_name]: upsrun
bb*yellow[$target_name]: 300
bb*red[$target_name]: 600
routers.cgi*Options[$target_name]: nototal
Directory[$target_name]: $directory_name
MaxBytes[$target_name]: $maxsec
RouterUptime[$target_name]: $router_connect
Options[$target_name]: Gauge noi
Title[$target_name]: UPS Actual Run Time
YLegend[$target_name]: seconds
ShortLegend[$target_name]: s
LegendI[$target_name]: run time

PageTop[$target_name]: <H1>UPS Actual Time on Battery</H1>
   <TABLE>
   <TR><TD>System:</TD><TD>$sysname  </TD></TR>
   <TR><TD>Location:</TD><TD>$syslocation </TD></TR>
   </TABLE>
SECONDS
;
my $i = 0;
while ( ++$i le $ilines) {
   $target_name=$router_name."_volt";
   my $phase = '';   
   $target_name=$router_name."_volt".$i if $ilines > 1;
   $phase = "Phase # $i" if $ilines > 1;
my $custtarg = <<STANDARD
Target[$target_name]: $loidmap{'upsInputVoltage'}.$i&$loidmap{'upsOutputVoltage'}.$i:$router
STANDARD
;
if (defined($two) ) {
$custtarg =<<NEWMIB
Target[$target_name]: $loidmap{'lgpPwrLineMeasurementVoltsLL'}.1.1&$loidmap{'lgpPwrLineMeasurementVoltsLL'}.3.1:$router
NEWMIB
;
} elsif (defined($two6k)) {
$custtarg =<<6KMIB
Target[$target_name]: $loidmap{'lgpPwrLineMeasurementVolts'}.1.1&$loidmap{'lgpPwrLineMeasurementVolts'}.3.1:$router
6KMIB
;
}

$target_lines .= <<VOLTAGE
#.....................................................................
$custtarg
bb*host[$target_name]: $router_name
bb*svc[$target_name]: voltage
bb*yellow[$target_name]: $yellowvolts
bb*red[$target_name]: $redvolts
routers.cgi*Options[$target_name]: nototal
Directory[$target_name]: $directory_name
MaxBytes[$target_name]: $volts
AbsMax[$target_name]: $absvolts
RouterUptime[$target_name]: $router_connect
Options[$target_name]: Gauge
Title[$target_name]: UPS Voltages $phase
YLegend[$target_name]: volts
ShortLegend[$target_name]: vac
LegendI[$target_name]: input
LegendO[$target_name]: output

PageTop[$target_name]: <H1>UPS Voltages $phase </H1>
   <TABLE>
   <TR><TD>System:</TD><TD>$sysname  </TD></TR>
   <TR><TD>Location:</TD><TD>$syslocation </TD></TR>
   </TABLE>
VOLTAGE
;
}
($volts) = snmpget($router,'upsBatteryVoltage.0');
if ($volts) {
   $yellowvolts = int($volts/10.5) . ":" . int($volts/9.5);
   $redvolts = int($volts/11) . ":" . int($volts/9);
   $absvolts = int($volts/7);
   $volts = int($volts/10);
}
else {
   $volts=55;
   $yellowvolts = "52:57";
   $redvolts = "48:60";
   $absvolts= 80;
}
$target_name=$router_name."_batt";
$target_lines .= <<BATTERY
#.....................................................................
Target[$target_name]: $loidmap{'upsBatteryVoltage'}.0&$loidmap{'upsBatteryVoltage'}.0:$router / 10
bb*host[$target_name]: $router_name
bb*svc[$target_name]: voltage
bb*red[$target_name]: $redvolts
bb*yellow[$target_name]: $yellowvolts
routers.cgi*Options[$target_name]: nototal
Directory[$target_name]: $directory_name
MaxBytes[$target_name]: $volts
AbsMax[$target_name]: $absvolts
RouterUptime[$target_name]: $router_connect
Options[$target_name]: Gauge noi
Title[$target_name]: UPS Battery Voltage
YLegend[$target_name]: volts
ShortLegend[$target_name]: vdc
LegendI[$target_name]: battery level

PageTop[$target_name]: <H1>UPS Battery Voltage</H1>
   <TABLE>
   <TR><TD>System:</TD><TD>$sysname  </TD></TR>
   <TR><TD>Location:</TD><TD>$syslocation </TD></TR>
   </TABLE>
BATTERY
;
if (($version !~ /^(1|2.0)/) and ($model !~ /Npower/))  {
   $target_name=$router_name."_current";
   my $redcurrent = int($va/1.1);
   my $yelcurrent = int($va/1.6);

$target_lines .= <<CURRENT
#.....................................................................
Target[$target_name]: $loidmap{'lgpPwrMeasurementPointApparentPower'}.3&$loidmap{'lgpPwrMeasurementPointApparentPower'}.3:$router
bb*host[$target_name]: $router_name
bb*svc[$target_name]: current
bb*yellow[$target_name]: $yelcurrent
bb*red[$target_name]: $redcurrent
routers.cgi*Options[$target_name]: nototal
Directory[$target_name]: $directory_name
MaxBytes[$target_name]: $va
RouterUptime[$target_name]: $router_connect
Options[$target_name]: Gauge noi
Title[$target_name]: UPS Current
YLegend[$target_name]: va
ShortLegend[$target_name]: va
LegendI[$target_name]: input
LegendO[$target_name]: output

PageTop[$target_name]: <H1>UPS Current </H1>
   <TABLE>
   <TR><TD>System:</TD><TD>$sysname  </TD></TR>
   <TR><TD>Location:</TD><TD>$syslocation </TD></TR>
   </TABLE>
CURRENT
;
} else {
$i = 0;
while (++$i le $ilines) {
   my $addgraph;
   $target_name=$router_name."_current";
   my $redcurrent = int($va/1.1);
   my $yelcurrent = int($va/1.6);
   my $multgraph = $target_name;
   my $phase = '';
   $target_name=$router_name."_current".$i if $ilines > 1;
   $phase = "Phase # $i" if $ilines > 1;
   $addgraph = "routers.cgi*Graph[$target_name]: $multgraph total"
      if $ilines > 1;
   my $custarget = <<TARSINGLE
Target[$target_name]: $loidmap{'upsOutputVoltage'}.$i&$loidmap{'upsOutputVoltage'}.$i:$router
  * $loidmap{'upsOutputCurrent'}.$i&$loidmap{'upsOutputCurrent'}.$i:$router / 10
TARSINGLE
;
   $custarget = <<TARMULTIPLE
Target[$target_name]: $loidmap{'upsInputVoltage'}.$i&$loidmap{'upsOutputVoltage'}.$i:$router
  * $loidmap{'upsInputCurrent'}.$i&$loidmap{'upsOutputCurrent'}.$i:$router / 10
TARMULTIPLE
   if $ilines > 1;
my $noi ='';
$noi = 'noi' if $ilines >1;

$target_lines .= <<CURRENT
#.....................................................................
$custarget
bb*host[$target_name]: $router_name
bb*svc[$target_name]: current
bb*yellow[$target_name]: $yelcurrent
bb*red[$target_name]: $redcurrent
routers.cgi*Options[$target_name]: nototal
$addgraph
Directory[$target_name]: $directory_name
MaxBytes[$target_name]: $va
RouterUptime[$target_name]: $router_connect
Options[$target_name]: Gauge $noi
Title[$target_name]: UPS Current $phase
YLegend[$target_name]: va
ShortLegend[$target_name]: va
LegendI[$target_name]: input
LegendO[$target_name]: output

PageTop[$target_name]: <H1>UPS Current $phase </H1>
   <TABLE>
   <TR><TD>System:</TD><TD>$sysname  </TD></TR>
   <TR><TD>Location:</TD><TD>$syslocation </TD></TR>
   </TABLE>
CURRENT
;

}
}
$target_name=$router_name."_freq";
$freq =  $freq / 10;
my $freqlow = $freq - .4;
my $freqyel = $freq - .2;
my $freqhigh = $freq + .4;
my $freqyeh = $freq + .2;
my $freqmax = int($freq /.9);
$target_lines .= <<FREQ
#.....................................................................
Target[$target_name]: $loidmap{'upsOutputFrequency'}.0&$loidmap{'upsOutputFrequency'}.0:$router / 10
bb*host[$target_name]: $router_name
bb*svc[$target_name]: freq
bb*red[$target_name]: $freqlow:$freqhigh
bb*yellow[$target_name]: $freqyel:$freqyeh
routers.cgi*Options[$target_name]: nototal
Directory[$target_name]: $directory_name
MaxBytes[$target_name]: $freq
AbsMax[$target_name]: $freqmax
RouterUptime[$target_name]: $router_connect
Options[$target_name]: Gauge noi
Title[$target_name]: UPS Frequency
YLegend[$target_name]: Hertz
ShortLegend[$target_name]: Hz
LegendI[$target_name]: Frequency

PageTop[$target_name]: <H1>UPS Output Frequency</H1>
   <TABLE>
   <TR><TD>System:</TD><TD>$sysname  </TD></TR>
   <TR><TD>Location:</TD><TD>$syslocation </TD></TR>
   </TABLE>
FREQ
;
$target_name=$router_name."_source";
$target_lines .= <<SOURCE
#.....................................................................
Target[$target_name]: $loidmap{'upsOutputSource'}.0&$loidmap{'upsOutputSource'}.0:$router
bb*host[$target_name]: $router_name
bb*svc[$target_name]: source
bb*red[$target_name]: 2.1:3.9
routers.cgi*Options[$target_name]: nototal
Directory[$target_name]: $directory_name
MaxBytes[$target_name]: 7
AbsMax[$target_name]:  10
RouterUptime[$target_name]: $router_connect
Options[$target_name]: Gauge noi
Title[$target_name]: Output Source
YLegend[$target_name]: Source
ShortLegend[$target_name]: Source
LegendI[$target_name]: Source

PageTop[$target_name]: <H1>UPS Output Source</H1>
   <TABLE>
     <tr><td>1</td><td>Other</td>
     <tr><td>2</td><td>None</td>
     <tr><td>3</td><td>Normal</td>
     <tr><td>4</td><td>Bypass</td>
     <tr><td>5</td><td>Battery</td>
     <tr><td>6</td><td>Booster</td>
     <tr><td>7</td><td>Reducer</td>
   </TABLE>
SOURCE
;


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 8 posts ] 

All times are UTC - 5 hours


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group