Unable to receive SNMP TRAP alerts in Nagios core

Support forum for Nagios Core, Nagios Plugins, NCPA, NRPE, NSCA, NDOUtils and more. Engage with the community of users including those using the open source solutions.
Locked
debbie_d890
Posts: 1
Joined: Wed Oct 29, 2014 10:24 pm

Unable to receive SNMP TRAP alerts in Nagios core

Post by debbie_d890 »

Hi,

I am trying to monitor a linux server using Nagios Core. I have been able to receive the normal service alerts but failed to receive SNMP Trap alerts. Also, I can view the received traps in /var/log/messages as well as in /var/log/snmptt/snmptt.log. But the service TRAP is not turning to the WARNING state as it should be after receiving a trap.

I am in dire need of some help.

My services.cfg looks like this:

define service {
use generic-service
register 0
check_period 24x7
max_check_attempts 1
normal_check_interval 15
retry_check_interval 5
active_checks_enabled 1
passive_checks_enabled 1
parallelize_check 1
obsess_over_service 1
check_freshness 0
flap_detection_enabled 1
process_perf_data 1
retain_status_information 1
retain_nonstatus_information 1
notification_interval 315360000
notification_period 24x7
notification_options w,u,c,r
notifications_enabled 1
event_handler_enabled 1
is_volatile 1
}


define service {
use generic-service
name snmptrap-service1
register 0
service_description TRAP
is_volatile 1
check_command check-host-alive
flap_detection_enabled 0
process_perf_data 0
max_check_attempts 1
normal_check_interval 1
retry_check_interval 1
retry_check_interval 1
passive_checks_enabled 1
check_period 24x7
notification_interval 315360000
}

define service{
use snmptrap-service1
host_name XYZ
service_description TRAP
contact_groups admins
}

My hosts.cfg :

## Default Linux Host Template ##
define host{
name linux-box1 ; Name of this template
use generic-host ; Inherit default values
check_period 24x7
check_interval 5
retry_interval 1
max_check_attempts 10
check_command check-host-alive
notification_period 24x7
notification_interval 30
notification_options d,r
contact_groups admins
register 0 ; DONT REGISTER THIS - ITS A TEMPLATE
}

## Default
define host{
use linux-box1 ; Inherit default values
host_name XYZ ; The name we are giving to this server
alias xyz
address xxx.xxx.xxx.xxx
passive_checks_enabled 1
}

snmptt.conf

#
EVENT psAlarmNoDirectoryRequesterProtocolSpecified .1.3.6.1.4.1.23372.1.1.0.1000 "Status Events" Normal
FORMAT A psAlarmNoDirectoryRequesterProtocolSpecified trap $*
EXEC /usr/local/bin/snmptraphandling.py "$r" "SNMP Traps" "$s" "$@" "$-*" " A device has failed"
EXEC /usr/local/nagios/libexec/eventhandlers/submit_check_result $r TRAP 1 "A psAlarmNoDirectoryRequesterProtocolSpecified trap $*"
SDESC
A psAlarmNoDirectoryRequesterProtocolSpecified trap
signifies that no proper directory access protocol,
e.g. ldap, specified which result in unable to request
directory server
EDESC
#
#
#
EXEC /usr/local/nagios/libexec/eventhandlers/submit_check_result $r TRAP 1 "A psAlarmNoInitialContextFactorySpecified trap signifies $*"
SDESC
A psAlarmNoInitialContextFactorySpecified trap signifies
that no directory factory class specified, e.g.
com.sun.jndi.ldap.LdapCtxFactory
EDESC
#
#
#
EVENT psAlarmMalformedDirectoryURL .1.3.6.1.4.1.23372.1.1.0.1002 "Status Events" Normal
FORMAT A psAlarmMalformedDirectoryURL trap signifies that the $*
EXEC /usr/local/nagios/libexec/eventhandlers/submit_check_result $r TRAP 1 "A psAlarmMalformedDirectoryURL trap signifies that the $*"
SDESC
A psAlarmMalformedDirectoryURL trap signifies that the
directory access universal resource location is not
constructed properly
EDESC

........ etc.

snmptrapd.conf

traphandle default /usr/sbin/snmptt
disableAuthorization yes
donotlogtraps yes

~
/var/log/snmp/snmptt.log

hu Oct 30 11:17:57 2014 .1.3.6.1.4.1.23372.1.1.1000 Normal "Status Events" sstoresafe1 - A notifyNoDirectoryRequesterProtocolSpecified trap test is on
Thu Oct 30 11:17:57 2014 .1.3.6.1.4.1.23372.1.1.1000 Normal "Status Events" sstoresafe1 - A notifyNoDirectoryRequesterProtocolSpecified trap test is on
Thu Oct 30 11:17:57 2014 .1.3.6.1.4.1.23372.1.1.1000 Normal "Status Events" sstoresafe1 - A notifyNoDirectoryRequesterProtocolSpecified trap test is on
Thu Oct 30 11:17:57 2014 .1.3.6.1.4.1.23372.1.1.1000 Normal "Status Events" sstoresafe1 - A notifyNoDirectoryRequesterProtocolSpecified trap test is on
Thu Oct 30 11:17:57 2014 .1.3.6.1.4.1.23372.1.1.1000 Normal "Status Events" sstoresafe1 - A notifyNoDirectoryRequesterProtocolSpecified trap test is on
Thu Oct 30 11:17:57 2014 .1.3.6.1.4.1.23372.1.1.1000 Normal "Status Events" sstoresafe1 - A notifyNoDirectoryRequesterProtocolSpecified trap test is on
~
~
~
~
~
"snmptt.log" 6L, 91

Please any help to fix this would be appreciated. I cannot figure out where I am going wrong.
Thanks so much.
-D
User avatar
Box293
Too Basu
Posts: 5126
Joined: Sun Feb 07, 2010 10:55 pm
Location: Deniliquin, Australia
Contact:

Re: Unable to receive SNMP TRAP alerts in Nagios core

Post by Box293 »

If the traps are hitting the /var/log/snmp/snmptt.log then it is recognizing them.

Are the events being recorded in /usr/local/nagios/var/nagios.log ?

You might need to enable log_passive_checks=1 in nagios.cfg to get some more detail as to what is going on.
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
User avatar
rhassing
Posts: 416
Joined: Sat Oct 05, 2013 10:29 pm
Location: Netherlands

Re: Unable to receive SNMP TRAP alerts in Nagios core

Post by rhassing »

Could you also provide the output from 'grep -i snmptrap /var/log/messages' ?
Rob Hassing
Image
slansing
Posts: 7698
Joined: Mon Apr 23, 2012 4:28 pm
Location: Travelling through time and space...

Re: Unable to receive SNMP TRAP alerts in Nagios core

Post by slansing »

Thanks Troy and Rob! @debbie_d890, please let us know when you've got that information, thanks!
Locked