SNMP trap sender not working on 162/UDP port,

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
srikgali
Posts: 46
Joined: Thu Apr 07, 2016 9:18 am

SNMP trap sender not working on 162/UDP port,

Post by srikgali »

Hallo,

SNMP trap sender is not working on 162/UDP port, but if I check TCP( on snmp trap sender component), then it is working. Anyone has any idea?
I have followed below nagios Xi documentation for sending traps from nagios xi.
https://assets.nagios.com/downloads/nag ... ios_XI.pdf

we have checked that 162/UDP port opened on network side, SNMP traps are working with 162/UDP port if i use snmptrap command but not with nagios snmp trapsender component.
User avatar
lmiltchev
Bugs find me
Posts: 13589
Joined: Mon May 23, 2011 12:15 pm

Re: SNMP trap sender not working on 162/UDP port,

Post by lmiltchev »

What is the Nagios XI and the "SNMP Trap Sender" version that you are currently using?

Try troubleshooting by following the steps, outlined in our "SNMP Trap - Inbound UDP Traffic" KB article:
https://support.nagios.com/kb/article.php?id=86

Let us know if this helped.
Be sure to check out our Knowledgebase for helpful articles and solutions!
srikgali
Posts: 46
Joined: Thu Apr 07, 2016 9:18 am

Re: SNMP trap sender not working on 162/UDP port,

Post by srikgali »

Thanks you for your reply, Nagios XI 2014R2.7 and We have below snmp filesets installed
net-snmp-5.5-57.el6.x86_64
perl-SNMP_Session-1.12-4.el6.noarch
perl-Net-SNMP-5.2.0-4.el6.noarch
net-snmp-libs-5.5-57.el6.x86_64
net-snmp-utils-5.5-57.el6.x86_64
net-snmp-devel-5.5-57.el6.x86_64
php-snmp-5.3.3-27.el6_5.1.x86_64

I hope shared link is giving instructions about inbound traffic, but we need to monitor outbound traffic. anyway I have installed tcpdump on my centos(6.5).
if I give below command, this is working, but not working on snmp sender component.
snmptrap -v 1 -c public <external management ip> .1.3.6.1.2.1.1 <server IP> 6 7 100
srikgali
Posts: 46
Joined: Thu Apr 07, 2016 9:18 am

Re: SNMP trap sender not working on 162/UDP port,

Post by srikgali »

Sorry I gave you snmp version, snmp trap sender version in nagios xi is 1.5.2
gormank
Posts: 1114
Joined: Tue Dec 02, 2014 12:00 pm

Re: SNMP trap sender not working on 162/UDP port,

Post by gormank »

The tcpdump commands in the link in the post above will show you if the packets are arriving at the other end...

Here's the trap command in /usr/local/nagiosxi/html/includes/components/snmptrapsender/snmptrapsender.inc.php on line 420 in my version.

$trap_command = "/usr/bin/snmptrap -v 2c -c $community $tcp$address$port '' NAGIOS-NOTIFY-MIB::nSvcEvent nSvcHostname s \"%host%\" nSvcDesc s \"%service%\" nSvcStateID i %servicestateid% nSvcOutput s \"%serviceoutput%\"";

You could create a backup of and add logging: -L /path/snmptraps.log.
User avatar
tgriep
Madmin
Posts: 9190
Joined: Thu Oct 30, 2014 9:02 am

Re: SNMP trap sender not working on 162/UDP port,

Post by tgriep »

Thanks gormank for the tips.
Another thing to try is when you want to test UDP, make sure the box is unchecked and that the port field is empty.
Make sure there are not any hidden characters on that field. See if that helps.
Be sure to check out our Knowledgebase for helpful articles and solutions!
srikgali
Posts: 46
Joined: Thu Apr 07, 2016 9:18 am

Re: SNMP trap sender not working on 162/UDP port,

Post by srikgali »

Thanks gormank, I have tried to keep logfile and still it is not logging. ( f is used in below command after -L to specify the file name)

$trap_command = "/usr/bin/snmptrap -v 1 -Lf /var/log/snmptraps.log -c $community $tcp$address$port '' NAGIOS-NOTIFY-MIB::nSvcEvent nSvcHostname s \"%host%\" nSvcDesc s \"%service%\" nSvcStateID i %servicestateid% nSvcOutput s \"%serviceoutput%\"";



Tgriep: - I have tested this already with unchecked and port field is empty. that was not working. Traps are going if I use snmptrap command manually from Linux command line not with nagios tarp sender component.
User avatar
tgriep
Madmin
Posts: 9190
Joined: Thu Oct 30, 2014 9:02 am

Re: SNMP trap sender not working on 162/UDP port,

Post by tgriep »

Can you run the following commands on the XI server and post the output here?

Code: Select all

echo "select value from xi_options where name = 'snmptrapsender_component_options';" | mysql -pnagiosxi nagiosxi
echo "select value from xi_options where name = 'snmptrapsender_component_options';" | psql nagiosxi nagiosxi
This will show the settings for the SNMPTrapsender.
Don't worry that one of the commands fail, older XI servers use Postgresql as the database and newer system use MYSQL, that is why I posted both.
Be sure to check out our Knowledgebase for helpful articles and solutions!
srikgali
Posts: 46
Joined: Thu Apr 07, 2016 9:18 am

Re: SNMP trap sender not working on 162/UDP port,

Post by srikgali »

Below is the output
[root@<host name> ~]# echo "select value from xi_options where name = 'snmptrapsender_component_options';" | mysql -pnagiosxi nagiosxi
ERROR 1049 (42000): Unknown database 'nagiosxi'
[root@<host name> ~]# echo "select value from xi_options where name = 'snmptrapsender_component_options';" | psql nagiosxi nagiosxi
value
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
a:2:{s:7:"enabled";i:1;s:10:"trap_hosts";a:1:{i:0;a:7:{s:7:"address";s:13:"<SNMP manager ip removed>";s:4:"port";s:0:"";s:3:"tcp";s:1:"1";s:9:"community";s:6:"public";s:11:"hoststateid";s:1:"0";s:14:"servicestateid";s:1:"0";s:9:"statetype";s:4:"BOTH";}}}
(1 row)
srikgali
Posts: 46
Joined: Thu Apr 07, 2016 9:18 am

Re: SNMP trap sender not working on 162/UDP port,

Post by srikgali »

When I use Uncheck TCP BOX, I am getting below output. which is not working( with UDP).

[root@<Hostname> ~]# echo "select value from xi_options where name = 'snmptrapsender_component_options';" | psql nagiosxi nagiosxi
value
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
a:2:{s:7:"enabled";i:1;s:10:"trap_hosts";a:1:{i:0;a:6:{s:7:"address";s:13:":"<SNMP manager ip removed>";s:4:"port";s:0:"";s:9:"community";s:6:"public";s:11:"hoststateid";s:1:"0";s:14:"servicestateid";s:1:"0";s:9:"statetype";s:4:"BOTH";}}}
(1 row)
Locked