Commands used by SNMP Monitor
You use these commands in the snmpd.conf file to control monitoring and trap behavior:
cp_monitor
The cp_monitor command defines one monitoring rule.
cp_monitor <OID> <Operator> <Threshold> <Frequency> <Message>
|
When the rule expression is true, SNMP sends a message at the specified frequency until the expression evaluates back to false. At that point one or more clear traps are sent to indicate that the OID value is now within acceptable boundaries.
cp_monitor Parameter
|
Description
|
OID
|
Use standard OID notation. OID types supported are: Integer, String.
|
Operator
|
For OIDs of type Integer:
Use one of: !=,<,>,==
For OIDs of type String:
Use one of: !=, ==
|
Threshold
|
For OIDs of type Integer: an integer value
For OIDs of type String: a string enclosed within double quotes ""
|
Frequency
|
The polling interval in seconds, expressed as a positive integer.
The daemon polls each monitored OID at the specified interval.
|
Message
|
A text string that gives a description of the trap, which must be enclosed within double quotes.
|
Example:
cp_monitor 1.3.6.1.4.1.2021.4.6.0 < 2000 5 "memAvailReal"
cp_monitor 1.3.6.1.4.1.2620.1.5.6.0 != "active" 5 "Cluster State"
|
To make sure that the OID used in a cp_monitor command is correct, run snmpget to see if it returns a value. For example, if attempting to configure the above example cp_monitor "memAvailReal" line, then the run snmpget and make sure that it returns a value:
"snmpget -v 2c -c public localhost 1.3.6.1.4.1.2021.4.6.0"
|
cp_cleartrap
The optional cp_cleartrap command defines the number of clear traps to send and the interval between each one. SNMP sends clear traps when the OID value in a rule returns to its defined threshold.
cp_cleartrap <interval> <retries>
|
Default = three packets at 10 seconds intervals.
Parameter
|
Description
|
Interval
|
An integer indicating time between clear trap packets, in seconds.
|
Retries
|
An integer indicating number of clear trap packets to send.
|
trap2sink
The trap2sink command defines a host that receives traps.
trap2sink <sink-server>[:<port>] <community>
|
You must put a trap2sink command in the snmpd.conf file. This is because the snmpmonitor daemon sends SNMP v2c traps. This command is part of the net-snmp syntax.
trap_2_sink Parameter
|
Description
|
sink-server
|
A sink server for which traps are sent.
|
port
|
An optional (UDP) port number on which the server listens. The default is port 162.
|
community
|
An SNMP community.
|
Example:
trap2sink 192.0.2.10 public
trap2sink 192.0.2.10:1610 MyCommunity
|
|