Since I am adding a large number of hosts at the same time I add the hosts without restarting the config and when they are all added restart the nagios server with the following-
Code: Select all
Invoke-RestMethod -Method Post -Uri "https://nagiosserver/nagiosxi/api/v1/config/host?apikey=##########" -Body "force=1&applyconfig=1"
The problem is that sometimes the Nagios server doesn't restart- sometimes there is a config issue that prevents it- but the API command still returns the success message...success
-------
Successfully added to the system. Config applied, Nagios Core was restarted.
Is there any way to show that the Nagios server has actually restarted successfully?