TRAP is a notification element, that sends a trap message (Trap-PDU) from the monitoring system (agent) to the network management base station (SNMP manager).
Trap The trap element supports the formation of SNMP trap messages ver. 1, 2c, and 2c3.
Info |
---|
WarningTrap 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:
Code Block |
---|
$ snmptable -Ci -Cb -v2c -cread 192.168.0.193 SKYCONTROL-SYSTEM-MIB::ctlTrapsTable |
Code Block | ||
---|---|---|
| ||
SNMP table: SKYCONTROL-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:
Code Block | ||
---|---|---|
| ||
$ snmpset -v2c -cwrite 192.168.0.193 SKYCONTROL-SYSTEM-MIB::ctlTrapServer.1 s "host" \
SKYCONTROL-SYSTEM-MIB::ctlTrapVersion.1 s "1" \
SKYCONTROL-SYSTEM-MIB::ctlTrapCommunity.1 s "secret" \
SKYCONTROL-SYSTEM-MIB::ctlTrapRowStatus.1 i createAndGo |
Code Block | ||
---|---|---|
| ||
SKYCONTROL-SYSTEM-MIB::ctlTrapServer.1 = STRING: "host"
SKYCONTROL-SYSTEM-MIB::ctlTrapVersion.1 = STRING: "1"
SKYCONTROL-SYSTEM-MIB::ctlTrapCommunity.1 = STRING: "secret"
SKYCONTROL-SYSTEM-MIB::ctlTrapRowStatus.1 = INTEGER: createAndGo(4) |
Reading Traps table:
Code Block |
---|
$ snmptable -Ci -Cb -v2c -cread 192.168.0.193 SKYCONTROL-SYSTEM-MIB::ctlTrapsTable |
Code Block | ||
---|---|---|
| ||
SNMP table: SKYCONTROL-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:
Code Block |
---|
$ snmpset -v2c -cwrite 192.168.0.193 SKYCONTROL-SYSTEM-MIB::ctlTrapValue.1 s "on" |
Code Block |
---|
SKYCONTROL-SYSTEM-MIB::ctlTrapValue.1 = STRING: "on" |
If the settings are correct, the trap message must be delivered to the SNMP manager
Removing Trap element:
Code Block |
---|
$ snmpset -v2c -cwrite 192.168.0.193 SKYCONTROL-SYSTEM-MIB::ctlTrapRowStatus.1 i destroy |
Code Block |
---|
SKYCONTROL-SYSTEM-MIB::ctlTrapRowStatus.1 = INTEGER: destroy(6) |
Description line of trap-message
When sending a trap message description line is formed in the body:
Code Block |
---|
"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
It is possible to create, configure, and delete Trap elements only via the web interface. See the documentation for more details: SNMP Traps notification.
Trap string description line
When the user sends a trap message, a trap string description is formed, for example:
Code Block |
---|
Trap (name: trap_1, ID: 602001) was worked. Time: 10: 40: 32 2016/11/19 Logic: 'Logic_1', Element: 'Onboard Temperature', in state: 'high alarm', value: '25.00' |
where:
trap_1 - trap element name;
602001 - trap element ID.
You can change the name of the Trap element in the table ctlNotifiers.ctlNotifiersTrapsTable.ctlNotifiersTrapsEntry or in the system web interface.
In addition, the following variables are passed in the message body:
Variables | Description |
---|---|
.1 | Description of the logic scheme that has triggered |
.2 | Readings of sensors in the logic scheme |
.3 | Logic scheme response time |
.4 | Name of the logic scheme |
.5 | Name of the sensor whose state led to the triggering of the logic circuit |
.6 | The state of the sensor that triggered the operation of the logic circuit |
.7 | The value measured by the sensor or the logic level |
.8 | The ID of the sensor that triggered the logic circuit |
.20 | The ID of the SNMP trap |
.21 | Name of the SNMP trap |
Example of the contents of the received trap:
...