How to remove SNMP trap destination IP via command line

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.
babygen
Posts: 7
Joined: Tue Jun 04, 2013 10:59 pm

Re: How to remove SNMP trap destination IP via command line

Post by babygen »

Hi,
Below is the sample trap. Nagios sends to 192.168.10.188 (NM1) and .189 (NM2).
I need to remove .189. Is there a standard script or file where I can remove this? Thank you.

==========================start ================
event_id = 642667
event_source = 2
event_type = 1
event_time = 2013-02-28 11:22:42
event_meta = Array
==========================start ================
192.168.10.188
public
/usr/bin/snmptrap -v 2c -c public 192.168.10.188 '' NAGIOS-NOTIFY-MIB::nSvcNotify nSvcNotifyType s "%type%" nSvcNotifyNum i %servicenot
ificationnumber% nSvcAckAuthor s "%ackAuthor%" nSvcAckComment s "%svcackcomment%" nHostname s "%host%" nHostStateID i %hoststateid%
nSvcDesc s "%service%" nSvcStateID i %servicestateid% nSvcAttempt i %currentattempt% nSvcDurationSec i %servicedurationsec% nSvcGroupNa
me s "%servicegroupname%" nSvcLastCheck i %lastservicecheck% nSvcLastChange i %lastservicestatechange% nSvcOutput s "%service% %servi
cestate% %serviceoutput%"
handler-type = service
Processes Command
/usr/bin/snmptrap -v 2c -c public 192.168.10.188 '' NAGIOS-NOTIFY-MIB::nSvcNotify nSvcNotifyType s "" nSvcNotifyNum i 1 nSvcAckAuthor
s "" nSvcAckComment s "" nHostname s "TS-03" nHostStateID i 0 nSvcDesc s "RAM Status" nSvcStateID i 1 nSvcAttempt i 3 nSvcD
urationSec i 659 nSvcGroupName s "$" nSvcLastCheck i 1362021729 nSvcLastChange i 1362021103 nSvcOutput s "RAM Status WARNING RAM WARN
ING - 73% (6094 of 8257 MB) used"

==========================end ================

==========================start ================
192.168.10.189
public
/usr/bin/snmptrap -v 2c -c public 192.168.10.189 '' NAGIOS-NOTIFY-MIB::nSvcNotify nSvcNotifyType s "%type%" nSvcNotifyNum i %servicenot
ificationnumber% nSvcAckAuthor s "%ackAuthor%" nSvcAckComment s "%svcackcomment%" nHostname s "%host%" nHostStateID i %hoststateid%
nSvcDesc s "%service%" nSvcStateID i %servicestateid% nSvcAttempt i %currentattempt% nSvcDurationSec i %servicedurationsec% nSvcGroupNa
me s "%servicegroupname%" nSvcLastCheck i %lastservicecheck% nSvcLastChange i %lastservicestatechange% nSvcOutput s "%service% %servi
cestate% %serviceoutput%"
handler-type = service
Processes Command
/usr/bin/snmptrap -v 2c -c public 192.168.10.189 '' NAGIOS-NOTIFY-MIB::nSvcNotify nSvcNotifyType s "" nSvcNotifyNum i 1 nSvcAckAuthor
s "" nSvcAckComment s "" nHostname s "TS-03" nHostStateID i 0 nSvcDesc s "RAM Status" nSvcStateID i 1 nSvcAttempt i 3 nSvcD
urationSec i 659 nSvcGroupName s "$" nSvcLastCheck i 1362021729 nSvcLastChange i 1362021103 nSvcOutput s "RAM Status WARNING RAM WARN
ING - 73% (6094 of 8257 MB) used"

==========================end ================
sreinhardt
-fno-stack-protector
Posts: 4366
Joined: Mon Nov 19, 2012 12:10 pm

Re: How to remove SNMP trap destination IP via command line

Post by sreinhardt »

OK, are you using service or global event handlers for this? One option to attempt to find where this is configured, would be to grep your configurations.

Code: Select all

grep -Ri '/usr/bin/snmptrap' /usr/local/nagios/etc/*
Nagios-Plugins maintainer exclusively, unless you have other C language bugs with open-source nagios projects, then I am happy to help! Please pm or use other communication to alert me to issues as I no longer track the forum.
babygen
Posts: 7
Joined: Tue Jun 04, 2013 10:59 pm

Re: How to remove SNMP trap destination IP via command line

Post by babygen »

Hi,

There was no result when I run that command. Is there other directory or particular file I need to search.

Thank you.
sreinhardt
-fno-stack-protector
Posts: 4366
Joined: Mon Nov 19, 2012 12:10 pm

Re: How to remove SNMP trap destination IP via command line

Post by sreinhardt »

Just to verify, you are using core and not nagios XI correct? Do you have any idea where you have this configured or how you have nagios set to send alerts? The trap you are sending and command being run looks nearly identical to the XI global event handler for snmp trap sending.
Nagios-Plugins maintainer exclusively, unless you have other C language bugs with open-source nagios projects, then I am happy to help! Please pm or use other communication to alert me to issues as I no longer track the forum.
Locked