Hi,
I have an issue where our Nagios XI server receives SNMP traps, translates them but does not send that associated notification to the reciepients. This has been working without any issues
We are running Version 2012R2.7.
The translated messages are displayed in the /var/log/snmptt/snmptt.log file.
I have restarted the services and also eventually restarted the server but the problem still persists.
Any help is appreciated.
Some more info: All other notifications are working fine. Critical and warning Service alerts are sent correctly. Issue only exists with SNMP traps.
In the Event Log, I see the following message:
Warning: Passive check result was received for service 'SNMP Traps' on host 'hostname.xxx.xxx', but the host could not be found!
even though the host is there.
Our hostnames are in uppercase and it now seems that the trap translation only comes up in lowercase. This has worked in the past without any problems - just wondering what changed?
I can see all the traps in unconfigured items.
Question is how do I resolve this without having to re-configure all Nagios hosts? Can I get the name resolution to work with uppercase names or is there a quick way I can rename all nagios xi hosts as lowercase? (???)
Do not double, triple, or quadruple post.
SNMP Notifications not sent
SNMP Notifications not sent
Last edited by aap on Thu Feb 27, 2014 9:35 am, edited 1 time in total.
-
sreinhardt
- -fno-stack-protector
- Posts: 4366
- Joined: Mon Nov 19, 2012 12:10 pm
Re: SNMP Notifications not sent
Probably the simplest way would be to modify snmptrapsendign.py to use upper() the hostname field. I would have to test it, but I believe adding the following should do it.
Code: Select all
Line 17: import string
Line 82:
From: post_results(host, service, mytime, mondata_res, return_code)
To: post_results(host.upper(), service, mytime, mondata_res, return_code)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.
Re: SNMP Notifications not sent
Thanks for your response.
I have made the change - but still have a lsigt issue. Our hostnames have a mixed naming convention - HOSTNAME.ab.cd.efg
So after the change was made, the trap is now resolved as HOSTNAME.AB.CD.EFG which still poses a problem for us. Going forward we would prefer everything lowercase and I also noticed that Nagios XI now creates hosts by default in lowercase.
Any help on how to rename all or 1000 hosts in Nagios XI as lowercase is much appreciated.
I have made the change - but still have a lsigt issue. Our hostnames have a mixed naming convention - HOSTNAME.ab.cd.efg
So after the change was made, the trap is now resolved as HOSTNAME.AB.CD.EFG which still poses a problem for us. Going forward we would prefer everything lowercase and I also noticed that Nagios XI now creates hosts by default in lowercase.
Any help on how to rename all or 1000 hosts in Nagios XI as lowercase is much appreciated.
-
sreinhardt
- -fno-stack-protector
- Posts: 4366
- Joined: Mon Nov 19, 2012 12:10 pm
Re: SNMP Notifications not sent
OK, so are we going to work on making traps fit your naming convention, or changing the case of all your hostnames within nagios? I am open to either, but we should stick with one route or the other.
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.
Re: SNMP Notifications not sent
Spenser,
Renaming the hosts seems the best approach for us.
Thanks for your help. Much appreciated.
Renaming the hosts seems the best approach for us.
Thanks for your help. Much appreciated.
-
slansing
- Posts: 7698
- Joined: Mon Apr 23, 2012 4:28 pm
- Location: Travelling through time and space...
Re: SNMP Notifications not sent
Sounds like you got it sorted out, correct?
Re: SNMP Notifications not sent
No, we haven't. I was merely answering Spenser's question as to what option we would like to go for between renaming and getting SNMP traps to work with uppercase names.
We still require assistance on changing all the hosts and services to have lowercase names.
Thanks for looking into it for us
We still require assistance on changing all the hosts and services to have lowercase names.
Thanks for looking into it for us
Re: SNMP Notifications not sent
You'd have to run something like the following:
in order to convert just the host_name to lower-case. Change '-e' to '-i' to make the change permanent.
The biggest problem you will run into is if making a hostname lower-case would conflict with another hostname.
Code: Select all
sed -e 's/host_name\w*\(.*\)/host_name\L\1/' host.cfgThe biggest problem you will run into is if making a hostname lower-case would conflict with another hostname.
Former Nagios employee
Re: SNMP Notifications not sent
Hi,
Thanks. I have just ran the command to change the host name however, as soon as the "Apply Configuration" is ran, the name reverts back to uppercase. Nagios Xi overwrites the changes made. I ran it by changing -e to -i
Is there anything else that I need to do to make the lowercase setting stick?
I also noticed that after manually changing the hostname to lowercase (which stays after applying the configuration), we lose all historical data for tht host. Is the an un-recoverable consequence of renaming the host?
Thanks. I have just ran the command to change the host name however, as soon as the "Apply Configuration" is ran, the name reverts back to uppercase. Nagios Xi overwrites the changes made. I ran it by changing -e to -i
Is there anything else that I need to do to make the lowercase setting stick?
I also noticed that after manually changing the hostname to lowercase (which stays after applying the configuration), we lose all historical data for tht host. Is the an un-recoverable consequence of renaming the host?
-
sreinhardt
- -fno-stack-protector
- Posts: 4366
- Joined: Mon Nov 19, 2012 12:10 pm
Re: SNMP Notifications not sent
Yes there is, you would need to copy the config files to the import directory, then run the sed command on the files to change to lowercase. Finally run the reconfigure nagios script (/usr/local/nagiosxi/scripts/reconfigure_nagios.sh) to import the changes. The only thing we are worried about is if this will cause duplicates due to the upper and lowercase naming differences. This is what we were beginning to test last night.
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.