Merge pull request #9921 from Icinga/doc2141

Update documentation
This commit is contained in:
Alexander Aleksandrovič Klimov 2023-12-19 17:01:31 +01:00 committed by GitHub
commit b55a14d536
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 24 additions and 107 deletions

View File

@ -23,6 +23,7 @@ Alexander A. Klimov <alexander.klimov@icinga.com> <alexander.klimov@icinga.com>
<marius@graylog.com> <marius@torch.sh> <marius@graylog.com> <marius@torch.sh>
<markus.frosch@icinga.com> <lazyfrosch@icinga.org> <markus.frosch@icinga.com> <lazyfrosch@icinga.org>
<markus.frosch@icinga.com> <markus@lazyfrosch.de> <markus.frosch@icinga.com> <markus@lazyfrosch.de>
<mathias.aerts@delta.blue> <mathiasaerts@users.noreply.github.com>
<michael.friedrich@icinga.com> <michael.friedrich@gmail.com> <michael.friedrich@icinga.com> <michael.friedrich@gmail.com>
<michael.friedrich@icinga.com> <Michael.Friedrich@netways.de> <michael.friedrich@icinga.com> <Michael.Friedrich@netways.de>
<nicole.lang@icinga.com> <nicole.lang@netways.de> <nicole.lang@icinga.com> <nicole.lang@netways.de>

View File

@ -11,6 +11,7 @@ Alexander Fuhr <alexander.fuhr@netways.de>
Alexander Schomburg <script.acc@alex.schomb.org> Alexander Schomburg <script.acc@alex.schomb.org>
Alexander Stoll <astoll@netways.de> Alexander Stoll <astoll@netways.de>
Alexander Wirt <formorer@debian.org> Alexander Wirt <formorer@debian.org>
Alvar Penning <alvar.penning@icinga.com>
Andrea Avancini <andrea.avancini@wuerth-phoenix.com> Andrea Avancini <andrea.avancini@wuerth-phoenix.com>
Andrea Kao <eirinikos@gmail.com> Andrea Kao <eirinikos@gmail.com>
Andreas Maus <maus@badphish.ypbind.de> Andreas Maus <maus@badphish.ypbind.de>

View File

@ -200,7 +200,7 @@ zypper ar https://download.opensuse.org/repositories/server:/monitoring/15.3/ser
<!-- {% endif %} --> <!-- {% endif %} -->
<!-- {% if amazon_linux %} --> <!-- {% if amazon_linux %} -->
### Amazon Linux 2 Repository <a id="amazon-linux-2-repository"></a> ### Amazon Linux Repository <a id="amazon-linux-2-repository"></a>
!!! info !!! info
@ -214,12 +214,14 @@ rpm --import https://packages.icinga.com/icinga.key
wget https://packages.icinga.com/subscription/amazon/ICINGA-release.repo -O /etc/yum.repos.d/ICINGA-release.repo wget https://packages.icinga.com/subscription/amazon/ICINGA-release.repo -O /etc/yum.repos.d/ICINGA-release.repo
``` ```
The packages for Amazon Linux 2 depend on other packages which are distributed The packages for **Amazon Linux 2** depend on other packages which are distributed
as part of the [EPEL repository](https://fedoraproject.org/wiki/EPEL). as part of the [EPEL repository](https://fedoraproject.org/wiki/EPEL).
```bash ```bash
yum install epel-release yum install epel-release
``` ```
The packages for newer versions of Amazon Linux don't require additional repositories.
<!-- {% endif %} --> <!-- {% endif %} -->
<!-- {% if windows %} --> <!-- {% if windows %} -->
@ -307,7 +309,7 @@ zypper install icinga2
<!-- {% if amazon_linux %} --> <!-- {% if amazon_linux %} -->
<!-- {% if not icingaDocs %} --> <!-- {% if not icingaDocs %} -->
#### Amazon Linux 2 #### Amazon Linux
<!-- {% endif %} --> <!-- {% endif %} -->
```bash ```bash
yum install icinga2 yum install icinga2
@ -418,15 +420,17 @@ zypper install --recommends monitoring-plugins-all
<!-- {% if amazon_linux %} --> <!-- {% if amazon_linux %} -->
<!-- {% if not icingaDocs %} --> <!-- {% if not icingaDocs %} -->
#### Amazon Linux 2 #### Amazon Linux
<!-- {% endif %} --> <!-- {% endif %} -->
The packages for Amazon Linux 2 depend on other packages which are distributed as part of the EPEL repository. The packages for **Amazon Linux 2** depend on other packages which are distributed as part of the EPEL repository.
```bash ```bash
amazon-linux-extras install epel amazon-linux-extras install epel
yum install nagios-plugins-all yum install nagios-plugins-all
``` ```
Unfortunately newer versions of Amazon Linux don't provide those plugins, yet.
<!-- {% endif %} --> <!-- {% endif %} -->
## Set up Icinga 2 API <a id="set-up-icinga2-api"></a> ## Set up Icinga 2 API <a id="set-up-icinga2-api"></a>
@ -505,7 +509,7 @@ Use your distribution's package manager to install the `icingadb-redis` package
<!-- {% if amazon_linux %} --> <!-- {% if amazon_linux %} -->
<!-- {% if not icingaDocs %} --> <!-- {% if not icingaDocs %} -->
##### Amazon Linux 2 ##### Amazon Linux
<!-- {% endif %} --> <!-- {% endif %} -->
```bash ```bash
yum install icingadb-redis yum install icingadb-redis

View File

@ -225,12 +225,12 @@ apply Service "db-size-" for (db_name => config in host.vars.databases) {
check_command = "mysql_health" check_command = "mysql_health"
if (config.mysql_health_username) { if (config.mysql_health_username) {
vars.mysql_healt_username = config.mysql_health_username vars.mysql_health_username = config.mysql_health_username
} else { } else {
vars.mysql_health_username = "root" vars.mysql_health_username = "root"
} }
if (config.mysql_health_password) { if (config.mysql_health_password) {
vars.mysql_healt_password = config.mysql_health_password vars.mysql_health_password = config.mysql_health_password
} else { } else {
vars.mysql_health_password = "icingar0xx" vars.mysql_health_password = "icingar0xx"
} }

View File

@ -34,6 +34,7 @@ the [Icinga 2 API](12-icinga2-api.md#icinga2-api-config-objects).
templates | Array | Templates imported on object compilation. templates | Array | Templates imported on object compilation.
package | String | [Configuration package name](12-icinga2-api.md#icinga2-api-config-management) this object belongs to. Local configuration is set to `_etc`, runtime created objects use `_api`. package | String | [Configuration package name](12-icinga2-api.md#icinga2-api-config-management) this object belongs to. Local configuration is set to `_etc`, runtime created objects use `_api`.
source\_location | Dictionary | Location information where the configuration files are stored. source\_location | Dictionary | Location information where the configuration files are stored.
name | String | Object name. Might be used in [apply rules](03-monitoring-basics.md#using-apply).
## Monitoring Objects <a id="object-types-monitoring"></a> ## Monitoring Objects <a id="object-types-monitoring"></a>
@ -731,7 +732,6 @@ Configuration Attributes:
event\_command | Object name | **Optional.** The name of an event command that should be executed every time the service's state changes or the service is in a `SOFT` state. event\_command | Object name | **Optional.** The name of an event command that should be executed every time the service's state changes or the service is in a `SOFT` state.
volatile | Boolean | **Optional.** Treat all state changes as HARD changes. See [here](08-advanced-topics.md#volatile-services-hosts) for details. Defaults to `false`. volatile | Boolean | **Optional.** Treat all state changes as HARD changes. See [here](08-advanced-topics.md#volatile-services-hosts) for details. Defaults to `false`.
zone | Object name | **Optional.** The zone this object is a member of. Please read the [distributed monitoring](06-distributed-monitoring.md#distributed-monitoring) chapter for details. zone | Object name | **Optional.** The zone this object is a member of. Please read the [distributed monitoring](06-distributed-monitoring.md#distributed-monitoring) chapter for details.
name | String | **Required.** The service name. Must be unique on a per-host basis. For advanced usage in [apply rules](03-monitoring-basics.md#using-apply) only.
command\_endpoint | Object name | **Optional.** The endpoint where commands are executed on. command\_endpoint | Object name | **Optional.** The endpoint where commands are executed on.
notes | String | **Optional.** Notes for the service. notes | String | **Optional.** Notes for the service.
notes\_url | String | **Optional.** URL for notes for the service (for example, in notification commands). notes\_url | String | **Optional.** URL for notes for the service (for example, in notification commands).
@ -1046,8 +1046,8 @@ Configuration Attributes:
Name | Type | Description Name | Type | Description
--------------------------|-----------------------|---------------------------------- --------------------------|-----------------------|----------------------------------
host\_name | Object name | **Required.** The name of the host this comment belongs to. host\_name | Object name | **Required.** The name of the host this downtime belongs to.
service\_name | Object name | **Optional.** The short name of the service this comment belongs to. If omitted, this comment object is treated as host comment. service\_name | Object name | **Optional.** The short name of the service this downtime belongs to. If omitted, this downtime object is treated as host downtime.
author | String | **Required.** The author's name. author | String | **Required.** The author's name.
comment | String | **Required.** The comment text. comment | String | **Required.** The comment text.
start\_time | Timestamp | **Required.** The start time as UNIX timestamp. start\_time | Timestamp | **Required.** The start time as UNIX timestamp.

View File

@ -215,7 +215,7 @@ Optional custom variables passed as [command parameters](03-monitoring-basics.md
| ifw\_api\_cert | null (Icinga PKI) | TLS client certificate path. | | ifw\_api\_cert | null (Icinga PKI) | TLS client certificate path. |
| ifw\_api\_key | null (Icinga PKI) | TLS client private key path. | | ifw\_api\_key | null (Icinga PKI) | TLS client private key path. |
| ifw\_api\_ca | null (Icinga PKI) | Peer TLS CA certificate path. | | ifw\_api\_ca | null (Icinga PKI) | Peer TLS CA certificate path. |
| ifw\_api\_crl | null (Icinga PKI) | Path to TLS CRL to check peer against. | | ifw\_api\_crl | null (none) | Path to TLS CRL to check peer against. |
| ifw\_api\_username | null (none) | Basic auth username. | | ifw\_api\_username | null (none) | Basic auth username. |
| ifw\_api\_password | null (none) | Basic auth password. | | ifw\_api\_password | null (none) | Basic auth password. |

View File

@ -1850,7 +1850,7 @@ Example for all object events:
--------------|---------------|-------------------------- --------------|---------------|--------------------------
type | String | Event type `DowntimeAdded`. type | String | Event type `DowntimeAdded`.
timestamp | Timestamp | Unix timestamp when the event happened. timestamp | Timestamp | Unix timestamp when the event happened.
downtime | Dictionary | Serialized [Comment](09-object-types.md#objecttype-downtime) object. downtime | Dictionary | Serialized [Downtime](09-object-types.md#objecttype-downtime) object.
#### <a id="icinga2-api-event-streams-type-downtimeremoved"></a> Event Stream Type: DowntimeRemoved #### <a id="icinga2-api-event-streams-type-downtimeremoved"></a> Event Stream Type: DowntimeRemoved
@ -1858,7 +1858,7 @@ Example for all object events:
--------------|---------------|-------------------------- --------------|---------------|--------------------------
type | String | Event type `DowntimeRemoved`. type | String | Event type `DowntimeRemoved`.
timestamp | Timestamp | Unix timestamp when the event happened. timestamp | Timestamp | Unix timestamp when the event happened.
downtime | Dictionary | Serialized [Comment](09-object-types.md#objecttype-downtime) object. downtime | Dictionary | Serialized [Downtime](09-object-types.md#objecttype-downtime) object.
#### <a id="icinga2-api-event-streams-type-downtimestarted"></a> Event Stream Type: DowntimeStarted #### <a id="icinga2-api-event-streams-type-downtimestarted"></a> Event Stream Type: DowntimeStarted
@ -1867,7 +1867,7 @@ Example for all object events:
--------------|---------------|-------------------------- --------------|---------------|--------------------------
type | String | Event type `DowntimeStarted`. type | String | Event type `DowntimeStarted`.
timestamp | Timestamp | Unix timestamp when the event happened. timestamp | Timestamp | Unix timestamp when the event happened.
downtime | Dictionary | Serialized [Comment](09-object-types.md#objecttype-downtime) object. downtime | Dictionary | Serialized [Downtime](09-object-types.md#objecttype-downtime) object.
#### <a id="icinga2-api-event-streams-type-downtimetriggered"></a> Event Stream Type: DowntimeTriggered #### <a id="icinga2-api-event-streams-type-downtimetriggered"></a> Event Stream Type: DowntimeTriggered
@ -1876,7 +1876,7 @@ Example for all object events:
--------------|---------------|-------------------------- --------------|---------------|--------------------------
type | String | Event type `DowntimeTriggered`. type | String | Event type `DowntimeTriggered`.
timestamp | Timestamp | Unix timestamp when the event happened. timestamp | Timestamp | Unix timestamp when the event happened.
downtime | Dictionary | Serialized [Comment](09-object-types.md#objecttype-downtime) object. downtime | Dictionary | Serialized [Downtime](09-object-types.md#objecttype-downtime) object.
### Event Stream Filter <a id="icinga2-api-event-streams-filter"></a> ### Event Stream Filter <a id="icinga2-api-event-streams-filter"></a>

View File

@ -843,7 +843,7 @@ yum install icinga2-ido-mysql
zypper install icinga2-ido-mysql zypper install icinga2-ido-mysql
``` ```
###### Amazon Linux 2 ###### Amazon Linux
```bash ```bash
yum install icinga2-ido-mysql yum install icinga2-ido-mysql
@ -942,7 +942,7 @@ yum install icinga2-ido-pgsql
zypper install icinga2-ido-pgsql zypper install icinga2-ido-pgsql
``` ```
###### Amazon Linux 2 ###### Amazon Linux
```bash ```bash
yum install icinga2-ido-pgsql yum install icinga2-ido-pgsql

View File

@ -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 Troubleshooting <a id="troubleshooting-features"></a>
### Feature is not working <a id="feature-not-working"></a> ### Feature is not working <a id="feature-not-working"></a>