Page 1 of 1

How are Traps assigned to hosts in Nagios?

Posted: Fri Nov 10, 2017 8:15 am
by evisus
Hi!!

I would like to know what is the criteria for assigning the traps configured in Nagios XI to the host, I have read the documentation but I do not understand well if the IP address or the host name is used.

For example:
In the non-configured objects I receive the following Traps

10.206.10.12 SNMP Traps (see attached)

When using the Wizard, the Snmp Traps service is created in Host = 10.203.0.12 and IP = 10.203.0.12. What happens if I change the name of the Host to "Server_1" but I keep the IP address? Will the Traps continue arriving at the same Host?

Thanks

Re: How are Traps assigned to hosts in Nagios?

Posted: Fri Nov 10, 2017 2:53 pm
by tgriep
If the settings are default for the snmptt daemon, it should resolve the host name if the IP address is setup in DNS.

But, the default command that sends the trap to Nagios XI, it only passes the IP address.
To pass the Host Name to XI, you would have to edit the /etc/snmp/snmptt.conf file and change all of the EXEC lines from

Code: Select all

EXEC /usr/local/bin/snmptraphandling.py "$r" "SNMP Traps" "$s" "$@" "$-*" "Link down on interface $1. Admin state: $2. Operational state: $3"
to

Code: Select all

EXEC /usr/local/bin/snmptraphandling.py "$A" "SNMP Traps" "$s" "$@" "$-*" "Link down on interface $1. Admin state: $2. Operational state: $3"
Mainly change the $r to $A so it will pass the hostname and not the IP.

That will make the server receive names and not addresses.

And to answer your question, the trap will continue to come in as an IP address so renaming the host probably will not work.

Re: How are Traps assigned to hosts in Nagios?

Posted: Thu Nov 16, 2017 10:36 am
by evisus
thanks for your answer, it is clear to me

Re: How are Traps assigned to hosts in Nagios?

Posted: Thu Nov 16, 2017 10:52 am
by kyang
@evisus Great! Did you have any more questions or are we okay to close this thread?

Re: How are Traps assigned to hosts in Nagios?

Posted: Thu Nov 16, 2017 10:53 am
by evisus
I'm fine, thank you, you can close this thread

Re: How are Traps assigned to hosts in Nagios?

Posted: Thu Nov 16, 2017 10:54 am
by kyang
Sounds good! I'll be closing this thread!

If you have any more questions, feel free to create another thread.

Thanks for using the Nagios Support Forum!