Page 1 of 1

SNMP Traps - Can't get description in email alert

Posted: Thu Feb 28, 2019 11:06 am
by 00_kl250
Hey All,

I'm having issues with SNMP traps and alerting properly, particularity with the event description not being passed in the alert message. Traps are coming in fine to nagios and i'm getting the alert, but i'm getting an alert message in email and the nagios web interface that says:

***** Nagios *****

Notification Type: PROBLEM

Service: TRAP
Host: xxxx
Address: xxxxxx
State: WARNING

Date/Time: Thu Feb 28 09:20:25 CST 2019

Additional Info:

notAlarmedNonServiceAffecting Object:ne Index:1 Slot:0 Port:unknown AID:SYSTEM

However, when looking at the snmptt.log it shows the following:


Thu Feb 28 09:20:19 2019 logoutOfUser Normal "Status Events" [xxhostnamexx] - notAlarmedNonServiceAffecting Object:ne Index:1 Slot:0 Port:unknown AID:SYSTEM


Question:
1). How do i get it to pass the "logoutOfUser" instead of everything after the hostname? The not notAlarmedNonServiceAffecting part really isn't helpful to me.

I've been beating my head around the bush for the past couple of days to get to this point but need some help if anyone has ideas. Thank you in advance!

Re: SNMP Traps - Can't get description in email alert

Posted: Fri Mar 01, 2019 2:14 pm
by cdienger
If you look in this file you probably have something similar to:

Code: Select all

EVENT logoutOfUser .1.3.6.1.4.1.18372... "Status Events" Normal
FORMAT ...
EXEC /usr/local/bin/snmptraphandling.py "$r" "SNMP Traps" "$s" "$@" "$-*" "... $*"
SDESC
...
Variables:
...
EDESC
logoutOfUser is likely the event name defined in /etc/snmptt.ini. The EXEC line determines what is sent to Nagios and I think adding $N(event name) will do the trick.

EXEC /usr/local/bin/snmptraphandling.py "$r" "SNMP Traps" "$s" "$@" "$-*" "$N: ... $*"

More info - including variables - on snmptt: http://snmptt.sourceforge.net/docs/snmp ... ile-format

Re: SNMP Traps - Can't get description in email alert

Posted: Tue Mar 26, 2019 6:58 am
by 00_kl250
Thank you, this did the trick!

Re: SNMP Traps - Can't get description in email alert

Posted: Tue Mar 26, 2019 10:40 am
by scottwilkerson
00_kl250 wrote:Thank you, this did the trick!
Great!

Locking thread