What is this?

This knowledgebase contains questions and answers about PRTG Network Monitor and network monitoring in general.

Learn more

PRTG Network Monitor

Intuitive to Use. Easy to manage.
More than 500,000 users rely on Paessler PRTG every day. Find out how you can reduce cost, increase QoS and ease planning, as well.

Free Download

Top Tags


View all Tags

APC UPS SNMP Battery Replace Sensor

Votes:

0

PRTG is missing a critical sensor in their included APC SNMP sensor, the battery replace warning (Please add it!). I'm trying to create my own and am having some difficulty. I've created a custom OID file with the PRTG MIB builder and have added the "BatteryReplaceIndicator" to PRTG and it returns a text string. It is either "noBatteryNeedsReplacing" or "batteryNeedsReplacing." Since I can't seem to create an error threshold using the standard custom SNMP sensor (it expects numeric values only) I've created another SNMP Custom String sensor using the same OID. I added noBatteryNeedsReplacing to the Response Must Include field. It gives a down status for the APC that has a bad batter, but it also gives a down status for an APC that has a good battery. How do I set this up?

It is frustrating that you can't create a sensor that can use a text value directly with a custom library that is already built, you have to create a text string sensor and type in an OID manually. It is equally frustrating that the custom string SNMP sensor doesn't actually show the string it is getting, AND you can't customize the down sensor with a message like "Replace Battery Now." Or am I missing something?

apc battery custom-sensor custom-snmp-sensor lookup snmp

Created on Nov 5, 2015 2:12:49 PM

Last change on Feb 7, 2017 10:13:54 AM by  Luciano Lingnau [Paessler]



7 Replies

Accepted Answer

Votes:

0

Hello,
we appreciate your inquiry.

String results are much more complex to be handled than Numerical results. Ideally you should look for an OID which provides the "status code" for the battery replacement as an integer, that way you can use a lookup which allows you to achieve exactly what you intend. Most SNMP implementations include OID's which provide status values in a numerical format.

Which sensor and which OID are you using?
After a brief search I've located an interesting OID:

upsAdvBatteryReplaceIndicator1.3.6.1.4.1.318.1.1.1.2.2.4.0

It supposedly indicates whether the UPS batteries need to be replaced:

  • 1 = Batteries do not need replacing
  • 2 = Batteries need replacing

Based on the above information, you can create a new SNMP Custom Sensor querying 1.3.6.1.4.1.318.1.1.1.2.2.4.0. Within the created "Value" channel, assign a custom lookup to display the corresponding status and message based on the numerical value returned by the sensor. It would look like this:

<?xml version="1.0" encoding="UTF-8"?>
<ValueLookup id="prtg.customlookup.apc.batteryreplace" desiredValue="1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="PaeValueLookup.xsd">
	<Lookups>
		<SingleInt state="Ok" value="1">Batteries do not need replacing</SingleInt>
		<SingleInt state="Error" value="2">Batteries need replacing</SingleInt>
	</Lookups>
</ValueLookup>

The lookup should be stored in C:\Program Files (x86)\PRTG Network Monitor\lookups\custom\ with the filename prtg.customlookup.apc.batteryreplace.ovl on the Core Server and you'll need to Re-Load Lookups for the new lookup to appear on the list of available lookups.

Note

Please also refer to the APC device template available here:

Best Regards,

Created on Nov 6, 2015 8:29:03 AM by  Luciano Lingnau [Paessler]

Last change on Sep 15, 2020 7:43:40 AM by  Sebastian Kniege [Paessler Support]



Votes:

0

Thanks for your help, I realized that PRTG seemed to automatically create a lookup for this sensor when I either imported or created sensors with this oid file (created from APC's official MIB file in the PRTG MIB Import tool). That was causing the sensor message to be the string values and the state for each value was "none" I modified the state and the message value to the following.

<?xml version="1.0" encoding="UTF-8"?>
<ValueLookup id="oid.powernet-mib.upsadvbattery.upsadvbatteryreplaceindicator" desiredValue="1"  undefinedState="olsNone">
	<Lookups>
		<SingleInt state="OK" value="1">Batteries Good</SingleInt>
		<SingleInt state="Error" value="2">Replace Batteries Now</SingleInt>
	</Lookups>
</ValueLookup>

Created on Nov 6, 2015 2:33:07 PM

Last change on Jul 5, 2018 5:33:33 AM by  Luciano Lingnau [Paessler]



Votes:

0

Hello,
thank you for your feedback.

Good to hear that you've got it working.

PRTG will create lookups from imported MIB files, but they will need manual "fine tuning" to display the desired messages and corresponding states. (Within the MIB Importer, you'll see the Lookup field displaying values when PRTG is able to identify a lookup within a MIB File)

Best Regards,

Created on Nov 9, 2015 8:36:28 AM by  Luciano Lingnau [Paessler]



Votes:

0

The name of the lookup file is wrong. It has to be prtg.customlookup.apc.batteryreplace.xsd and not *.ovl

Created on May 18, 2017 1:14:32 PM



Votes:

0

Hello Michael, thank you for your reply.

No, the xsd extension is only used for the schema used by the OVL files, but they should indeed be named *.ovl.

Best Regards,
Luciano Lingnau [Paessler Support]

Created on May 18, 2017 1:39:07 PM by  Luciano Lingnau [Paessler]



Votes:

0

Hi there! Found this useful script, but is only giving me: "The lookup "prtg.customlookup.apc.batteryreplace" does not contain a definition for "1"" Please advise

Created on Sep 14, 2020 8:18:22 PM



Votes:

0

Hi there,

This is very odd, because the custom lookup file, that my colleague Luciano mentioned above, does contain a result for the given value "1":

<?xml version="1.0" encoding="UTF-8"?>
<ValueLookup id="prtg.customlookup.apc.batteryreplace" desiredValue="1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="PaeValueLookup.xsd">
	<Lookups>
		<SingleInt state="Ok" value="1">Batteries do not need replacing</SingleInt>
		<SingleInt state="Error" value="2">Batteries need replacing</SingleInt>
	</Lookups>
</ValueLookup>


Please check your stored lookup file and maybe create a new one as described in Luciano's post. Please remember to re-load the lookup list afterwards as described above.

Best,
Sebastian

Created on Sep 15, 2020 7:45:58 AM by  Sebastian Kniege [Paessler Support]




Disclaimer: The information in the Paessler Knowledge Base comes without warranty of any kind. Use at your own risk. Before applying any instructions please exercise proper system administrator housekeeping. You must make sure that a proper backup of all your data is available.