/* Icinga 2 | (c) 2012 Icinga GmbH | GPLv2+ */

object CheckCommand "disk-windows" {
	command = [ PluginDir + "/check_disk.exe" ]

	arguments = {
		"-w" = {
			value = "$disk_win_warn$"
			description = "Warning threshold"
		}
		"-c" = {
			value = "$disk_win_crit$"
			description = "Critical threshold"
		}
		"-p" = {
			value = "$disk_win_path$"
			description = "Optional paths to check"
			repeat_key = true
		}
		"-u" = {
			value = "$disk_win_unit$"
			description = "Use this unit to display disk space"
		}
		"-x" = {
			value = "$disk_win_exclude$"
			description = "Exclude these drives from check"
		}
		"-U" = {
			set_if = "$disk_win_show_used$"
			description = "Work with used instead of free space"
		}
	}

	//The default
	vars.disk_win_unit = "mb"
	vars.disk_win_warn = "20%"
	vars.disk_win_crit = "10%"
}

object CheckCommand "load-windows" {
	command = [ PluginDir + "/check_load.exe" ]

	arguments = {
		"-w" = {
			value = "$load_win_warn$"
			description = "Warning threshold"
		}
		"-c" = {
			value = "$load_win_crit$"
			description = "Critical threshold"
		}
	}
}

object CheckCommand "memory-windows" {
	command = [ PluginDir + "/check_memory.exe" ]

	arguments = {
		"-w" = {
			value = "$memory_win_warn$"
			description = "Warning Threshold"
		}
		"-c" = {
			value = "$memory_win_crit$"
			description = "Critical Threshold"
		}
		"-u" = {
			value = "$memory_win_unit$"
			description = "Use this unit to display memory"
		}
		"-U" = {
                        set_if = "$memory_win_show_used$"
                        description = "Show used memory instead of the free memory"
                }
	}

	//The default
	vars.memory_win_unit = "mb"
	vars.memory_win_warn = "10%"
	vars.memory_win_crit = "5%"
}

object CheckCommand "network-windows" {
	command = [ PluginDir + "/check_network.exe" ]

	arguments = {
		"-w" = {
			value = "$network_win_warn$"
			description = "Warning threshold"
		}
		"-c" = {
			value = "$network_win_crit$"
			description = "Critical threshold"
		}
		"-n" = {
			set_if = "$network_no_isatap$"
			description = "Don't show ISATAP interfaces in output"
		}
	}
	vars.network_no_isatap = true
}

object CheckCommand "perfmon-windows" {
	command = [ PluginDir + "/check_perfmon.exe" ]

	arguments = {
		"-w" = {
			value = "$perfmon_win_warn$"
			description = "Warning threshold"
		}
		"-c" = {
			value = "$perfmon_win_crit$"
			description = "Critical threshold"
		}
		"-P" = {
			value = "$perfmon_win_counter$"
			description = "The Performance Counter string"
			required = true
		}
		"--performance-wait" = {
			value = "$perfmon_win_wait$"
			description = "Wait time between two counter collections in ms"
		}
		"--fmt-countertype" = {
			value = "$perfmon_win_type$"
			description = "Performance counter type"
		}
		"--perf-syntax" = {
			value = "$perfmon_win_syntax$"
			description = "Use this instead of the counter name in the perfomance data"
		}
	}

	vars.performance_win_wait = 1000
	vars.perfmon_win_type = "double"
}


template CheckCommand "ping-common-windows" {
	command = [ PluginDir + "/check_ping.exe" ]

	arguments = {
		"-H" = {
			value = "$ping_win_address$"
			required = true
			description = "Address to ping"
		}
		"-w" = {
			value = "$ping_win_wrta$,$ping_win_wpl$%"
			description = "Warning threshold: RTA and package loss seperated by comma"
		}
		"-c" = {
			value = "$ping_win_crta$,$ping_win_cpl$%"
			description = "Warning threshold: RTA and package loss seperated by comma"
		}
		"-p" = {
			value = "$ping_win_packets$"
			description = "Number of packages to send"
		}
		"-t" = {
			value = "$ping_win_timeout$"
			description = "Timeout in ms"
		}
	}

	vars.ping_win_packets = "5"
	vars.ping_win_timeout = "1000"
}

object CheckCommand "ping-windows" {
	import "ping-common-windows"
	import "ipv4-or-ipv6"

	vars.ping_win_address = "$check_address$"
}

object CheckCommand "ping4-windows" {
	import "ping-common-windows"

	command += [ "-4" ]

	vars.ping_win_address = "$address$"
}

object CheckCommand "ping6-windows" {
	import "ping-common-windows"

	command += [ "-6" ]

	vars.ping_win_address = "$address6$"
}

object CheckCommand "procs-windows" {
	command = [ PluginDir + "/check_procs.exe" ]

	arguments = {
		"-w" = {
			value = "$procs_win_warn$"
			description = "Warning threshold"
		}
		"-c" = {
			value = "$procs_win_crit$"
			description = "Critical threshold"
		}
		"-u" = {
			value = "$procs_win_user$"
			description = "Count only procs of this user"
		}
	}
}

object CheckCommand "service-windows" {
	command = [ PluginDir + "/check_service.exe" ]

	arguments = {
		"-w" = {
			set_if = "$service_win_warn$"
			description = "Warn instead of critical when service is not running"
		}
		"-s" = {
			value = "$service_win_service$"
			required = true
			description = "Service to check"
		}
		"--description" = {
			set_if = "$service_win_description$"
			description = "Use service description instead of name"
		}
	}
}

object CheckCommand "swap-windows" {
	command = [ PluginDir + "/check_swap.exe" ]

	arguments = {
		"-w" = {
			value = "$swap_win_warn$"
			description = "Warning threshold"
		}
		"-c" = {
			value = "$swap_win_crit$"
			description = "Critical threshold"
		}
		"-u" = {
			value = "$swap_win_unit$"
			description = "Unit to display swap in"
		}
		"-U" = {
			set_if = "$swap_win_show_used$"
			description = "Show used swap instead of the free swap"
		}
	}

	// Default
	vars.swap_win_unit = "mb"
	vars.swap_win_warn = "10%"
	vars.swap_win_crit = "5%"
}

object CheckCommand "update-windows" {
	command = [ PluginDir + "/check_update.exe" ]

	arguments = {
		"-w" = {
			value = "$update_win_warn$"
			description = "Number of updates to trigger a warning"
		}
		"-c" = {
			value = "$update_win_crit$"
			description = "Number of updates to trigger a critical"
		}
		"--possible-reboot" = {
			set_if = "$update_win_reboot$"
			description = "Treat 'may need update' as 'definitely needs update'"
		}
		"--no-reboot-critical" = {
			set_if = "$ignore_reboot$"
			description = "Do not automatically return critical if an update requiring reboot is present."
		}
	}

	timeout = 5m
}

object CheckCommand "uptime-windows" {
	command = [ PluginDir + "/check_uptime.exe" ]

	arguments = {
		"-w" = {
			value = "$uptime_win_warn$"
			description = "Warning threshold"
		}
		"-c" = {
			value = "$uptime_win_crit$"
			description = "Critical threshold"
		}
		"-u" = {
			value = "$uptime_win_unit$"
			description = "Time unit to use"
		}
	}

	vars.uptime_win_unit = "s"
}

object CheckCommand "users-windows" {
	command = [ PluginDir + "/check_users.exe" ]

	arguments = {
		"-w" = {
			value = "$users_win_warn$"
			description = "Warning threshold"
		}
		"-c" = {
			value = "$users_win_crit$"
			description = "Critical threshold"
		}
	}
}
