/*
 * Icinga2 CheckCommand definition for check_smart (check_smart.pl) monitoring plugin
 * See https://www.claudiokuenzler.com/monitoring-plugins/check_smart.php
*/

object CheckCommand "check_smart" {
	import "plugin-check-command"
	command = [ "/usr/sbin/sudo", PluginContribDir + "/check_smart.pl" ]
	arguments = {
		"-d" = {
			value = "$smart_device$"
			set_if = {{ macro("$smart_device_is_glob$") == false }}
			description = "A physical block device to be SMART monitored, eg /dev/sda."
		}
		"-g" = {
			value = "$smart_device$"
			set_if = {{ macro("$smart_device_is_glob$") == true }}
			description = "A glob expression of physical devices to be monitored, eg -g '/dev/sd[a-z]'."
		}
		"-i" = {
			value = "$smart_interface$"
			description = "Drive's interface type, must be one of: auto, ata, scsi, nvme, 3ware,N, areca,N, hpt,L/M/N, cciss,N, megaraid,N."
			required = true
		}
		"-r" = {
			value = "$smart_raw_list$"
			description = "List (comma separated, without spaces!) of SMART attributes to check for their raw values."
		}
		"-e" = {
			value = "$smart_exclude_list$"
			description = "List of (comma separated) SMART attributes which should be excluded (=ignored) from checks, but still appear in perfdata."
		}
		"-E" = {
			value = "$smart_exclude_all_list$"
			description = "List of (comma separated) SMART attributes which should be excluded (=ignored) completely from checks and perfdata."
		}
		"-b" = {
			value = "$smart_bad$"
			description = "Threshold value (integer) when to warn for N bad entries (ATA: Current Pending Sector, SCSI: Grown defect list). Note: Deprecated for ATA drives, use `smart_warn` instead. Continue to use this for SCSI drives."
		}
		"-w" = {
			value = "$smart_warn$"
			description = "Comma separated list of thresholds for ATA drives (e.g. `'Reallocated_Sector_Ct=10,Current_Pending_Sector=62'`)."
		}
		"-s" = {
			set_if = "$smart_selftest$"
			description = "If set to true, additionally check SMART's selftest log for errors."
		}
		"-l" = {
			set_if = "$smart_ssd_lifetime$"
			description = "If set to true, additionally check SSD attribute Percent_Lifetime_Remain."
		}
		"-O" = {
			set_if = "$smart_oldage$"
			description = "If set to true, ignore certain oldage attributes related to the drive's usage (not recommended)."
		}
		"-q" = {
			set_if = "$smart_quiet$"
			description = "If set to true, only show failing drive(s) when faults are detected (only affects output when used with `vars.smart_device_is_glob`)."
		}
		"--hide-sn" = {
			set_if = "$smart_hide_sn$"
			description = "If set to true, output does not reveal serial number of drive(s)."
		}
		"--skip-self-assessment" = {
			set_if = "$smart_skip_self_assessment$"
			description = "If set to true, skip the SMART self assessment health check (not recommended)."
		}
		"--skip-temp-check" = {
			set_if = "$smart_skip_temp_check$"
			description = "If set to true, skip temperature comparison current vs. drive max temperature (not recommended)."
		}
		"--skip-load-cycles" = {
			set_if = "$smart_skip_load_cycles$"
			description = "If set to true, skip check of SMART attribute 193 (Load_Cycle_Count), deemed unsafe after reaching 600K load/unload cycles."
		}
		"--skip-error-log" = {
			set_if = "$smart_skip_error_log$"
			description = "If set to true, skip check of SMART Error Log (not recommended)."
		}
	}
	vars.smart_interface = "auto"
	vars.smart_device_is_glob = false
	vars.smart_selftest = false
	vars.smart_ssd_lifetime = false
	vars.smart_quiet = false
}