// SPDX-FileCopyrightText: 2012 Icinga GmbH <https://icinga.com>
// SPDX-License-Identifier: GPL-2.0-or-later

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, regular expressions are supported. This option can be applied multiple times."
			repeat_key = true
		}
		"--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
		}
		"--exclude-type" = {
			value = "$systemd_exclude_type$"
			description = "Exclude a systemd unit type (for example: `service`, `timer`)"
		}
		"--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, 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. (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. (Default 7 days)"
		}

		/* 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`)"
		}
		"--warning" = {
			value = "$systemd_warning$"
			description = "Startup time in seconds to result in a warning status. (Default 60 seconds)"
		}
		"--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."
		}
	}
}
