Team,
Can you please help us on below task.
We have a task to replace all IP addresses in one of Nagios with the new set of IP addresses. which are many service monitor configurations have IP addresses in them as an argument. There are > 2500 entries as we see it. It will be difficult to do them manually. Is there anyway we can cook up a script to make it easier
reverse engineer (pull the data out) -> convert to a script -> modify to replace IP addresses with FQDNs -> execute & verify.
Thank you..!
Task to replace all IP addresses in Nagios service monitors
Re: Task to replace all IP addresses in Nagios service monit
This could be done through the API. Go to Help -> Config Reference, and look under the hosts section. You use a PUT command to update hosts, and it looks like host address is one of the options.
Alternately, if you feel more confident with SQL, you could affect this change in the nagios database, altering the nagios_hosts table. Always, always, always take backups before you modify anything in the database, however. But once everything is changed, you would go to Configure -> Core Config Manager -> Config File Management, click the Delete Files button, the Write Configs button, and then the Verify Files button. Assuming everything verifies properly, click the Restart Nagios Core
Of those two options, I would highly recommend the API route.
Alternately, if you feel more confident with SQL, you could affect this change in the nagios database, altering the nagios_hosts table. Always, always, always take backups before you modify anything in the database, however. But once everything is changed, you would go to Configure -> Core Config Manager -> Config File Management, click the Delete Files button, the Write Configs button, and then the Verify Files button. Assuming everything verifies properly, click the Restart Nagios Core
Of those two options, I would highly recommend the API route.
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
Be sure to check out our Knowledgebase for helpful articles and solutions!
Be sure to check out our Knowledgebase for helpful articles and solutions!
Re: Task to replace all IP addresses in Nagios service monit
I have changed one of the service config file in the path /usr/local/nagios/etc/services/<servername>.cfg
Did replace ipaddress with FQDN.
after that nagios service was reload --> and applied configure settings in nagios gui.
however ipaddress still exist in service monitor settings in nagios GUI.
Can you please share the process after modify service.cfg file and how to apply new config file settings into nagios XI tool.
Did replace ipaddress with FQDN.
after that nagios service was reload --> and applied configure settings in nagios gui.
however ipaddress still exist in service monitor settings in nagios GUI.
Can you please share the process after modify service.cfg file and how to apply new config file settings into nagios XI tool.
Re: Task to replace all IP addresses in Nagios service monit
Modifying the configuration files won't work, because those are destroyed and re-created when you apply config. All of the data is stored in the database. I would make sure you have a fresh backup before going in to modify configuration data in the database, as that can cause large issues.
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
Be sure to check out our Knowledgebase for helpful articles and solutions!
Be sure to check out our Knowledgebase for helpful articles and solutions!