From OpenNMS
This tutorial intends to be a guide through the basic steps you should follow to configure thresholds for the latest version of OpenNMS 1.8.x and 1.10.x.
There are several thresholds defined that will work by default. But I’ll focus on creating the steps that must be followed for the worst scenario.
The basic idea is the following:
- Data collection must be enabled for the metrics that needs to monitored using thresholds.
- Create a threshold package inside threshd-configuration.xml to select the nodes/interfaces on which you are interested to apply the thresholds.
- Add a service definition to the package.
- Associate a set of thresholds to the service (i.e., a Threshold Group).
- Create or update the threshold group with the threshold definitions.
- Activate the thresholds for the service in question inside the configuration files of Collectd and/or Pollerd.
If any of the existing combination of package/group works in your use case, you usually must follow only step 5. This particular step is the only one that can be performed using the Web Interface
Contents |
Threshold Package
The threshold package must be defined on threshd-configuration.xml. Here is an example:
<package name="hrstorage">
<filter>IPADDR != '0.0.0.0' & (nodeSysOID LIKE '.1.3.6.1.4.1.311.%'
| nodeSysOID LIKE '.1.3.6.1.4.1.2.3.1.2.1.1.3.%')</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="hrstorage"/>
</service>
</package>
- What does that mean?
It means that the thresholds defined inside the thresholds group named hrstorage will be applied over all nodes that match the filter, and their IP address is included inside the range defined, for the SNMP service, assuming that the data is being collected every 5 minutes (interval=300000).
The interval must match the same interval used when defining data collection for the same service in collectd-configuration.xml
Threshold Group
The threshold group must be defined on thresholds.xml. Here is an example:
<group name="hrstorage" rrdRepository="/opt/opennms/share/rrd/snmp/">
<expression type="high" ds-type="hrStorageIndex" value="90.0"
rearm="75.0" trigger="2" ds-label="hrStorageDescr"
filterOperator="or" expression="hrStorageUsed / hrStorageSize * 100.0">
<resource-filter field="hrStorageType">^\.1\.3\.6\.1\.2\.1\.25\.2\.1\.4$</resource-filter>
</expression>
</group>
The group’s name is the string that must be used for the parameter named thresholding-group defined inside the threshold package on threshd-configuration.xml.
Thresholds Types
- High Threshold
- Low Threshold
- Absolute Change Threshold
- Relative Change Threshold
For more details about threshold type click Here.
- Any metric defined on any data collection configuration file can be used inside a threshold or expression definition.
- Any metric defined as counter on any data collection configuration file will be treated as a rate by the threshold processor. So, for example, ifInOctets should be considered as bytes per second, ifInPackets as packets per second, and so on.
Simple Thresholds
When it is desired to apply a threshold over a single metric, the threshold definition should look like the following:
<threshold type="high" ds-type="node" value="80.0" rearm="50.0" trigger="3" ds-label="" filterOperator="or" ds-name="avgBusy5"/>
The threshold processor checks a node's level resource metric called avgBusy5, and triggers an event when their value is equal or greater than 80.0 for 3 consecutive samples (trigger=3), and rearms the event when the value drops below 50.0.
Expression based Thresholds
When it is desired to apply a threshold over the result of a mathematical expression based on many metrics of the same type, the threshold definition should look like the following:
<expression type="high" ds-type="hrStorageIndex" value="90.0" rearm="75.0" trigger="2" ds-label="hrStorageDescr" filterOperator="or" expression="hrStorageUsed / hrStorageSize * 100.0"> <resource-filter field="hrStorageType">^\.1\.3\.6\.1\.2\.1\.25\.2\.1\.4$</resource-filter> </expression>
The threshold processor performs the calculation of the formula: hrStorageUsed / hrStorageSize * 100.0. When its value is greater than 90.0, an event is generated, and will be rearmed when the value drops below 75.0. This definition only applies for those resources which contains a value of 1.3.6.1.2.1.25.2.1.4 in thier hrStorageType (more on resource filters later).
Expression Parser
The only difference between OpenNMS 1.8.x and 1.10.x from the point of view of threshold processing is the engine used to parse the expressions.
- 1.8.X uses JEP (Java Expression Parser)
- 1.10.X uses Apache Commons JEXL (Java Expression Language)
Depending on the use case for threshold expressions and the OpenNMS version, it is recommended to review the documentation of the proper parser.
Resource Filters
These are filters that will be applied at resource’s level, and could be associated with any threshold definition in order to be selective over which resource should be considered when applying thresholds.
For example, take a look at the following filter:
<resource-filter field="hrStorageType">^\.1\.3\.6\.1\.2\.1\.25\.2\.1\.4$</resource-filter>
This means, apply the threshold definition only if the hrStorageType matches the regular expression.
- The filters are intended to be used on any Generic Index Resource and SNMP Interface resources. It does not make sense to apply resource filter at node’s level resources because this kind of filtering has already been done by the package’s filter.
- For generic resources, any metric defined as String on data collection configuration files can be used as a filter.
- For SNMP Interface resource (any resource associated with ifIndex), the above rule is still valid; but also any column from snmpinterface table could be also used.
It is possible to define multiple resource filters per threshold definition. The user must decide if the threshold must be applied when any of the filters must pass, or all of them must pass. This can be controlled using the parameter filterOperator inside the threshold/expression definition. It takes only two values: or, and. The filters are applied in the same order as they appear in the configuration files.
Reload configuration
If the thresholds are configured through the WebUI, OpenNMS will take care about reloading the configuration; but if the configuration were modified manually, the user must notify OpenNMS about the change, depending on which file has been modified by executing one of the following commands from from $OPENNMS_HOME/bin:
To instruct OpenNMS to reload threshold packages (when threhd-configuration.xml has been modified):
./send-event.pl -p ‘daemonName Threshd’ \ -p ‘configFile threshd-configuration.xml’ \ uei.opennms.org/internal/reloadDaemonConfig
NOTE: There is a button in the WebUI to do exactly the same as the above command.
To instruct OpenNMS to reload thresholds groups (when threholds.xml has been modified).
./send-event.pl -p ‘daemonName Threshd’ \ uei.opennms.org/internal/reloadDaemonConfig
Activate Thresholds for Collectd
To activate thresholds for data collection, the user must edit collectd-configuration.xml, find the proper service inside the proper package, and make sure that it contains a parameter named thresholding-enabled with the value of “true”, for example:
<service name="SNMP" interval="300000" user-defined="false" status="on"> <parameter key="collection" value="default"/> '''<parameter key="thresholding-enabled" value="true"/>''' </service>
Activate Thresholds for Pollerd
To activate thresholds for poller data, the user must edit poller-configuration.xml, find the proper service inside the proper package, and make sure that it contains a parameter named thresholding-enabled with the value of “true”, for example:
<service name="ICMP" interval="300000" user-defined="false" status="on"> <parameter key="retry" value="2"/> <parameter key="timeout" value="3000"/> <parameter key="rrd-repository" value="/opt/opennms/share/rrd/response"/> <parameter key="rrd-base-name" value="icmp"/> <parameter key="ds-name" value="icmp"/> <parameter key="thresholding-enabled" value="true"/> </service>
For more detailed information about thresholding please take a look at Thresholding.






