Trap Integration not working

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
Locked
Iskon
Posts: 10
Joined: Tue Feb 09, 2016 5:00 am

Trap Integration not working

Post by Iskon »

Hi,

i've followed this tutorial

https://assets.nagios.com/downloads/nag ... ios_XI.pdf

I've managed to recieve traps and they are logged in

Code: Select all

/var/log/snmptt/snmptt.log
Mon Apr 25 16:30:22 2016 .1.3.6.1.6.3.1.1.5.3 Critical "Status Events" ncdev - Link down on interface eth2.  Admin state: $2.  Operational state: $3
But nagios critical state is not triggered and notifications aren't sent.

And service on that host in in state:

Code: Select all

SNMP TrapsPassive Only Check	Pending	N/A	1/1	N/A	No check results for service yet...
Part of config for that trap is:

Code: Select all

/etc/snmp/snmptt.conf
#
#
#
EVENT linkDown .1.3.6.1.6.3.1.1.5.3 "Status Events" Critical
FORMAT Link down on interface $1.  Admin state: $2.  Operational state: $3
#EXEC qpage -f TRAP notifygroup1  "Link down on interface $1.  Admin state: $2.  Operational state: $3"
SDESC
A linkDown trap signifies that the SNMP entity, acting in
an agent role, has detected that the ifOperStatus object for
one of its communication links is about to enter the down
state from some other state (but not from the notPresent
state).  This other state is indicated by the included value
of ifOperStatus.
EDESC
#
#
#
I'm sending traps from ncdev (another server) to nagios xi server with cmd:

Code: Select all

snmptrap -v 2c -c public <nagioserverip> '' .1.3.6.1.6.3.1.1.5.3 .1.3.6.1.6.3.1.1.5.3 s "eth2"
Please let me know if additional info is needed.
gormank
Posts: 1114
Joined: Tue Dec 02, 2014 12:00 pm

Re: Trap Integration not working

Post by gormank »

Make sure traps are arriving.
tcpdump -i eth2 -s 0 port 162
Make sure you're listening.
netstat -an | grep ":162 "
ps -ef | grep -e snmptrapd -e snmptt | grep -v grep
Check the syslog to see if traps are processed by snmptrapd.
Check the snmptt.log to see if snmptt is getting traps from snmptrapd.
Check if iptables is running and blocking traps. Easiest is to just stop it...
User avatar
tgriep
Madmin
Posts: 9190
Joined: Thu Oct 30, 2014 9:02 am

Re: Trap Integration not working

Post by tgriep »

In your example, you are missing the EXEC line for that OID and that is why it is not getting in to the XI interface.
When the snmptt daemon matches the OID of a received trap, it will execute the EXEC line which puts it in to XI.
Try adding the following line to that OID and see if it works for you.

Code: Select all

EXEC /usr/local/bin/snmptraphandling.py "$r" "SNMP Traps" "$s" "$@" "$-*" "Link down on interface $1.  Admin state: $2.  Operational state: $3"
You may need to adjust the options for your needs.
Be sure to check out our Knowledgebase for helpful articles and solutions!
Iskon
Posts: 10
Joined: Tue Feb 09, 2016 5:00 am

Re: Trap Integration not working

Post by Iskon »

ah...:(
from docs:

Code: Select all

EXEC:

[EXEC command_string]
There can be multiple EXEC lines per EVENT.

Optional string containing a command to execute when trap is received and arguments to pass to the program.  The EXEC lines are executed in the order that they appear.
So it didn't occur to me that EXEC must be defined.

Thx tgriep, it works now.
User avatar
tgriep
Madmin
Posts: 9190
Joined: Thu Oct 30, 2014 9:02 am

Re: Trap Integration not working

Post by tgriep »

Your Welcome.
FYI, if you use the addmib application or in the XI GUI, you upload the MIB file with the Process Trap box checked, it will automatically add the EXEC line in the config file for you.
Be sure to check out our Knowledgebase for helpful articles and solutions!
Iskon
Posts: 10
Joined: Tue Feb 09, 2016 5:00 am

Re: Trap Integration not working

Post by Iskon »

Thx, for the info.
Locked