Skip to content

Commit

Permalink
check_systemd: harmonize ITL w/ upstream
Browse files Browse the repository at this point in the history
Harmonize the arguments with the upstream CheckCommand[0], including a
patch to use the ITL variables[1].

[0]: https://github.com/Josef-Friedrich/check_systemd/blob/main/contrib/icinga2/command.conf
[1]: Josef-Friedrich/check_systemd#38

Co-Authored-By: RincewindsHat <[email protected]>
  • Loading branch information
oxzi and RincewindsHat committed Sep 6, 2024
1 parent a219436 commit e7670e9
Show file tree
Hide file tree
Showing 2 changed files with 91 additions and 32 deletions.
35 changes: 23 additions & 12 deletions doc/10-icinga-template-library.md
Original file line number Diff line number Diff line change
Expand Up @@ -3653,21 +3653,32 @@ iostat\_cwrite | **Required.** Critical threshold for KB/s writes (default: 200)
#### systemd <a id="plugin-contrib-command-systemd"></a>

The [check_systemd](https://github.com/Josef-Friedrich/check_systemd) plugin
will report a degraded system to your monitoring solution. It requires only the [nagiosplugin](https://nagiosplugin.readthedocs.io/en/stable) library.
will report a degraded system to your monitoring solution.

Custom variables passed as [command parameters](03-monitoring-basics.md#command-passing-parameters):

Name | Description
--------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------
systemd\_unit | **Optional.** Name of the systemd unit that is being tested.
systemd\_exclude\_unit | **Optional.** Exclude a systemd unit from the checks. This option can be applied multiple times. Also supports regular expressions.
systemd\_no\_startup\_time | **Optional.** Don’t check the startup time. Using this option the options `systemd_warning` and `systemd_critical` have no effect. (Default: `false`)
systemd\_warning | **Optional.** Startup time in seconds to result in a warning status. (Default: `60s`)
systemd\_critical | **Optional.** Startup time in seconds to result in a critical status. (Default: `120s`)
systemd\_dead\_timers | **Optional.** Detect dead / inactive timers. (Default: `false`)
systemd\_dead\_timers\_warning | **Optional.** Time ago in seconds for dead / inactive timers to trigger a warning state (by default 6 days).
systemd\_dead\_timers\_critical | **Optional.** Time ago in seconds for dead / inactive timers to trigger a critical state (by default 7 days).
systemd\_verbose\_level | **Optional.** Increase verbosity level (Accepted values: `1`, `2` or `3`). (Defaults to none)
Name | Description
---------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------
systemd\_verbose\_level | **Optional.** Increase verbosity level (Accepted values: `1`, `2` or `3`). (Defaults to none)
systemd\_ignore\_inactive\_state | **Optional.** Ignore an inactive state on a specific unit. Only affective if used with `systemd_unit`.
systemd\_include | **Optional.** Include systemd units to the checks, regular expressions are supported. This option can be applied multiple times.
systemd\_unit | **Optional.** Name of the systemd unit that is being tested.
systemd\_include\_type | **Optional.** Unit types to be tested (for example: `service`, `timer`). This option can be applied multiple times.
systemd\_exclude\_unit | **Optional.** Exclude a systemd unit from the checks, regular expressions are supported. This option can be applied multiple times.
systemd\_exclude\_unit\_name | **Optional.** Exclude a systemd unit from the checks. This option can be applied multiple times.
systemd\_exclude\_type | **Optional.** Exclude a systemd unit type (for example: `service`, `timer`)
systemd\_state | **Optional.** Specify the active state that the systemd unit must have (for example: `active`, `inactive`)
systemd\_dead\_timers | **Optional.** Detect dead / inactive timers, see `systemd_dead_timers_{warning,critical}`. (Default `false`)
systemd\_dead\_timers\_warning | **Optional.** Time ago in seconds for dead / inactive timers to trigger a warning state. (Default 6 days)
systemd\_dead\_timers\_critical | **Optional.** Time ago in seconds for dead / inactive timers to trigger a critical state. (Default 7 days)
systemd\_no\_startup\_time | **Optional.** Don't check the startup time. Using this option, the options `systemd_{warning,critical}` have no effect. (Default `false`)
systemd\_warning | **Optional.** Startup time in seconds to result in a warning status. (Default 60 seconds)
systemd\_critical | **Optional.** Startup time in seconds to result in a critical status. (Default 120 seconds)
systemd\_dbus | **Optional.** Use systemd's D-Bus API instead of parsing command output. Only partially implemented!
systemd\_cli | **Optional.** Use text output from parsing command output. (Default)
systemd\_user | **Optional.** Also show user (systemctl --user) units.



#### yum <a id="plugin-contrib-command-yum"></a>

Expand Down
88 changes: 68 additions & 20 deletions itl/plugins-contrib.d/systemd.conf
Original file line number Diff line number Diff line change
Expand Up @@ -4,48 +4,96 @@ object CheckCommand "systemd" {
command = [ PluginContribDir + "/check_systemd" ]

arguments = {
/* General options */
"-v" = {
set_if = {{ macro("$systemd_verbose_level$") == 1 }}
description = "Increase verbosity level (Accepted values: `1`, `2` or `3`). Defaults to none."
}
"-vv" = {
set_if = {{ macro("$systemd_verbose_level$") == 2 }}
}
"-vvv" = {
set_if = {{ macro("$systemd_verbose_level$") == 3 }}
}

/* Options related to unit selection */
"--ignore-inactive-state" = {
set_if = "$systemd_ignore_inactive_state$"
description = "Ignore an inactive state on a specific unit. Only affective if used with `systemd_unit`."
}
"--include" = {
value = "$systemd_include$"
description = "Include systemd units to the checks, regular expressions are supported. This option can be applied multiple times."
repeat_key = true
}
"--unit" = {
value = "$systemd_unit$"
description = "Name of the systemd unit that is being tested."
}
"--include-type" = {
value = "$systemd_include_type$"
description = "Unit types to be tested (for example: `service`, `timer`). This option can be applied multiple times."
repeat_key = true
}
"--exclude" = {
value = "$systemd_exclude_unit$"
description = "Exclude a systemd unit from the checks. This option can be applied multiple times. Also supports regular expressions."
description = "Exclude a systemd unit from the checks, regular expressions are supported. This option can be applied multiple times."
repeat_key = true
}
"--no-startup-time" = {
set_if = "$systemd_no_startup_time$"
description = "Don’t check the startup time. Using this option the options `systemd_warning` and `systemd_critical` have no effect. (Default: `false`)"
"--exclude-unit" = {
value = "$systemd_exclude_unit_name$"
description = "Exclude a systemd unit from the checks. This option can be applied multiple times."
repeat_key = true
}
"--warning" = {
value = "$systemd_warning$"
description = "Startup time in seconds to result in a warning status. (Default: `60s`)"
"--exclude-type" = {
value = "$systemd_exclude_type$"
description = "Exclude a systemd unit type (for example: `service`, `timer`)"
}
"--critical" = {
value = "$systemd_critical$"
description = "Startup time in seconds to result in a critical status. (Default: `120s`)"
"--state" = {
value = "$systemd_state$"
description = "Specify the active state that the systemd unit must have (for example: `active`, `inactive`)"
}

/* Timers related options */
"--dead-timers" = {
set_if = "$systemd_dead_timers$"
description = "Detect dead / inactive timers. (Default: `false`)"
description = "Detect dead / inactive timers, see `systemd_dead_timers_{warning,critical}`. (Default `false`)"
}
"--dead-timers-warning" = {
value = "$systemd_dead_timers_warning$"
description = "Time ago in seconds for dead / inactive timers to trigger a warning state (by default 6 days)."
description = "Time ago in seconds for dead / inactive timers to trigger a warning state. (Default 6 days)"
}
"--dead-timers-critical" = {
value = "$systemd_dead_timers_critical$"
description = "Time ago in seconds for dead / inactive timers to trigger a critical state (by default 7 days)."
description = "Time ago in seconds for dead / inactive timers to trigger a critical state. (Default 7 days)"
}
"-v" = {
set_if = {{ macro("$systemd_verbose_level$") == 1 }}
description = "Increase verbosity level (Accepted values: `1`, `2` or `3`). Defaults to none."

/* Startup time related options */
"--no-startup-time" = {
set_if = "$systemd_no_startup_time$"
description = "Don't check the startup time. Using this option, the options `systemd_{warning,critical}` have no effect. (Default `false`)"
}
"-vv" = {
set_if = {{ macro("$systemd_verbose_level$") == 2 }}
"--warning" = {
value = "$systemd_warning$"
description = "Startup time in seconds to result in a warning status. (Default 60 seconds)"
}
"-vvv" = {
set_if = {{ macro("$systemd_verbose_level$") == 3 }}
"--critical" = {
value = "$systemd_critical$"
description = "Startup time in seconds to result in a critical status. (Default 120 seconds)"
}

/* Monitoring data acquisition */
"--dbus" = {
set_if = "$systemd_dbus$"
description = "Use systemd's D-Bus API instead of parsing command output. Only partially implemented!"
}
"--cli" = {
set_if = "$systemd_cli$"
description = "Use text output from parsing command output. (Default)"
}
"--user" = {
set_if = "$systemd_user$"
description = "Also show user (systemctl --user) units."
}
}
}

0 comments on commit e7670e9

Please sign in to comment.