Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

OpenNMS is an open source network management platform that uses--among other protocols--Simple Network Management Protocol (SNMP) to monitor seversservers. It can be configured to send emails email notifications out when disk when the disk usage is too high or when the server is thrashing, etc.

...

Code Block
xml
xml
<!-- added to capsd-configuration.xml -->
<protocol-plugin protocol="My Service" class-name="org.opennms.netmgt.capsd.plugins.HttpPlugin" scan="on">
    <property key="port" value="80" />
    <property key="timeout" value="3000" />
    <property key="retry" value="2" />
    <parameter key="url" value="/my-url/" />
    <property key="max-ret-code" value="202" />
</protocol-plugin>

<!-- added to poller-configuration.xml -->
<service name="My Service" interval="300000" user-defined="false" status="on">
    <parameter key="port" value="80" />
    <parameter key="timeout" value="10000" />
    <parameter key="retry" value="3" />
    <parameter key="url" value="/my-url/" />
    <parameter key="ds-name" value="myService" />
</service>
<monitor service="Pootle" class-name="org.opennms.netmgt.poller.monitors.HttpMonitor" />

If capsd-configuration is changed (for example, to add properties to a protocol plugin to make sure it is only discovered on hosts actually running that service), it may be necessary to manually delete corresponding rows in ifservices (those that map the service to a particular interface).

...

Code Block
xml
xml
rocommunity public default .1
disk /

This sets the read only community name to public and gives it access to viewing the whole SNMP tree. This means that anyone who tries to connect to this computer and use the public community will be able to read any SNMP value on it.

...

Code Block
xml
xml
SNMPDRUN=yes
SNMPDOPTS='-Lsd -Lf /dev/null -u snmp -I -smux -p /var/run/snmpd.pid'

All done! Now try connecting to your server on the computer that is running OpenNMS by typing: snmpwalk -On -v 2c -c public SERVER system except replace SERVER with the ip address or hostname of the server where SNMP was just installed.

...

Code Block
xml
xml
<threshold type="high" ds-type="dskIndex" value="90.0"
        rearm="75.0" trigger="2" ds-label="ns-dskPath" ds-name="ns-dskPercent"/>

This mans means that if the ns-dskPercent exceeds 90, then an event will be made. If it goes back lower than 75, the threshold will be rearmed.

...

Code Block
xml
xml
<threshold type="high" ds-type="dskIndex" value="90.0"
        rearm="75.0" trigger="2" ds-label="ns-dskPath" ds-name="ns-dskPercent"
        triggeredUEI="uei.opennms.org/YOURCOMPANY/ns-dskPercent-high"
        rearmedUEI="uei.opennms.org/YOURCOMPANY/ns-dskPercent-rearm" />

Obviously, you will want to replace YOURCOMPANY with your company's name.

...

Code Block
xml
xml
<notification name="Disk Usage Too High" status="on" writeable="yes">
     <uei xmlns="">uei.opennms.org/YOURCOMPANY/ns-dskPercent-high</uei>
     <description xmlns="">The disk usage for a monitored device is too high.</description>
     <rule xmlns="">IPADDR != '0.0.0.0'</rule>
     <destinationPath xmlns="">Email-Admin</destinationPath>
     <text-message xmlns="">The disk usage on %parm[label]% on interface %interface% is too high.
         It is %parm[value]% percent full, which exceeds the high threshold of %parm[threshold]% percent.</text-message>
     <subject xmlns="">Notice #%noticeid%: The disk usage on %parm[label]% on interface %interface% is too high.</subject>
</notification>

You will have to replace YOURCOMPANY with your company's name.

...

Code Block
xml
xml
<notification name="Disk Usage Too High Rearmed" status="on" writeable="yes">
     <uei xmlns="">uei.opennms.org/YOURCOMPANY/ns-dskPercent-rearm</uei>
     <description xmlns="">A monitored device has recovered from a high disk usage</description>
     <rule xmlns="">IPADDR != '0.0.0.0'</rule>
     <destinationPath xmlns="">Email-Admin</destinationPath>
     <text-message xmlns="">Threshold rearmed for the disk usage for %parm[label]% on interface %interface.
        It was rearmed because the disk usage is less than or equal to the rearm threshold of %param[rearm]%.</text-message>
     <subject xmlns="">Notice #%noticeid%: Low Threshold Rearmed for %parm[ds]% on node %nodelabel%.</subject>
 </notification>

Modifying your notifd-configuration.xml file

...

Code Block
xml
xml
<auto-acknowledge resolution-prefix="RESOLVED: "
    uei="uei.opennms.org/YOURCOMPANY/ns-dskPercent-rearm" acknowledge="uei.opennms.org/YOURCOMPANY/ns-dskPercent-high">
    <match xmlns="">interfaceid</match>
</auto-acknowledge>

You will have to replace YOURCOMPANY with your company's name. This will tell it to make an email that has "RESOLVED" in the subject line when the interface of second event (the ns-dskPercent-rearm) matches interface that the first event (ns-dskPercent-high) was seen on.

...