Skip to content

Commit

Permalink
Merge pull request #9929 from Icinga/analyze-notification-result
Browse files Browse the repository at this point in the history
Doc: Troubleshooting: remove obsolete section "Analyze Notification Result"
  • Loading branch information
Al2Klimov authored Dec 12, 2023
2 parents 420db15 + 87bb33d commit d05be80
Showing 1 changed file with 0 additions and 89 deletions.
89 changes: 0 additions & 89 deletions doc/15-troubleshooting.md
Original file line number Diff line number Diff line change
Expand Up @@ -950,95 +950,6 @@ curl -k -s -u root:icinga -H 'Accept: application/json' -X POST 'https://localho
```


### Analyze Notification Result <a id="troubleshooting-notifications-result"></a>

> **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 <a id="troubleshooting-features"></a>

### Feature is not working <a id="feature-not-working"></a>
Expand Down

0 comments on commit d05be80

Please sign in to comment.