/******************************************************************************
 * Icinga 2                                                                   *
 * Copyright (C) 2012-2016 Icinga Development Team (https://www.icinga.org/)  *
 *                                                                            *
 * This program is free software; you can redistribute it and/or              *
 * modify it under the terms of the GNU General Public License                *
 * as published by the Free Software Foundation; either version 2             *
 * of the License, or (at your option) any later version.                     *
 *                                                                            *
 * This program is distributed in the hope that it will be useful,            *
 * but WITHOUT ANY WARRANTY; without even the implied warranty of             *
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the              *
 * GNU General Public License for more details.                               *
 *                                                                            *
 * You should have received a copy of the GNU General Public License          *
 * along with this program; if not, write to the Free Software Foundation     *
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.             *
 ******************************************************************************/

object CheckCommand "disk-windows" {
	import "plugin-check-command"
	
	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"
		}
	}
	
	vars.disk_win_unit = "mb"
	//The default
}
	
object CheckCommand "load-windows" {
	import "plugin-check-command"
	
	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" {
	import "plugin-check-command"
	
	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"
		}
	}
	vars.memory_win_unit = "mb"
	//The default
}

object CheckCommand "network-windows" {
	import "plugin-check-command"
	
	command = [ PluginDir + "/check_network.exe" ]
	
	arguments = {
		"-w" = {
			value = "$network_win_warn$"
			description = "Warning threshold"
		}
		"-c" = {
			value = "$network_win_crit$"
			description = "Critical threshold"
		}
	}
}

object CheckCommand "perfmon-windows" {
	import "plugin-check-command"
	
	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"
		}
	}
	
	vars.performance_win_wait = 1000
	vars.perfmon_win_type = "double"
	//The default values
}


template CheckCommand "ping-common-windows" {
	import "plugin-check-command"

	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"
	//The default values
}

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" {
	import "plugin-check-command"
	
	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" {
	import "plugin-check-command"
	
	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"
		}
	}
}

object CheckCommand "swap-windows" {
	import "plugin-check-command"
	
	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"
		}
	}
	
	vars.swap_win_unit = "mb"
	//The default
}

object CheckCommand "update-windows" {
	import "plugin-check-command"
	
	command = [ PluginDir + "/check_update.exe" ]
	
	arguments = {
		"-w" = {
			set_if = "$update_win_warn$"
			description = "Warn if there are important updates available"
		}
		"-c" = {
			set_if = "$update_win_crit$"
			description = "Critical if there are important updates that require a reboot"
		}
		"--possible-reboot" = {
			set_if = "$update_win_reboot$"
			description = "Treat 'may need update' as 'definitely needs update'"
		}
	}

	timeout = 5m
}

object CheckCommand "uptime-windows" {
	import "plugin-check-command"
	
	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"
	//The default
}

object CheckCommand "users-windows" {
	import "plugin-check-command"
	
	command = [ PluginDir + "/check_users.exe" ]
	
	arguments = {
		"-w" = {
			value = "$users_win_warn$"
			description = "Warning threshold"
		}
		"-c" = {
			value = "$users_win_crit$"
			description = "Critical threshold"
		}
	}
}
