/*
 * Icinga2 CheckCommand definition for the SMART Advanced (check_smart.pl) Monitoring Plugin
 */

object CheckCommand "smart-advanced" {
	command = [ 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."
		}
		"-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`)."
		}
		"--skip-self-assessment" = {
			set_if = "$smart_skip_self_assessment$"
			description = "If set to true, Skip the SMART self assessment health check (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
}
