Hi. We find that users sometimes disable notifications for a given service and forget to re-enable the notifications after the incident is resolved. Has anyone worked out a way to "age" the disabled state and then toggle notifications back on? Where is the "enable/disable" notifications flag stored? Can it be reached via the API?
Thanks!
How are disabled service notifications documented
Re: How are disabled service notifications documented
You could make a call to the back-end API and get all service statuses where notifications_enabled=0 and current_state=0 (OK) like so:awilson wrote:Where is the "enable/disable" notifications flag stored? Can it be reached via the API?
Code: Select all
[root@localhost ~]# curl -XGET "http://<nagios_server>/nagiosxi/api/v1/objects/servicestatus?notifications_enabled=0¤t_state=0&apikey=<api_key>&pretty=1"
{
"servicestatuslist": {
"recordcount": "1",
"servicestatus": {
"@attributes": {
"id": "12952"
},
"instance_id": "1",
"service_id": "546",
"host_id": "436",
"host_name": "192.168.67.99",
"host_alias": "192.168.67.99",
"name": "Application Host Helper Service",
"host_display_name": "",
"host_address": "192.168.67.99",
"display_name": "Application Host Helper Service",
"status_update_time": "2016-09-13 16:25:18",
"status_text": "OK - Found 1 Services(s), 1 OK and 0 with problems (0 excluded). 'Application Host Helper Service' (AppHostSvc) is Running.",
"status_text_long": "",
"current_state": "0",
"performance_data": "'Total Service Count'=1;1; 'Service Count OK State'=1; 'Service Count Problem State'=0;0; 'Excluded Service Count'=0;",
"should_be_scheduled": "1",
"check_type": "0",
"last_state_change": "2016-09-13 15:31:52",
"last_hard_state_change": "2016-09-02 10:01:01",
"last_hard_state": "0",
"last_time_ok": "2016-09-13 16:24:52",
"last_time_warning": "1969-12-31 19:00:00",
"last_time_critical": "2016-08-30 12:01:48",
"last_time_unknown": "2016-09-13 15:31:52",
"last_notification": "1969-12-31 19:00:00",
"next_notification": "1969-12-31 19:00:00",
"no_more_notifications": "0",
"acknowledgement_type": "0",
"current_notification_number": "0",
"process_performance_data": "1",
"obsess_over_service": "1",
"event_handler_enabled": "1",
"modified_service_attributes": "1",
"event_handler": "",
"check_command": "check_xi_service_wmiplus!'admin'!'welcome123@'!checkservice!-a 'AppHostSvc' -c _Total=1: -c 0",
"normal_check_interval": "1",
"retry_check_interval": "1",
"check_timeperiod_id": "131",
"icon_image": "",
"icon_image_alt": "",
"has_been_checked": "1",
"current_check_attempt": "1",
"max_check_attempts": "5",
"last_check": "2016-09-13 16:24:52",
"next_check": "2016-09-13 16:25:52",
"state_type": "1",
"notifications_enabled": "0",
"problem_acknowledged": "0",
"flap_detection_enabled": "1",
"is_flapping": "0",
"percent_state_change": "0",
"latency": "0",
"execution_time": "0.21098",
"scheduled_downtime_depth": "0",
"passive_checks_enabled": "1",
"active_checks_enabled": "1"
}
}
}
Former Nagios employee
https://www.mcapra.com/
https://www.mcapra.com/
Re: How are disabled service notifications documented
Thank you!
Ok to close this.
Alan
Ok to close this.
Alan