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 May 8, 2024
1 parent a219436 commit 104ef2c
Showing 1 changed file with 107 additions and 24 deletions.
131 changes: 107 additions & 24 deletions itl/plugins-contrib.d/systemd.conf
Original file line number Diff line number Diff line change
Expand Up @@ -4,48 +4,131 @@ 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" = {
value = "$systemd_ignore_inactive_state$"
description = {{{Ignore an inactive state on a specific unit. Oneshot
services for example are only active while running and
not enabled. The rest of the time they are inactive.
This option has only an affect if it is used with the
option -u.}}}
}
"--include" = {
value = "$systemd_include$"
description = {{{Include systemd units to the checks. This option can be
applied multiple times, for example: -I mnt-data.mount
-I task.service. Regular expressions can be used to
include multiple units at once, for example: -i
'user@\d+\.service'. For more informations see the
Python documentation about regular expressions
(https://docs.python.org/3/library/re.html).}}}
repeat_key = true
}
"--unit" = {
value = "$systemd_unit$"
description = "Name of the systemd unit that is being tested."
}
"--include-type" = {
value = "$systemd_include_type$"
description = "One or more unit types (for example: 'service', 'timer')"
}
"--exclude" = {
value = "$systemd_exclude_unit$"
description = "Exclude a systemd unit from the checks. This option can be applied multiple times. Also supports regular expressions."
value = "$systemd_exclude$"
description = {{{Exclude a systemd unit from the checks. This option can
be applied multiple times, for example: -e mnt-
data.mount -e task.service. Regular expressions can be
used to exclude multiple units at once, for example: -e
'user@\d+\.service'. For more informations see the
Python documentation about regular expressions
(https://docs.python.org/3/library/re.html).}}}
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$"
description = "Name of the systemd unit that is being tested."
}
"--warning" = {
value = "$systemd_warning$"
description = "Startup time in seconds to result in a warning status. (Default: `60s`)"
"--exclude-type" = {
value = "$systemd_exclude_type$"
description = "One or more unit types (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`)"
value = "$systemd_dead_timers$"
description = {{{Detect dead / inactive timers. See the corresponding
options '-W, --dead-timer-warning' and '-C, --dead-
timers-critical'. Dead timers are detected by parsing
the output of 'systemctl list-timers'. Dead timer rows
displaying 'n/a' in the NEXT and LEFT columns and the
time span in the column PASSED exceeds the values
specified with the options '-W, --dead-timer-warning'
and '-C, --dead-timers-critical'.}}}
}
"--dead-timers-warning" = {
"--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 (by default 6 days).}}}
}
"--dead-timers-critical" = {
"--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 (by 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" = {
value = "$systemd_no_startup_time$"
description = {{{Don’t check the startup time. Using this option the
options '-w, --warning' and '-c, --critical' have no
effect. Performance data about the startup time is
collected, but no critical, warning etc. states are
triggered.}}}
}
"-vv" = {
set_if = {{ macro("$systemd_verbose_level$") == 2 }}
"--warning" = {
value = "$systemd_warning$"
description = {{{Startup time in seconds to result in a warning status.
The default is 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.
The default is 120 seconds.}}}
}

/* Monitoring data acquisition */
"--dbus" = {
value = "$systemd_dbus$"
description = {{{Use the systemd’s D-Bus API instead of parsing the text
output of various systemd related command line
interfaces to monitor systemd. At the moment the D-Bus
backend of this plugin is only partially implemented.}}}
}
"--cli" = {
value = "$systemd_cli$"
description = {{{Use the text output of serveral systemd command line
interface (cli) binaries to gather the required data for
the monitoring process.}}}
}
"--user" = {
value = "$systemd_user$"
description = "Also show user (systemctl --user) units."
}
}
}

0 comments on commit 104ef2c

Please sign in to comment.