This is ideal if you want to know if the Nagios XI server is using the current configuration before making any further changes via the API.
The API command is as follows:
https://<YOUR_NAGIOS_SERVER>/nagiosxi/api/v1/custom/applyconfigneeded?apikey=<APIKEY>
The function for adding into your existing custom API php script is:
Code: Select all
register_custom_api_callback('custom', 'applyconfigneeded', 'custom_applyconfigneeded');
function custom_applyconfigneeded() {
$ac_needed = get_option("ccm_apply_config_needed", 0);
$xml = "<xml>
<ApplyConfigNeeded>{$ac_needed}</ApplyConfigNeeded>
</xml>";
$data = simplexml_load_string($xml);
return json_encode($data);
}
This will return:
{"ApplyConfigNeeded":"0"}
Happy coding