TRAP is a notification element, that sends trap message (Trap-PDU) from the monitoring system (agent) to the network management base station (SNMP manager).
Trap element supports the formation of SNMP trap messages ver. 1 and 2c.
Trap element is meaningful only in conjunction with the mechanism of the logic of the monitoring system, that means, if the Trap is not included in any of the existing logic, then an element Trap will not generate and send trap messages.
Managing Traps
To create a Trap go to field ctlTrapRowStatus of сtlTrapsTable table. When you install ctlTrapRowStatus in a state CreateAndWait(5) a new note is created in сtlTrapsTable table.
After creating a Trap you must specify the trap destination address in a field ctlTrapServer, destination port ctlTrapPort (default 162), version of the trap message ctlTrapVersion ("1" - ver. 1, "2" - ver. 2с), community ctlTrapCommunity.
As soon as you set up all the required parameters, you need to move field ctlTrapRowStatus in state active(1) and complete the installation of the Trap.
To create a Trap you can also set once all the fields in the table and move an element into an active state by setting the field ctlTrapRowStatus in state CreateAndGo(4)
To remove a Trap it is sufficient to move field ctlTrapRowStatus in state destroy(6).
Example. Creating, editing, checking and removing the item Trap
Reading Traps table:
$ snmptable -Ci -Cb -v2c -cread 192.168.0.193 VUTLAN-SYSTEM-MIB::ctlTrapsTable
SNMP table: VUTLAN-SYSTEM-MIB::ctlTrapsTable index ID ElementID Server Port Version Community Value RowStatus 0 0 301 "192.168.0.10" 162 "1" "public" "off" active
Create new Trap in table:
$ snmpset -v2c -cwrite 192.168.0.193 VUTLAN-SYSTEM-MIB::ctlTrapServer.1 s "host" \ VUTLAN-SYSTEM-MIB::ctlTrapVersion.1 s "1" \ VUTLAN-SYSTEM-MIB::ctlTrapCommunity.1 s "secret" \ VUTLAN-SYSTEM-MIB::ctlTrapRowStatus.1 i createAndGo
VUTLAN-SYSTEM-MIB::ctlTrapServer.1 = STRING: "host" VUTLAN-SYSTEM-MIB::ctlTrapVersion.1 = STRING: "1" VUTLAN-SYSTEM-MIB::ctlTrapCommunity.1 = STRING: "secret" VUTLAN-SYSTEM-MIB::ctlTrapRowStatus.1 = INTEGER: createAndGo(4)
Reading Traps table:
$ snmptable -Ci -Cb -v2c -cread 192.168.0.193 VUTLAN-SYSTEM-MIB::ctlTrapsTable
SNMP table: VUTLAN-SYSTEM-MIB::ctlTrapsTable index ID ElementID Server Port Version Community Value RowStatus 0 0 301 "192.168.0.10" 162 "1" "public" "off" active 1 1 302 "host" 162 "1" "secret" "off" active
Test - send a test trap messages for the newly created Trap element:
$ snmpset -v2c -cwrite 192.168.0.193 VUTLAN-SYSTEM-MIB::ctlTrapValue.1 s "on"
VUTLAN-SYSTEM-MIB::ctlTrapValue.1 = STRING: "on"
If the settings are correct, the trap message must be delivered to the SNMP manager
Removing Trap element:
$ snmpset -v2c -cwrite 192.168.0.193 VUTLAN-SYSTEM-MIB::ctlTrapRowStatus.1 i destroy
VUTLAN-SYSTEM-MIB::ctlTrapRowStatus.1 = INTEGER: destroy(6)
Description line of trap-message
When sending a trap message description line is formed in the body:
"Trap (name: <name>, ID: <id>) was worked"
where:
- <name> - Trap element name in field ctlAllElementName of ctlAllElementsTable table;;
- <id> - Trap element ID in field ctlAllElementID of ctlAllElementsTable table;
Trap name can be changed in table ctlAllElementsTable