Monitoring Metrics of APC UPS with MRTG via SNMP

Linux

This assumes you have a APC Smart-UPS UPS with a Network Management Card, that you have already configured to allow SNMP connections and you’ve configured the community string. This is tested using MRTG running on Ubuntu with an AP9619 network management card in the UPSes.

This took ages to find the correct metrics OIDs from the MIB to monitor using lots of time, swearing and investigation using MIB lookup tools. And some trail and error checking the values on the web interface to what the OID was showing.

These configurations allow you to pull out and monitor the following metrics from the UPS, note i’ve given the two types of UPS we use on our campuses, but basically you should find these work for most times of APC UPS, the 15Kva is a 3 phase UPS so we want to monitor the input and output Voltage on each phase. The 10KVa one is just a single phase UPS so we only monitor the one incoming and outgoing on that one.

APC UPS Smart-UPS VT 15kVA

  • Input Frequency – 1.3.6.1.4.1.318.1.1.1.3.2.4.0
  • Output Frequency – 1.3.6.1.4.1.318.1.1.1.4.2.2.0
  • Input Voltage Phase 1 – 1.3.6.1.4.1.318.1.1.1.9.2.3.1.3.1.1.1
  • Output Voltage Phase 1 – 1.3.6.1.4.1.318.1.1.1.9.3.3.1.3.1.1.1
  • Input Voltage Phase 2 – 1.3.6.1.4.1.318.1.1.1.9.2.3.1.3.1.1.2
  • Output Voltage Phase 2 – 1.3.6.1.4.1.318.1.1.1.9.3.3.1.3.1.1.2
  • Input Voltage Phase 3 – 1.3.6.1.4.1.318.1.1.1.9.2.3.1.3.1.1.3
  • Output Voltage Phase 3 – 1.3.6.1.4.1.318.1.1.1.9.3.3.1.3.1.1.3
  • Output Load Percent – 1.3.6.1.4.1.318.1.1.1.4.2.3.0
  • Internal UPS Temperature – 1.3.6.1.4.1.318.1.1.1.2.2.2.0
  • External UPS Temperature (Temperature Sensor) – 1.3.6.1.4.1.318.1.1.10.2.3.2.1.4.1
  • Battery Charge Level – 1.3.6.1.4.1.318.1.1.1.2.2.1.0

APC UPS Smart-UPS RT 10000 RM XL

  • Input Frequency – 1.3.6.1.4.1.318.1.1.1.3.2.4.0
  • Output Frequency – 1.3.6.1.4.1.318.1.1.1.4.2.2.0
  • Input Voltage – 1.3.6.1.4.1.318.1.1.1.3.2.1.0
  • Output Voltage – 1.3.6.1.4.1.318.1.1.1.4.2.1.0
  • Output Load Percent – 1.3.6.1.4.1.318.1.1.1.4.2.3.0
  • Internal UPS Temperature – 1.3.6.1.4.1.318.1.1.1.2.2.2.0
  • External UPS Temperature (Temperature Sensor) – 1.3.6.1.4.1.318.1.1.10.2.3.2.1.4.1
  • Battery Charge Level – 1.3.6.1.4.1.318.1.1.1.2.2.1.0

So now for the configuration in MRTG, you need to configure the MRTG file to use the files to build up the logs and you’d need to have this set to run a CRON job to take the MRTG script and scoop the current statistics every 5 minutes or so. I’m not explaining that as you can find instructions for it every where. Below are the MRTG configuration files that will produce the graphs for these metrics.

You may notice that for some of the single metric OIDs like “Battery Charge Level” have the same OID repeated twice in the input, this is because MRTG must have 2 inputs, if it doesn’t it won’t work. This is fine for a router interface with incoming and outgoing traffic, but doesn’t work so well for battery charge level which would be 100% or 10% for example.

UPSNAME = Substitute this with your UPS’s hostname on the network for easy identification.

COMMUNITYSTRING = The SNMP string is what is configured on the UPS.

IPADDRESS = The IP address of the management IP of the network card in the UPS.

APC UPS Smart-UPS VT 15kVA

# APC UPS APC MRTG config

EnableIPv6: no

WorkDir: /var/www/mrtg/ups

YLegend[UPSNAME_1]: Hertz

ShortLegend[UPSNAME_1]: Hz

Directory[UPSNAME_1]: UPSNAME

XSize[UPSNAME_1]: 400

YSize[UPSNAME_1]: 100

Legend1[UPSNAME_1]: Input Frequency

Legend2[UPSNAME_1]: Output Frequency

Legend3[UPSNAME_1]: Max Input Frequency

Legend4[UPSNAME_1]: Max Output Frequency

LegendI[UPSNAME_1]: Input Hz

LegendO[UPSNAME_1]: Output Hz

WithPeak[UPSNAME_1]: ywm

MaxBytes[UPSNAME_1]: 100

Unscaled[UPSNAME_1]: dwmy

Options[UPSNAME_1]: growright, gauge, nopercent

Title[UPSNAME_1]: Input & Output Frequency

Target[UPSNAME_1]: 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:COMMUNITYSTRING@IPADDRESS

PageTop[UPSNAME_1]: <H1>Input & Output Frequency</H1>

YLegend[UPSNAME_2]: Voltage

ShortLegend[UPSNAME_2]: v

Directory[UPSNAME_2]: UPSNAME

XSize[UPSNAME_2]: 400

YSize[UPSNAME_2]: 100

Legend1[UPSNAME_2]: Input Voltage Phase 1

Legend2[UPSNAME_2]: Output Voltage Phase 1

LegendI[UPSNAME_2]: Input Voltage

LegendO[UPSNAME_2]: Output Voltage

WithPeak[UPSNAME_2]: ywm

MaxBytes[UPSNAME_2]: 320

Unscaled[UPSNAME_2]: dwmy

Options[UPSNAME_2]: growright, gauge, nopercent

Title[UPSNAME_2]: Input and Output Voltage Phase 1

Target[UPSNAME_2]: 1.3.6.1.4.1.318.1.1.1.9.2.3.1.3.1.1.1&1.3.6.1.4.1.318.1.1.1.9.3.3.1.3.1.1.1:COMMUNITYSTRING@IPADDRESS

PageTop[UPSNAME_2]: <H1>Input and Output Voltage Phase 1</H1>

YLegend[UPSNAME_3]: Voltage

ShortLegend[UPSNAME_3]: v

Directory[UPSNAME_3]: UPSNAME

XSize[UPSNAME_3]: 400

YSize[UPSNAME_3]: 100

Legend1[UPSNAME_3]: Input Voltage Phase 2

Legend2[UPSNAME_3]: Output Voltage Phase 2

LegendI[UPSNAME_3]: Input Voltage

LegendO[UPSNAME_3]: Output Voltage

WithPeak[UPSNAME_3]: ywm

MaxBytes[UPSNAME_3]: 320

Unscaled[UPSNAME_3]: dwmy

Options[UPSNAME_3]: growright, gauge, nopercent

Title[UPSNAME_3]: Input and Output Voltage Phase 2

Target[UPSNAME_3]: 1.3.6.1.4.1.318.1.1.1.9.2.3.1.3.1.1.2&1.3.6.1.4.1.318.1.1.1.9.3.3.1.3.1.1.2:COMMUNITYSTRING@IPADDRESS

PageTop[UPSNAME_3]: <H1>Input and Output Voltage Phase 2</H1>

YLegend[UPSNAME_4]: Voltage

ShortLegend[UPSNAME_4]: v

Directory[UPSNAME_4]: UPSNAME

XSize[UPSNAME_4]: 400

YSize[UPSNAME_4]: 100

Legend1[UPSNAME_4]: Input Voltage Phase 3

Legend2[UPSNAME_4]: Output Voltage Phase 3

LegendI[UPSNAME_4]: Input Voltage

LegendO[UPSNAME_4]: Output Voltage

WithPeak[UPSNAME_4]: ywm

MaxBytes[UPSNAME_4]: 320

Unscaled[UPSNAME_4]: dwmy

Options[UPSNAME_4]: growright, gauge, nopercent

Title[UPSNAME_4]: Input and Output Voltage Phase 3

Target[UPSNAME_4]: 1.3.6.1.4.1.318.1.1.1.9.2.3.1.3.1.1.3&1.3.6.1.4.1.318.1.1.1.9.3.3.1.3.1.1.3:COMMUNITYSTRING@IPADDRESS

PageTop[UPSNAME_4]: <H1>Input and Output Voltage Phase 3</H1>

YLegend[UPSNAME_5]: Percent

ShortLegend[UPSNAME_5]: %

Directory[UPSNAME_5]: UPSNAME

XSize[UPSNAME_5]: 400

YSize[UPSNAME_5]: 100

Legend1[UPSNAME_5]: Output Load Percent

Legend2[UPSNAME_5]: Output Load Percent

LegendI[UPSNAME_5]: Percent

LegendO[UPSNAME_5]: Percent

WithPeak[UPSNAME_5]: ywm

MaxBytes[UPSNAME_5]: 100

Unscaled[UPSNAME_5]: dwmy

Options[UPSNAME_5]: growright, gauge, nopercent

Title[UPSNAME_5]: Output Load Percent

Target[UPSNAME_5]: 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:COMMUNITYSTRING@IPADDRESS

PageTop[UPSNAME_5]: <H1>Output Load Percent</H1>

YLegend[UPSNAME_6]: Temperature

ShortLegend[UPSNAME_6]: C

Directory[UPSNAME_6]: UPSNAME

XSize[UPSNAME_6]: 400

YSize[UPSNAME_6]: 100

Legend1[UPSNAME_6]: Internal UPS Temperature

Legend2[UPSNAME_6]: Internal UPS Temperature

LegendI[UPSNAME_6]: Celsius

LegendO[UPSNAME_6]: Celsius

WithPeak[UPSNAME_6]: ywm

MaxBytes[UPSNAME_6]: 40

Unscaled[UPSNAME_6]: dwmy

Options[UPSNAME_6]: growright, gauge, nopercent

Title[UPSNAME_6]: Internal UPS Temperature

Target[UPSNAME_6]: 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:COMMUNITYSTRING@IPADDRESS

PageTop[UPSNAME_6]: <H1>Internal UPS Temperature</H1>

YLegend[UPSNAME_7]: Temperature

ShortLegend[UPSNAME_7]: C

Directory[UPSNAME_7]: UPSNAME

XSize[UPSNAME_7]: 400

YSize[UPSNAME_7]: 100

Legend1[UPSNAME_7]: External UPS Temperature

Legend2[UPSNAME_7]: External UPS Temperature

LegendI[UPSNAME_7]: Celsius

LegendO[UPSNAME_7]: Celsius

WithPeak[UPSNAME_7]: ywm

MaxBytes[UPSNAME_7]: 40

Unscaled[UPSNAME_7]: dwmy

Options[UPSNAME_7]: growright, gauge, nopercent

Title[UPSNAME_7]: External UPS Temperature

Target[UPSNAME_7]: 1.3.6.1.4.1.318.1.1.10.2.3.2.1.4.1&1.3.6.1.4.1.318.1.1.10.2.3.2.1.4.1:COMMUNITYSTRING@IPADDRESS

PageTop[UPSNAME_7]: <H1>External UPS Temperature</H1>

YLegend[UPSNAME_8]: Percent

ShortLegend[UPSNAME_8]: %

Directory[UPSNAME_8]: UPSNAME

XSize[UPSNAME_8]: 400

YSize[UPSNAME_8]: 100

Legend1[UPSNAME_8]: Battery Charge Level

Legend2[UPSNAME_8]: Battery Charge Level

LegendI[UPSNAME_8]: %

LegendO[UPSNAME_8]: %

WithPeak[UPSNAME_8]: ywm

MaxBytes[UPSNAME_8]: 100

Unscaled[UPSNAME_8]: dwmy

Options[UPSNAME_8]: growright, gauge, nopercent

Title[UPSNAME_8]: Battery Charge Level

Target[UPSNAME_8]: .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:COMMUNITYSTRING@IPADDRESS

PageTop[UPSNAME_8]: <H1>Battery Charge Level</H1>

APC UPS Smart-UPS RT 10000 RM XL

# APC UPS APC MRTG config

EnableIPv6: no

WorkDir: /var/www/mrtg/ups

YLegend[UPSNAME_1]: Hertz

ShortLegend[UPSNAME_1]: Hz

Directory[UPSNAME_1]: UPSNAME

XSize[UPSNAME_1]: 400

YSize[UPSNAME_1]: 100

Legend1[UPSNAME_1]: Input Frequency

Legend2[UPSNAME_1]: Output Frequency

Legend3[UPSNAME_1]: Max Input Frequency

Legend4[UPSNAME_1]: Max Output Frequency

LegendI[UPSNAME_1]: Input Hz

LegendO[UPSNAME_1]: Output Hz

WithPeak[UPSNAME_1]: ywm

MaxBytes[UPSNAME_1]: 100

Unscaled[UPSNAME_1]: dwmy

Options[UPSNAME_1]: growright, gauge, nopercent

Title[UPSNAME_1]: Input & Output Frequency

Target[UPSNAME_1]: 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:COMMUNITYSTRING@IPADDRESS

PageTop[UPSNAME_1]: <H1>Input & Output Frequency</H1>

YLegend[UPSNAME_2]: Voltage

ShortLegend[UPSNAME_2]: v

Directory[UPSNAME_2]: UPSNAME

XSize[UPSNAME_2]: 400

YSize[UPSNAME_2]: 100

Legend1[UPSNAME_2]: Input Voltage

Legend2[UPSNAME_2]: Output Voltage

LegendI[UPSNAME_2]: Input Voltage

LegendO[UPSNAME_2]: Output Voltage

WithPeak[UPSNAME_2]: ywm

MaxBytes[UPSNAME_2]: 320

Unscaled[UPSNAME_2]: dwmy

Options[UPSNAME_2]: growright, gauge, nopercent

Title[UPSNAME_2]: Input and Output Voltage

Target[UPSNAME_2]: 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:COMMUNITYSTRING@IPADDRESS

PageTop[UPSNAME_2]: <H1>Input and Output Voltage</H1>

YLegend[UPSNAME_3]: Percent

ShortLegend[UPSNAME_3]: %

Directory[UPSNAME_3]: UPSNAME

XSize[UPSNAME_3]: 400

YSize[UPSNAME_3]: 100

Legend1[UPSNAME_3]: Output Load Percent

Legend2[UPSNAME_3]: Output Load Percent

LegendI[UPSNAME_3]: Percent

LegendO[UPSNAME_3]: Percent

WithPeak[UPSNAME_3]: ywm

MaxBytes[UPSNAME_3]: 100

Unscaled[UPSNAME_3]: dwmy

Options[UPSNAME_3]: growright, gauge, nopercent

Title[UPSNAME_3]: Output Load Percent

Target[UPSNAME_3]: 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:COMMUNITYSTRING@IPADDRESS

PageTop[UPSNAME_3]: <H1>Output Load Percent</H1>

YLegend[UPSNAME_4]: Temperature

ShortLegend[UPSNAME_4]: C

Directory[UPSNAME_4]: UPSNAME

XSize[UPSNAME_4]: 400

YSize[UPSNAME_4]: 100

Legend1[UPSNAME_4]: Internal UPS Temperature

Legend2[UPSNAME_4]: Internal UPS Temperature

LegendI[UPSNAME_4]: Celsius

LegendO[UPSNAME_4]: Celsius

WithPeak[UPSNAME_4]: ywm

MaxBytes[UPSNAME_4]: 40

Unscaled[UPSNAME_4]: dwmy

Options[UPSNAME_4]: growright, gauge, nopercent

Title[UPSNAME_4]: Internal UPS Temperature

Target[UPSNAME_4]: 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:COMMUNITYSTRING@IPADDRESS

PageTop[UPSNAME_4]: <H1>Internal UPS Temperature</H1>

YLegend[UPSNAME_5]: Temperature

ShortLegend[UPSNAME_5]: C

Directory[UPSNAME_5]: UPSNAME

XSize[UPSNAME_5]: 400

YSize[UPSNAME_5]: 100

Legend1[UPSNAME_5]: External UPS Temperature

Legend2[UPSNAME_5]: External UPS Temperature

LegendI[UPSNAME_5]: Celsius

LegendO[UPSNAME_5]: Celsius

WithPeak[UPSNAME_5]: ywm

MaxBytes[UPSNAME_5]: 40

Unscaled[UPSNAME_5]: dwmy

Options[UPSNAME_5]: growright, gauge, nopercent

Title[UPSNAME_5]: External UPS Temperature

Target[UPSNAME_5]: 1.3.6.1.4.1.318.1.1.10.2.3.2.1.4.1&1.3.6.1.4.1.318.1.1.10.2.3.2.1.4.1:COMMUNITYSTRING@IPADDRESS

PageTop[UPSNAME_5]: <H1>External UPS Temperature</H1>

YLegend[UPSNAME_6]: Percent

ShortLegend[UPSNAME_6]: %

Directory[UPSNAME_6]: UPSNAME

XSize[UPSNAME_6]: 400

YSize[UPSNAME_6]: 100

Legend1[UPSNAME_6]: Battery Charge Level

Legend2[UPSNAME_6]: Battery Charge Level

LegendI[UPSNAME_6]: %

LegendO[UPSNAME_6]: %

WithPeak[UPSNAME_6]: ywm

MaxBytes[UPSNAME_6]: 100

Unscaled[UPSNAME_6]: dwmy

Options[UPSNAME_6]: growright, gauge, nopercent

Title[UPSNAME_6]: Battery Charge Level

Target[UPSNAME_6]: .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:COMMUNITYSTRING@IPADDRESS

PageTop[UPSNAME_6]: <H1>Battery Charge Level</H1>

Once configured you can setup the MRTG scripts to run periodically to pickup the statistics and then you need to use “indexmaker” to create the nice graph html file so you can see the pretty graphs.

Leave a Reply

Your email address will not be published. Required fields are marked *