For general APC monitoring, see Monitor APC UPS Units
APC UPS Ambient Temperature Probe
Note: APC names their external temp sensors something like “Integrated”. Log into the UPS (default apc:apc) and change it to “apcAmbientTemp”.
How this all works
Basically what we are going to do is add a new snmp mib for opennms to query. The data from that mib will be stored in the opennms DB and we will need to define a way to display it (create a graph for the data). Once opennms is storing the data we can start using the data to trigger events, alarms ect.
Step 1: Add a mib for opennms to query
Add the following to the datacollection/apc.xml
file:
- Within
<snmp-collection...
tag:
<resourceType name="apcAmbientTemp" label="APC Ambient Probe Temperature (powernet393)"
resourceLabel="${iemProbeName} (index ${index})">
<persistenceSelectorStrategy class="org.opennms.netmgt.collectd.PersistAllSelectorStrategy"/>
<storageStrategy class="org.opennms.netmgt.dao.support.IndexStorageStrategy"/>
</resourceType>
- Within
<groups>
tag:
<group name="APC-StatusProbe" ifType="all">
<mibObj oid=".1.3.6.1.4.1.318.1.1.10.2.3.2.1.2" instance="apcAmbientTemp" alias="iemProbeName" type="string" />
<mibObj oid=".1.3.6.1.4.1.318.1.1.10.2.3.2.1.4" instance="apcAmbientTemp" alias="iemProbeCurrTemp" type="gauge32" />
<mibObj oid=".1.3.6.1.4.1.318.1.1.10.2.3.2.1.5" instance="apcAmbientTemp" alias="iemProbeTempUnits" type="integer" />
<mibObj oid=".1.3.6.1.4.1.318.1.1.10.2.3.2.1.6" instance="apcAmbientTemp" alias="iemProbeCurrHumid" type="gauge32" />
<mibObj oid=".1.3.6.1.4.1.318.1.1.10.2.3.2.1.7" instance="apcAmbientTemp" alias="iemProbeHighTempV" type="integer" />
<mibObj oid=".1.3.6.1.4.1.318.1.1.10.2.3.2.1.8" instance="apcAmbientTemp" alias="iemProbeLowTempV" type="integer" />
<mibObj oid=".1.3.6.1.4.1.318.1.1.10.2.3.2.1.9" instance="apcAmbientTemp" alias="iemProbeHighHumidV" type="integer" />
<mibObj oid=".1.3.6.1.4.1.318.1.1.10.2.3.2.1.10" instance="apcAmbientTemp" alias="iemProbeLowHumidV" type="integer" />
<mibObj oid=".1.3.6.1.4.1.318.1.1.10.2.3.2.1.11" instance="apcAmbientTemp" alias="iemProbeMaxTempV" type="integer" />
<mibObj oid=".1.3.6.1.4.1.318.1.1.10.2.3.2.1.12" instance="apcAmbientTemp" alias="iemProbeMinTempV" type="integer" />
<mibObj oid=".1.3.6.1.4.1.318.1.1.10.2.3.2.1.13" instance="apcAmbientTemp" alias="iemProbeMaxHumidV" type="integer" />
<mibObj oid=".1.3.6.1.4.1.318.1.1.10.2.3.2.1.14" instance="apcAmbientTemp" alias="iemProbeMinHumidV" type="integer" />
</group>
- Within
<systemDef name="APC UPS">
:
<includeGroup>APC-StatusProbe</includeGroup>
Step 2: Add a graph definition so we can display the mib data opennms is collecting
Add the following $OPENNMS_HOME/etc/snmp-graph.properties
.
- Add to
reports=
the following:
reports=...
company.ambientTemp, companyambientHumid, \
Add anywhere in the file.
report.company.ambientTemp.name=Ambient Temperature
report.company.ambientTemp.columns=iemProbeCurrTemp
report.company.ambientTemp.type=apcAmbientTemp
report.company.ambientTemp.command=--title="Current Ambient Temperature" \
--vertical-label="Current Temperature" \
DEF:currEstab={rrd1}:iemProbeCurrTemp:AVERAGE \
DEF:minCurrEstab={rrd1}:iemProbeCurrTemp:MIN \
DEF:maxCurrEstab={rrd1}:iemProbeCurrTemp:MAX \
LINE2:currEstab#00ff00:"Current " \
GPRINT:currEstab:AVERAGE:"Avg \\: %8.2lf %s" \
GPRINT:currEstab:MIN:"Min \\: %8.2lf %s" \
GPRINT:currEstab:MAX:"Max \\: %8.2lf %s\\n"
report.company.ambientHumid.name=Ambient Humidity
report.company.ambientHumid.columns=iemProbeCurrHumid
report.company.ambientHumid.type=apcAmbientTemp
report.company.ambientHumid.command=--title="Current Ambient Humidity" \
--vertical-label="Current Humidity" \
DEF:currEstab={rrd1}:iemProbeCurrHumid:AVERAGE \
DEF:minCurrEstab={rrd1}:iemProbeCurrHumid:MIN \
DEF:maxCurrEstab={rrd1}:iemProbeCurrHumid:MAX \
LINE2:currEstab#00ff00:"Current " \
GPRINT:currEstab:AVERAGE:"Avg \\: %8.2lf %s" \
GPRINT:currEstab:MIN:"Min \\: %8.2lf %s" \
GPRINT:currEstab:MAX:"Max \\: %8.2lf %s\\n"
Step 3: Add some thresholds for the mib data opennms is collecting
Edit the /$OPENNMS_HOME/etc/thresholds.xml
file and add the following after the <group name="netsnmp"...
group
<group name="apcups" rrdRepository="/opt/opennms/share/rrd/snmp/">
<threshold type="high" ds-type="apcAmbientTemp" value="30"
rearm="28.0" trigger="1" ds-label="iemProbeName"
triggeredUEI="uei.opennms.org/company/probeTempHigh"
rearmedUEI="uei.opennms.org/company/probeTempHigh-rearmed" ds-name="iemProbeCurrTemp"/>
</group>
Step 4: Add APC into the Threshold Daemon group
Edit the threshold daemon file $OPENNMS_HOME/etc/threshd-configuration.xml
and create the threshold group as follows.
<package name="apcups">
<filter>IPADDR != '0.0.0.0' &amp; (nodeSysOID LIKE '.1.3.6.1.4.1.318.%')</filter>
<include-range begin="1.1.1.1" end="254.254.254.254"/>
<service name="SNMP" interval="300000" user-defined="false" status="on">
<parameter key="thresholding-group" value="apcups"/>
</service>
<outage-calendar xmlns="">OpenNMS Restart</outage-calendar>
<outage-calendar xmlns="">LEP Move To Auriga</outage-calendar>
</package>
Step 5: Add a custom event to opennms based in the thresholds
Once this is completed, you will need to edit the events file $OPENNMS_HOME/etc/eventconf.xml
to create the event custom UEI event. Append this to the end before the </event>
tag.
<event-file xmlns="">events/programmatic.events.xml</event-file>
==Step 6: events/programmatic.events.xml==
Now, edit ''/opt/opennms/etc/events/programmatic.events.xml'' and add the following.
<pre><?xml version="1.0" encoding="UTF-8"?>
<events xmlns="http://xmlns.opennms.org/xsd/eventconf">
<event>
<uei xmlns="">uei.opennms.org/company/probeTempHigh</uei>
<event-label xmlns="">company : High Temperature</event-label>
<descr xmlns="">High temperature alarm for %service% datasource %parm[ds]% on interface %interface%, parms: %parm[all]</descr>
<logmsg dest="logndisplay">High temperature alarm for %service% datasource %parm[ds]% on interface %interface%, parms: %parm[all]%</logmsg>
<severity xmlns="">Major</severity>
<alarm-data reduction-key="%uei%!%nodeid%!%parm[label]%" alarm-type="1" auto-clean="false" />
</event>
<event>
<uei xmlns="">uei.opennms.org/company/probeTempHigh-rearmed</uei>
<event-label xmlns="">company : High Temperature - Re-Armed</event-label>
<descr xmlns="">High Temp rearmed for %service% datasource %parm[ds]% on interface %interface%, parms: %parm[all]</descr>
<logmsg dest="logndisplay">High Temp rearmed for %service% datasource %parm[ds]% on interface %interface%, parms: %parm[all]%</logmsg>
<severity xmlns="">Normal</severity>
<alarm-data
clear-key="uei.opennms.org/company/probeTempHigh!%nodeid%!%parm[label]%"
reduction-key="%uei%:%nodeid%:%parm[label]%" alarm-type="2" auto-clean="true" />
</event>
</events></pre>
Step 7: Add notifications to opennms based in the events you have defined
Add to $OPENNMS_HOME/etc/notifications.xml
before the </notifications>
tag.
<notification name="High Temperature" status="on" writeable="yes">
<uei xmlns="">uei.opennms.org/company/probeTempHigh</uei>
<description xmlns="">High Temperature in Server Room</description>
<rule xmlns="">(IPADDR IPLIKE *.*.*.*)</rule>
<destinationPath xmlns="">IDS-SysAdmin</destinationPath>
<text-message xmlns="">Node: %nodelabel% &#xd;&#xd;https://opennms_server/opennms/event/detail.jsp?id=%eventid%</text-message>
<subject xmlns="">High Temperature (%nodelabel%)</subject>
<numeric-message xmlns="">&#xd;</numeric-message>
</notification>
<notification name="High Temperature Re-Armed" status="on" writeable="yes">
<uei xmlns="">uei.opennms.org/company/probeTempHigh-rearmed</uei>
<description xmlns="">High Temperature in Server Room</description>
<rule xmlns="">(IPADDR IPLIKE *.*.*.*)</rule>
<destinationPath xmlns="">IDS-SysAdmin</destinationPath>
<text-message xmlns="">Node: %nodelabel% &#xd;&#xd;https://opennms_server/opennms/event/detail.jsp?id=%eventid%</text-message>
<subject xmlns="">Re-Armed High Temperature (%nodelabel%)</subject>
<numeric-message xmlns="">&#xd;</numeric-message>
</notification>