diff --git a/doc/15-troubleshooting.md b/doc/15-troubleshooting.md index 33f7b81a7..4cc733854 100644 --- a/doc/15-troubleshooting.md +++ b/doc/15-troubleshooting.md @@ -950,95 +950,6 @@ curl -k -s -u root:icinga -H 'Accept: application/json' -X POST 'https://localho ``` -### Analyze Notification Result - -> **Note** -> -> This feature is available since v2.11 and requires all endpoints -> being updated. - -Notifications inside a HA enabled zone are balanced between the endpoints, -just like checks. - -Sometimes notifications may fail, and with looking into the (debug) logs -for both masters, you cannot correlate this correctly. - -The `last_notification_result` runtime attribute is stored and synced for Notification -objects and can be queried via REST API. - -Example for retrieving the notification object and result from all `disk` services using a -[regex match](18-library-reference.md#global-functions-regex) on the name: - -``` -$ curl -k -s -u root:icinga -H 'Accept: application/json' -H 'X-HTTP-Method-Override: GET' -X POST 'https://localhost:5665/v1/objects/notifications' \ --d '{ "filter": "regex(pattern, service.name)", "filter_vars": { "pattern": "^disk" }, "attrs": [ "__name", "last_notification_result" ], "pretty": true }' -{ - "results": [ - - { - "attrs": { - "last_notification_result": { - "active": true, - "command": [ - "/etc/icinga2/scripts/mail-service-notification.sh", - "-4", - "", - "-6", - "", - "-b", - "", - "-c", - "", - "-d", - "2019-08-02 10:54:16 +0200", - "-e", - "disk", - "-l", - "icinga2-agent1.localdomain", - "-n", - "icinga2-agent1.localdomain", - "-o", - "DISK OK - free space: / 38108 MB (90.84% inode=100%);", - "-r", - "user@localdomain", - "-s", - "OK", - "-t", - "RECOVERY", - "-u", - "disk" - ], - "execution_end": 1564736056.186217, - "execution_endpoint": "icinga2-master1.localdomain", - "execution_start": 1564736056.132323, - "exit_status": 0.0, - "output": "", - "type": "NotificationResult" - } - }, - "joins": {}, - "meta": {}, - "name": "icinga2-agent1.localdomain!disk!mail-service-notification", - "type": "Notification" - } - -... - - ] -} -``` - -Example with the debug console: - -``` -$ ICINGA2_API_PASSWORD=icinga icinga2 console --connect 'https://root@localhost:5665/' --eval 'get_object(Notification, "icinga2-agent1.localdomain!disk!mail-service-notification").last_notification_result.execution_endpoint' | jq - -"icinga2-agent1.localdomain" -``` - -Whenever a notification command failed to execute, you can fetch the output as well. - - ## Feature Troubleshooting ### Feature is not working