|
Creating Thresholds via Threshold.conf
The configuration file Theshold.conf contains the entries for ThresholdObjects. Thresholds can be defined in this file before Web NMS Server is started. Find below sample entries for all the three types of thresholds:
|
<THRESHOLD_CONF>
<THRESHOLD name="IfInOctet-critical" kind="long" severity="1" category="Threshold" thresholdType="Max" thresholdValue="20000" rearmValue="18000" message="Threshold exceeded" clrMessage="Threshold reset" sendClear="true"/>
<THRESHOLD name="sysuptime-critical" kind="string" allowed="router1,router2" disAllowed="router5" category="Threshold" message="Threshold exceeded" triggerSeverity="1" resetSeverity="5" clrMessage="Threshold reset" />
<THRESHOLD name="avergeinout-critical" kind="percentage" oid="2.2.1.16.1" oidType="node" severity="1" category="Threshold" thresholdType="Max" thresholdValue="60" rearmValue="55" message="Threshold exceeded" clrMessage="Threshold reset" sendClear="true" />
</THRESHOLD_CONF> |
The properties listed in the definition indicates the Threshold value, message to be displayed when threshold is exceeded, etc.
|
|
Note:
|
Severity Constants
The Severity levels used for Threshold events are predefined and their corresponding integer values are given below. You have to use this value while specifying the severity in Threshold.conf. These values are defined in SeverityInfo.conf file.
| Severity Constant |
Value |
|---|---|
|
Critical |
1 |
|
Major |
2 |
|
Minor |
3 |
|
Warning |
4 |
|
Clear |
5 |
|
Info |
6 |
|
Unknown |
0 |
|
|
Note: Thresholds created via User Interface are added to Threshold.conf. Hence when you reinitialize the database thus performing a cold start, Thresholds are recreated based on the definitions in Threshold.conf. |
Import the file Threshold.conf from <Web NMS Home>/conf directory into the Eclipse Project. Open the file in the project. Edit the file and click Save to save the changes.
Refer the section Working with Files in Eclipse Guide for more details on how to import WebNMS configuration Files to Eclipse.
To create a ThresholdObject, you have to instantiate the class ThresholdObject. Set the properties
of threshold and finally add the object in database using PollAPI
method addThresholdObject().
|
PollAPI pollapi = (PollAPI)NmsUtil.getAPI("PollAPI"); ... ... ThresholdObject to = new ThresholdObject("Ifspeedmajor"); to.setKind("long"); to.setCategory("Threshold"); to.setThresholdType("max"); to.setSeverity(2); to.setThresholdValue(10000); to.setRearmValue(8000); to.setSendClearStatus(true);
pollapi.addThresholdObject(to); |
ThresholdObjects can be managed using following methods of PollAPI:
| Method |
Description |
|---|---|
|
modifyThresholdObject |
Provides the modified ThresholdObject as input and it will be updated in the database. |
|
deleteThresholdObject |
Provides the Threshold name and it will be removed from the database. Its association with the PolledData will be automatically broken. |
|
getThreshHashOfOid |
Returns a Hashtable containing names of ThresholdObjects associated with OIDs. In this Hashtable, Vector of Threshold Object names are stored against PollingObject name+oid name. |
|
getAllThresholdObjects |
Returns a Vector containing all available ThresholdObjects. |
Using Special Characters for String Threshold
While configuring String Threshold, a range of values can be specified and special characters can be used. Say a Counter64 variable is being returned by the agent as an Octet String to which thresholds have to be associated. In this case long threshold cannot be associated with the same, since the collected data is of String type. In this case, you can associate a String threshold with between - and criteria and can check whether the value is between the specified range.
The range of values can be specified as follows:
disAllowed = "<between>100and200"
allowed = "<between>1and100"
In addition to specifying the range, special characters such as "!", "*", can also be used.
disAllowed = "s*" starts with s.
disAllowed = "!s*" does not start with s.
disAllowed = "*s" ends with s.
disAllowed = "s*v" starts with s and ends with v.
|