Renaming Hosts via API
Posted: Tue May 18, 2021 11:39 am
I use this command to rename the localhost to its actual system name-
But, whenever I run that the services assigned to localhost do not automatically reload their hostname, and break the system from restarting-
To fix this I literally just need to open one of the services, change nothing, and click on save and that is enough to fix it
Problem is I need an automatic fix for this -- so, how do I avoid this, or failing that automate my workaround of the error?
Code: Select all
curl -XPUT -k "https://$NAGSERVER/nagiosxi/api/v1/config/host/localhost?apikey=$NAGAPI&pretty=1&host_name=$NAGSERVER"Code: Select all
An error occurred while attempting to apply your configuration to Nagios Core. Monitoring engine configuration files have been rolled back to their last known good checkpoint.
Error: Could not find any host matching 'localhost' (config file '/usr/local/nagios/etc/services/localhost.cfg', starting on line 104)
Error: Failed to expand host list 'localhost' for service 'Total Processes' (/usr/local/nagios/etc/services/localhost.cfg:104)Problem is I need an automatic fix for this -- so, how do I avoid this, or failing that automate my workaround of the error?