Page 1 of 2
SNMP trap sender not working on 162/UDP port,
Posted: Fri Jun 24, 2016 2:10 pm
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.
Re: SNMP trap sender not working on 162/UDP port,
Posted: Mon Jun 27, 2016 9:51 am
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.
Re: SNMP trap sender not working on 162/UDP port,
Posted: Mon Jun 27, 2016 10:07 am
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
Re: SNMP trap sender not working on 162/UDP port,
Posted: Mon Jun 27, 2016 10:14 am
by srikgali
Sorry I gave you snmp version, snmp trap sender version in nagios xi is 1.5.2
Re: SNMP trap sender not working on 162/UDP port,
Posted: Mon Jun 27, 2016 10:44 am
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.
Re: SNMP trap sender not working on 162/UDP port,
Posted: Mon Jun 27, 2016 4:04 pm
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.
Re: SNMP trap sender not working on 162/UDP port,
Posted: Tue Jun 28, 2016 8:54 am
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.
Re: SNMP trap sender not working on 162/UDP port,
Posted: Tue Jun 28, 2016 1:27 pm
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.
Re: SNMP trap sender not working on 162/UDP port,
Posted: Tue Jun 28, 2016 1:38 pm
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)
Re: SNMP trap sender not working on 162/UDP port,
Posted: Tue Jun 28, 2016 3:00 pm
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)