Hi Phyo,
I've already sent you this information via our ticketing system but I wanted to also post it here as the solution will be helpful to others.
I have worked out how to make the service state change on the SNMP Receiving Nagios XI server.
Basically we need to create an EVENT for each state type and a MATCH statement so it know which EVENT to use.
Here is a link to the documentation from which I was able to find your solution:
http://snmptt.sourceforge.net/docs/snmp ... ile-format
Below is taken from the test system I setup to re-create your testing scenario.
Hosts:
In the smnptt.conf file you need to create two identical EVENTs with a corresponding MATCH statement so it will use this trap when the host state 0 or 1 is received.
The only difference in each three events is the 1st and 4th lines:
"Host Up"
EVENT nHostEvent .1.3.6.1.4.1.20006.1.5 "Status Events" Normal
MATCH $2: 0
"Host Down or Unreachable"
EVENT nHostEvent .1.3.6.1.4.1.20006.1.5 "Status Events" Critical
MATCH $2: 1
Code: Select all
EVENT nHostEvent .1.3.6.1.4.1.20006.1.5 "Status Events" Normal
FORMAT The SNMP trap that is generated as a result of an event with the host $*
EXEC /usr/local/bin/snmptraphandling.py "$r" "SNMP Traps" "$s" "$@" "$-*" "The SNMP trap that is generated as a result of an event with the host $*"
MATCH $2: 0
SDESC
The SNMP trap that is generated as a result of an event with the host
in Nagios.
Variables:
1: nHostname
2: nHostStateID
3: nHostStateType
4: nHostAttempt
5: nHostDurationSec
6: nHostGroupName
7: nHostLastCheck
8: nHostLastChange
9: nHostOutput
EDESC
#
#
#
EVENT nHostEvent .1.3.6.1.4.1.20006.1.5 "Status Events" Critical
FORMAT The SNMP trap that is generated as a result of an event with the host $*
EXEC /usr/local/bin/snmptraphandling.py "$r" "SNMP Traps" "$s" "$@" "$-*" "The SNMP trap that is generated as a result of an event with the host $*"
MATCH $2: 1
SDESC
The SNMP trap that is generated as a result of an event with the host
in Nagios.
Variables:
1: nHostname
2: nHostStateID
3: nHostStateType
4: nHostAttempt
5: nHostDurationSec
6: nHostGroupName
7: nHostLastCheck
8: nHostLastChange
9: nHostOutput
EDESC
Services:
In the smnptt.conf file you need to create four identical EVENTs with a corresponding MATCH statement so it will use this trap when the service state 0, 1, 2 or 3 is received.
The only difference in each three events is the 1st and 4th lines:
"Ok State"
EVENT nSvcEvent .1.3.6.1.4.1.20006.1.7 "Status Events" Normal
MATCH $3: 0
"Warning State"
EVENT nSvcEvent .1.3.6.1.4.1.20006.1.7 "Status Events" Warning
MATCH $3: 1
"Critical State"
EVENT nSvcEvent .1.3.6.1.4.1.20006.1.7 "Status Events" Critical
MATCH $3: 2
"Unknown State"
EVENT nSvcEvent .1.3.6.1.4.1.20006.1.7 "Status Events" Critical
MATCH $3: 3
Code: Select all
EVENT nSvcEvent .1.3.6.1.4.1.20006.1.7 "Status Events" Normal
FORMAT The SNMP trap that is generated as a result of an event with the service $*
EXEC /usr/local/bin/snmptraphandling.py "$r" "SNMP Traps" "$s" "$@" "$-*" "The SNMP trap that is generated as a result of an event with the service $*"
MATCH $3: 0
SDESC
The SNMP trap that is generated as a result of an event with the service
in Nagios.
Variables:
1: nHostname
2: nHostStateID
3: nSvcDesc
4: nSvcStateID
5: nSvcAttempt
6: nSvcDurationSec
7: nSvcGroupName
8: nSvcLastCheck
9: nSvcLastChange
10: nSvcOutput
EDESC
#
#
#
EVENT nSvcEvent .1.3.6.1.4.1.20006.1.7 "Status Events" Warning
FORMAT The SNMP trap that is generated as a result of an event with the service $*
EXEC /usr/local/bin/snmptraphandling.py "$r" "SNMP Traps" "$s" "$@" "$-*" "The SNMP trap that is generated as a result of an event with the service $*"
MATCH $3: 1
SDESC
The SNMP trap that is generated as a result of an event with the service
in Nagios.
Variables:
1: nHostname
2: nHostStateID
3: nSvcDesc
4: nSvcStateID
5: nSvcAttempt
6: nSvcDurationSec
7: nSvcGroupName
8: nSvcLastCheck
9: nSvcLastChange
10: nSvcOutput
EDESC
#
#
#
EVENT nSvcEvent .1.3.6.1.4.1.20006.1.7 "Status Events" Critical
FORMAT The SNMP trap that is generated as a result of an event with the service $*
EXEC /usr/local/bin/snmptraphandling.py "$r" "SNMP Traps" "$s" "$@" "$-*" "The SNMP trap that is generated as a result of an event with the service $*"
MATCH $3: 2
SDESC
The SNMP trap that is generated as a result of an event with the service
in Nagios.
Variables:
1: nHostname
2: nHostStateID
3: nSvcDesc
4: nSvcStateID
5: nSvcAttempt
6: nSvcDurationSec
7: nSvcGroupName
8: nSvcLastCheck
9: nSvcLastChange
10: nSvcOutput
EDESC
#
#
#
EVENT nSvcEvent .1.3.6.1.4.1.20006.1.7 "Status Events" Critical
FORMAT The SNMP trap that is generated as a result of an event with the service $*
EXEC /usr/local/bin/snmptraphandling.py "$r" "SNMP Traps" "$s" "$@" "$-*" "The SNMP trap that is generated as a result of an event with the service $*"
MATCH $3: 3
SDESC
The SNMP trap that is generated as a result of an event with the service
in Nagios.
Variables:
1: nHostname
2: nHostStateID
3: nSvcDesc
4: nSvcStateID
5: nSvcAttempt
6: nSvcDurationSec
7: nSvcGroupName
8: nSvcLastCheck
9: nSvcLastChange
10: nSvcOutput
EDESC