Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

check_systemd: Fix executable name and include latest arguments #10035

Merged
merged 2 commits into from
Sep 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions doc/03-monitoring-basics.md
Original file line number Diff line number Diff line change
Expand Up @@ -2135,7 +2135,7 @@ In order to find out about the command argument, call the plugin's help
or consult the README.

```
./check_systemd.py --help
./check_systemd --help

...

Expand Down Expand Up @@ -2194,7 +2194,7 @@ With the [example above](03-monitoring-basics.md#command-arguments-value),
inspect the parameter's help text.

```
./check_systemd.py --help
./check_systemd --help

...

Expand Down
8 changes: 4 additions & 4 deletions doc/05-service-monitoring.md
Original file line number Diff line number Diff line change
Expand Up @@ -281,10 +281,10 @@ that [it works](05-service-monitoring.md#service-monitoring-plugins-it-works). T
`--help` parameter to see the actual parameters (docs might be outdated).

```
./check_systemd.py --help
./check_systemd --help

usage: check_systemd.py [-h] [-c SECONDS] [-e UNIT | -u UNIT] [-v] [-V]
[-w SECONDS]
usage: check_systemd [-h] [-c SECONDS] [-e UNIT | -u UNIT] [-v] [-V]
[-w SECONDS]

...

Expand Down Expand Up @@ -319,7 +319,7 @@ Start with the basic plugin call without any parameters.

```
object CheckCommand "systemd" { // Plugin name without 'check_' prefix
command = [ PluginContribDir + "/check_systemd.py" ] // Use the 'PluginContribDir' constant, see the contributed ITL commands
command = [ PluginContribDir + "/check_systemd" ] // Use the 'PluginContribDir' constant, see the contributed ITL commands
}
```

Expand Down
37 changes: 24 additions & 13 deletions doc/10-icinga-template-library.md
Original file line number Diff line number Diff line change
Expand Up @@ -3652,22 +3652,33 @@ iostat\_cwrite | **Required.** Critical threshold for KB/s writes (default: 200)

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

The [check_systemd.py](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.
The [check_systemd](https://github.com/Josef-Friedrich/check_systemd) plugin
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
90 changes: 69 additions & 21 deletions itl/plugins-contrib.d/systemd.conf
Original file line number Diff line number Diff line change
@@ -1,51 +1,99 @@
/* Icinga 2 | (c) 2012 Icinga GmbH | GPLv2+ */

object CheckCommand "systemd" {
command = [ PluginContribDir + "/check_systemd.py" ]
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."
}
}
}
Loading