add Icinga custom check documentation

This commit is contained in:
2024-12-18 13:03:48 +01:00
parent 6c8e4bf976
commit 0efdf67c97
@@ -190,7 +190,7 @@ icinga2::service_check::customize:
- '/etc/httpd/ssl/node.crt'
```
Beside the file list you may set the warning time in days with the attribute `ssl_cert_warning` (`7` by default) and the critical time with the attribute `ssl_cert_critical` (3 by default).
Beside the file list you may set the warning time in days with the attribute `ssl_cert_warning` (`7` by default) and the critical time with the attribute `ssl_cert_critical` (`3` by default).
If you run your own PKI, you might also check a CA certificate for expiration with
@@ -204,3 +204,67 @@ icinga2::service_check::customize:
- '/etc/my_pki/ca.pem'
```
Here the warning is below 180 days and below 30 days is critical by default.
### Check for Systemd Service Status
To check if a daemon or service has been successfully started by systemd configure:
```
icinga2::additional_server_role:
- 'service-active'
icinga2::service_check::customize:
'Service Active':
service_names:
- 'xrdp'
- 'xrdp-sesman'
```
### External Connection Checks (Active Checks)
For this we have fully custom service checks.
Below example is for a RDP port:
```
icinga2::custom_service:
'RDP Access':
command: 'tcp'
agent: false
perf_data: true
vars:
criticality: 'A'
tcp_port: 3389
```
Possible commands are [`http`](https://icinga.com/docs/icinga-2/latest/doc/10-icinga-template-library/#plugin-check-command-http), [`tcp`](https://icinga.com/docs/icinga-2/latest/doc/10-icinga-template-library/#plugin-check-command-tcp), [`udp`](https://icinga.com/docs/icinga-2/latest/doc/10-icinga-template-library/#plugin-check-command-udp), [`ssl`](https://icinga.com/docs/icinga-2/latest/doc/10-icinga-template-library/#plugin-check-command-ssl), [`ssh`](https://icinga.com/docs/icinga-2/latest/doc/10-icinga-template-library/#plugin-check-command-ssh) or [`ftp`](https://icinga.com/docs/icinga-2/latest/doc/10-icinga-template-library/#plugin-check-command-ftp).
### Other Custom Checks
It is possible to create a very custom check. But note the command or service template used needs to be available/configured by some other means on the Icinga Master. The check plugin executed on the Icinga Satellite or by the Icinga agent needs also to be already available or distributed by other means.
```
icinga2::custom_service:
'My Service Check 1':
template: st-agent-linux-fileage
vars:
criticality: 'B'
file_age_file: '/var/my/regular/activity/file'
'My Service Check 1':
command: 'tcp'
agent: false
vars:
criticality: 'A'
tcp_port: 3389
perf_data: true
```
Below `icinga2::custom_service` set the name of the service/service check as it will be seen in Icingaweb. Then the possible arguments are
- `command` to issue a check command
- `template` to inherit from given service template
- `agent` if `template` is not set, the agent base template is used, default is `true`
- `vars` hash with arguments for the service check
- `perf_data` if performance data should be recorded and performance graph should be shown, default is `false`