/******************************************************************************
 * 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.             *
 ******************************************************************************/

/**
 * main vmware-esx template
 */

template CheckCommand "vmware-esx-command" {
	import "plugin-check-command"

	command = [ PluginContribDir + "/check_vmware_esx" ]

	arguments = {
		"--ignore_unknown" = {
			set_if = "$vmware_ignoreunknown$"
			description = "Sometimes 3 (unknown) is returned from a component. But the check itself is ok. With this option the plugin will return OK (0) instead of UNKNOWN (3)."
		}
		"--ignore_warning" = {
			set_if = "$vmware_ignorewarning$"
			description = "Sometimes 2 (warning) is returned from a component. But the check itself is ok (from an operator view)."
		}
		"--timeout" = {
			value = "$vmware_timeout$"
			description = "Seconds before plugin times out (default: 90)."
		}
		"--trace" = {
			set_if = "$vmware_trace$"
			description = "Set verbosity level of vSphere API request/respond trace."
		}
		"--sessionfile" = {
			value = "$vmware_sessionfile$"
			description = "Vmware auth session file - no efect if $vmware_nosession$ var is true."
		}
		"--sessionfiledir" = {
			value = "$vmware_sessionfiledir$"
			description = "Vmware auth session file directory - no efect if $vmware_nosession$ var is true."
		}
		"--nosession" = {
			set_if = "$vmware_nosession$"
			description = "No auth session - IT SHOULD BE USED FOR TESTING PURPOSES ONLY!."
		}
		"--username" = {
			value = "$vmware_username$"
			description = "Username to connect with."
		}
		"--password" = {
			value = "$vmware_password$"
			description = "Password to use with the username."
		}
		"--authfile" = {
			value = "$vmware_authfile$"
			description = "Autentication file content: \
								username=<username>  \
								password=<password>"
		}
	}

	vars.vmware_timeout = "90"
	vars.vmware_ignorewarning = false
	vars.vmware_auth_nosession = false
	vars.vmware_sessionfiledir = "/var/spool/icinga2/tmp"
}


/**
 * VMware DC
 */

template CheckCommand "vmware-esx-dc" {
	import "vmware-esx-command"

	arguments += {
		"--datacenter" = {
			value = "$vmware_datacenter$"
			required = true
			description = "Datacenter/Vcenter hostname."
		}
		"--sslport" = {
			value = "$vmware_sslport$"
			description = "If a SSL port different from 443 is used."
		}
	}

	vars.vmware_sslport = "443"
}

object CheckCommand "vmware-esx-dc-volumes" {
	import "vmware-esx-dc"

	arguments += {
		"--select" = "volumes"
		"--subselect" = "$vmware_subselect$"
		"--gigabyte" = {
			set_if = "$vmware_gigabyte$"
			description = "Output in GB instead of MB."
		}
		"--usedspace" = {
			set_if = "$vmware_usedspace$"
			description = "Output used space instead of free."
		}
		"--alertonly" = {
			set_if = "$vmware_alertonly$"
			description = "List only alerting volumes."
		}
		"--exclude" = "$vmware_exclude$"
		"--include" = "$vmware_include$"
		"--isregexp" = {
			set_if = "$vmware_isregexp$"
		}
		"--warning" = "$vmware_warn$"
		"--critical" = "$vmware_crit$"
	}

	vars.vmware_usedspace = true
	vars.vmware_alertonly = false
	vars.vmware_warn = "80%"
	vars.vmware_crit = "90%"
}

object CheckCommand "vmware-esx-dc-runtime-info" {
	import "vmware-esx-dc"

	arguments += {
		"--select" = {
			value = "runtime"
			description = "Shows all runtime info for the datacenter/Vcenter."
		}
	}
}

object CheckCommand "vmware-esx-dc-runtime-listvms" {
	import "vmware-esx-dc"

	arguments += {
		"--select" = "runtime"
		"--subselect" = "listvms"
		"--exclude" = "$vmware_exclude$"
		"--include" = "$vmware_include$"
		"--isregexp" = {
			set_if = "$vmware_isregexp$"
		}
		"--multiline" = {
			set_if = "$vmware_multiline$"
		}
		"--alertonly" = {
			set_if = "$vmware_alertonly$"

		}
	}
}

object CheckCommand "vmware-esx-dc-runtime-listhost" {
	import "vmware-esx-dc"

	arguments += {
		"--select" = "runtime"
		"--subselect" = "listhost"
		"--exclude" = "$vmware_exclude$"
		"--include" = "$vmware_include$"
		"--isregexp" = {
			set_if = "$vmware_isregexp$"
		}
		"--multiline" = {
			set_if = "$vmware_multiline$"
		}
		"--alertonly" = {
			set_if = "$vmware_alertonly$"
		}
	}
}

object CheckCommand "vmware-esx-dc-runtime-listcluster" {
	import "vmware-esx-dc"

	arguments += {
		"--select" = "runtime"
		"--subselect" = "listcluster"
		"--exclude" = "$vmware_exclude$"
		"--include" = "$vmware_include$"
		"--isregexp" = {
			set_if = "$vmware_isregexp$"
		}
		"--multiline" = {
			set_if = "$vmware_multiline$"
		}
		"--alertonly" = {
			set_if = "$vmware_alertonly$"
		}
	}
}

object CheckCommand "vmware-esx-dc-runtime-issues" {
	import "vmware-esx-dc"

	arguments += {
		"--select" = "runtime"
		"--subselect" = "issues"
		"--exclude" = "$vmware_exclude$"
		"--include" = "$vmware_include$"
		"--isregexp" = {
			set_if = "$vmware_isregexp$"
		}
		"--multiline" = {
			set_if = "$vmware_multiline$"
		}
	}
}

object CheckCommand "vmware-esx-dc-runtime-status" {
	import "vmware-esx-dc"

	arguments += {
		"--select" = "runtime"
		"--subselect" = "status"
	}
}

object CheckCommand "vmware-esx-dc-runtime-tools" {
	import "vmware-esx-dc"

	arguments += {
		"--select" = "runtime"
		"--subselect" = "tools"
		"--poweredonly" = {
			set_if = "$vmware_poweredonly$"
		}
		"--exclude" = "$vmware_exclude$"
		"--include" = "$vmware_include$"
		"--isregexp" = {
			set_if = "$vmware_isregexp$"
		}
		"--multiline" = {
			set_if = "$vmware_multiline$"
		}
		"--alertonly" = {
			set_if = "$vmware_alertonly$"
		}
		"--open-vm-tools" = {
			set_if = "$vmware_openvmtools$"
		}
	}
}


/**
 * VMware HOST
 */

template CheckCommand "vmware-esx-soap-host" {
	import "vmware-esx-command"

	arguments += {
		"--host" = {
			value = "$vmware_host$"
			required = true
			description = "ESX or ESXi hostname."
		}
		"--sslport" = {
			value = "$vmware_sslport$"
			description = "If a SSL port different from 443 is used."
		}
	}

	vars.vmware_host = "$address$"
	vars.vmware_sslport = "443"
}

object CheckCommand "vmware-esx-soap-host-check" {
	import "vmware-esx-soap-host"

	arguments += {
		"--select" = {
			value = "soap"
			description = "Simple check to verify a successfull connection to VMWare SOAP API."
		}
	}
}

object CheckCommand "vmware-esx-soap-host-uptime" {
	import "vmware-esx-soap-host"

	arguments += {
		"--select" = "uptime"
	}
}

object CheckCommand "vmware-esx-soap-host-cpu" {
	import "vmware-esx-soap-host"

	arguments += {
		"--select" = "cpu"
		"--warning" = "$vmware_warn$"
		"--critical" = "$vmware_crit$"
	}

	vars.vmware_warn = "80%"
	vars.vmware_crit = "90%"
}


object CheckCommand "vmware-esx-soap-host-cpu-ready" {
	import "vmware-esx-soap-host"

	arguments += {
		"--select" = "cpu"
		"--subselect" = "ready"
	}
}

object CheckCommand "vmware-esx-soap-host-cpu-wait" {
	import "vmware-esx-soap-host"

	arguments += {
		"--select" = "cpu"
		"--subselect" = "wait"
	}
}

object CheckCommand "vmware-esx-soap-host-cpu-usage" {
	import "vmware-esx-soap-host"

	arguments += {
		"--select" = "cpu"
		"--subselect" = "usage"
		"--warning" = "$vmware_warn$"
		"--critical" = "$vmware_crit$"
	}

	vars.vmware_warn = "80%"
	vars.vmware_crit = "90%"
}

object CheckCommand "vmware-esx-soap-host-mem" {
	import "vmware-esx-soap-host"

	arguments += {
		"--select" = "mem"
	}
}

object CheckCommand "vmware-esx-soap-host-mem-usage" {
	import "vmware-esx-soap-host"

	arguments += {
		"--select" = "mem"
		"--subselect" = "usage"
		"--warning" = "$vmware_warn$"
		"--critical" = "$vmware_crit$"
	}

	vars.vmware_warn = "80%"
	vars.vmware_crit = "90%"
}

object CheckCommand "vmware-esx-soap-host-mem-consumed" {
	import "vmware-esx-soap-host"

	arguments += {
		"--select" = "mem"
		"--subselect" = "consumed"
		"--warning" = "$vmware_warn$"
		"--critical" = "$vmware_crit$"
	}
}

object CheckCommand "vmware-esx-soap-host-mem-swapused" {
	import "vmware-esx-soap-host"

	arguments += {
		"--select" = "mem"
		"--subselect" = "swapused"
		"--multiline" = {
			set_if = "$vmware_multiline$"
		}
		"--warning" = "$vmware_warn$"
		"--critical" = "$vmware_crit$"
	}
}

object CheckCommand "vmware-esx-soap-host-mem-overhead" {
	import "vmware-esx-soap-host"

	arguments += {
		"--select" = "mem"
		"--subselect" = "overhead"
		"--warning" = "$vmware_warn$"
		"--critical" = "$vmware_crit$"
	}
}

object CheckCommand "vmware-esx-soap-host-mem-memctl" {
	import "vmware-esx-soap-host"

	arguments += {
		"--select" = "mem"
		"--subselect" = "memctl"
		"--multiline" = {
			set_if = "$vmware_multiline$"
		}
		"--warning" = "$vmware_warn$"
		"--critical" = "$vmware_crit$"
	}
}

object CheckCommand "vmware-esx-soap-host-net" {
	import "vmware-esx-soap-host"

	arguments += {
		"--select" = "net"
		"--exclude" = "$vmware_exclude$"
		"--isregexp" = {
			set_if = "$vmware_isregexp$"
		}
	}
}

object CheckCommand "vmware-esx-soap-host-net-usage" {
	import "vmware-esx-soap-host"

	arguments += {
		"--select" = "net"
		"--subselect" = "usage"
		"--warning" = "$vmware_warn$"
		"--critical" = "$vmware_crit$"
	}
}

object CheckCommand "vmware-esx-soap-host-net-receive" {
	import "vmware-esx-soap-host"

	arguments += {
		"--select" = "net"
		"--subselect" = "receive"
		"--warning" = "$vmware_warn$"
		"--critical" = "$vmware_crit$"
	}
}

object CheckCommand "vmware-esx-soap-host-net-send" {
	import "vmware-esx-soap-host"

	arguments += {
		"--select" = "net"
		"--subselect" = "send"
		"--warning" = "$vmware_warn$"
		"--critical" = "$vmware_crit$"
	}
}

object CheckCommand "vmware-esx-soap-host-net-nic" {
	import "vmware-esx-soap-host"

	arguments += {
		"--select" = "net"
		"--subselect" = "nic"
		"--exclude" = "$vmware_exclude$"
		"--isregexp" = {
			set_if = "$vmware_isregexp$"
		}
	}
}

object CheckCommand "vmware-esx-soap-host-volumes" {
	import "vmware-esx-soap-host"

	arguments += {
		"--select" = "volumes"
		"--subselect" = "$vmware_subselect$"
		"--gigabyte" = {
			set_if = "$vmware_gigabyte$"
			description = "Output in GB instead of MB."
		}
		"--usedspace" = {
			set_if = "$vmware_usedspace$"
			description = "Output used space instead of free."
		}
		"--alertonly" = {
			set_if = "$vmware_alertonly$"
			description = "List only alerting volumes."
		}
		"--exclude" = "$vmware_exclude$"
		"--include" = "$vmware_include$"
		"--isregexp" = {
			set_if = "$vmware_isregexp$"
		}
		"--warning" = "$vmware_warn$"
		"--critical" = "$vmware_crit$"
		"--spaceleft" = {
			set_if = "$vmware_spaceleft$"
		}
	}

	vars.vmware_usedspace = true
	vars.vmware_alertonly = false
	vars.vmware_warn = "80%"
	vars.vmware_crit = "90%"
}

object CheckCommand "vmware-esx-soap-host-io" {
	import "vmware-esx-soap-host"

	arguments += {
		"--select" = "io"
	}
}

object CheckCommand "vmware-esx-soap-host-io-aborted" {
	import "vmware-esx-soap-host"

	arguments += {
		"--select" = "io"
		"--subselect" = "aborted"
		"--warning" = "$vmware_warn$"
		"--critical" = "$vmware_crit$"
	}
}

object CheckCommand "vmware-esx-soap-host-io-resets" {
	import "vmware-esx-soap-host"

	arguments += {
		"--select" = "io"
		"--subselect" = "resets"
		"--warning" = "$vmware_warn$"
		"--critical" = "$vmware_crit$"
	}
}

object CheckCommand "vmware-esx-soap-host-io-read" {
	import "vmware-esx-soap-host"

	arguments += {
		"--select" = "io"
		"--subselect" = "read"
		"--warning" = "$vmware_warn$"
		"--critical" = "$vmware_crit$"
	}
}

object CheckCommand "vmware-esx-soap-host-io-read-latency" {
	import "vmware-esx-soap-host"

	arguments += {
		"--select" = "io"
		"--subselect" = "read_latency"
		"--warning" = "$vmware_warn$"
		"--critical" = "$vmware_crit$"
	}
}

object CheckCommand "vmware-esx-soap-host-io-write" {
	import "vmware-esx-soap-host"

	arguments += {
		"--select" = "io"
		"--subselect" = "write"
		"--warning" = "$vmware_warn$"
		"--critical" = "$vmware_crit$"
	}
}

object CheckCommand "vmware-esx-soap-host-io-write-latency" {
	import "vmware-esx-soap-host"

	arguments += {
		"--select" = "io"
		"--subselect" = "write_latency"
		"--warning" = "$vmware_warn$"
		"--critical" = "$vmware_crit$"
	}
}

object CheckCommand "vmware-esx-soap-host-io-usage" {
	import "vmware-esx-soap-host"

	arguments += {
		"--select" = "io"
		"--subselect" = "usage"
		"--warning" = "$vmware_warn$"
		"--critical" = "$vmware_crit$"
	}
}

object CheckCommand "vmware-esx-soap-host-io-kernel-latency" {
	import "vmware-esx-soap-host"

	arguments += {
		"--select" = "io"
		"--subselect" = "kernel_latency"
		"--warning" = "$vmware_warn$"
		"--critical" = "$vmware_crit$"
	}
}

object CheckCommand "vmware-esx-soap-host-io-device-latency" {
	import "vmware-esx-soap-host"

	arguments += {
		"--select" = "io"
		"--subselect" = "device_latency"
		"--warning" = "$vmware_warn$"
		"--critical" = "$vmware_crit$"
	}
}

object CheckCommand "vmware-esx-soap-host-io-queue-latency" {
	import "vmware-esx-soap-host"

	arguments += {
		"--select" = "io"
		"--subselect" = "queue_latency"
		"--warning" = "$vmware_warn$"
		"--critical" = "$vmware_crit$"
	}
}

object CheckCommand "vmware-esx-soap-host-io-total-latency" {
	import "vmware-esx-soap-host"

	arguments += {
		"--select" = "io"
		"--subselect" = "total_latency"
		"--warning" = "$vmware_warn$"
		"--critical" = "$vmware_crit$"
	}
}

object CheckCommand "vmware-esx-soap-host-media" {
	import "vmware-esx-soap-host"

	arguments += {
		"--select" = "hostmedia"
		"--exclude" = "$vmware_exclude$"
		"--include" = "$vmware_include$"
		"--isregexp" = {
			set_if = "$vmware_isregexp$"
		}
		"--multiline" = {
			set_if = "$vmware_multiline$"
		}
	}
}

object CheckCommand "vmware-esx-soap-host-service" {
	import "vmware-esx-soap-host"

	arguments += {
		"--select" = "service"
		"--exclude" = "$vmware_exclude$"
		"--include" = "$vmware_include$"
		"--isregexp" = {
			set_if = "$vmware_isregexp$"
		}
		"--multiline" = {
			set_if = "$vmware_multiline$"
		}
	}
}

object CheckCommand "vmware-esx-soap-host-runtime" {
	import "vmware-esx-soap-host"

	arguments += {
		"--select" = "runtime"
	}
}

object CheckCommand "vmware-esx-soap-host-runtime-con" {
	import "vmware-esx-soap-host"

	arguments += {
		"--select" = "runtime"
		"--subselect" = "con"
	}
}

object CheckCommand "vmware-esx-soap-host-runtime-listvms" {
	import "vmware-esx-soap-host"

	arguments += {
		"--select" = "runtime"
		"--subselect" = "listvms"
		"--exclude" = "$vmware_exclude$"
		"--include" = "$vmware_include$"
		"--isregexp" = {
			set_if = "$vmware_isregexp$"
		}
		"--multiline" = {
			set_if = "$vmware_multiline$"
		}
	}
}

object CheckCommand "vmware-esx-soap-host-runtime-status" {
	import "vmware-esx-soap-host"

	arguments += {
		"--select" = "runtime"
		"--subselect" = "status"
	}
}

object CheckCommand "vmware-esx-soap-host-runtime-health" {
	import "vmware-esx-soap-host"

	arguments += {
		"--select" = "runtime"
		"--subselect" = "health"
		"--exclude" = "$vmware_exclude$"
		"--include" = "$vmware_include$"
		"--isregexp" = {
			set_if = "$vmware_isregexp$"
		}
	}
}

object CheckCommand "vmware-esx-soap-host-runtime-health-listsensors" {
	import "vmware-esx-soap-host"

	arguments += {
		"--select" = "runtime"
		"--subselect" = "health"
		"--exclude" = "$vmware_exclude$"
		"--include" = "$vmware_include$"
		"--isregexp" = {
			set_if = "$vmware_isregexp$"
		}
		"--listsensors" = {}
	}
}

object CheckCommand "vmware-esx-soap-host-runtime-health-nostoragestatus" {
	import "vmware-esx-soap-host"

	arguments += {
		"--select" = "runtime"
		"--subselect" = "health"
		"--exclude" = "$vmware_exclude$"
		"--include" = "$vmware_include$"
		"--isregexp" = {
			set_if = "$vmware_isregexp$"
		}
		"--nostoragestatus" = {}
	}
}

object CheckCommand "vmware-esx-soap-host-runtime-storagehealth" {
	import "vmware-esx-soap-host"

	arguments += {
		"--select" = "runtime"
		"--subselect" = "storagehealth"
		"--exclude" = "$vmware_exclude$"
		"--include" = "$vmware_include$"
		"--isregexp" = {
			set_if = "$vmware_isregexp$"
		}
		"--multiline" = {
			set_if = "$vmware_multiline$"
		}
	}
}

object CheckCommand "vmware-esx-soap-host-runtime-temp" {
	import "vmware-esx-soap-host"

	arguments += {
		"--select" = "runtime"
		"--subselect" = "temp"
		"--exclude" = "$vmware_exclude$"
		"--include" = "$vmware_include$"
		"--isregexp" = {
			set_if = "$vmware_isregexp$"
		}
		"--multiline" = {
			set_if = "$vmware_multiline$"
		}
	}
}

object CheckCommand "vmware-esx-soap-host-runtime-issues" {
	import "vmware-esx-soap-host"

	arguments += {
		"--select" = "runtime"
		"--subselect" = "issues"
		"--exclude" = "$vmware_exclude$"
		"--include" = "$vmware_include$"
		"--isregexp" = {
			set_if = "$vmware_isregexp$"
		}
		"--multiline" = {
			set_if = "$vmware_multiline$"
		}
	}
}

object CheckCommand "vmware-esx-soap-host-storage" {
	import "vmware-esx-soap-host"

	arguments += {
		"--select" = "storage"
		"--exclude" = "$vmware_exclude$"
		"--include" = "$vmware_include$"
		"--isregexp" = {
			set_if = "$vmware_isregexp$"
		}
	}
}

object CheckCommand "vmware-esx-soap-host-storage-adapter" {
	import "vmware-esx-soap-host"

	arguments += {
		"--select" = "storage"
		"--subselect" = "adapter"
		"--exclude" = "$vmware_exclude$"
		"--include" = "$vmware_include$"
		"--isregexp" = {
			set_if = "$vmware_isregexp$"
		}
		"--multiline" = {
			set_if = "$vmware_multiline$"
		}
	}
}

object CheckCommand "vmware-esx-soap-host-storage-lun" {
	import "vmware-esx-soap-host"

	arguments += {
		"--select" = "storage"
		"--subselect" = "lun"
		"--exclude" = "$vmware_exclude$"
		"--include" = "$vmware_include$"
		"--isregexp" = {
			set_if = "$vmware_isregexp$"
		}
		"--alertonly" = {
			set_if = "$vmware_alertonly$"
		}
		"--multiline" = {
			set_if = "$vmware_multiline$"
		}
	}
}


object CheckCommand "vmware-esx-soap-host-storage-path" {
	import "vmware-esx-soap-host"

	arguments += {
		"--select" = "storage"
		"--subselect" = "path"
		"--exclude" = "$vmware_exclude$"
		"--include" = "$vmware_include$"
		"--isregexp" = {
			set_if = "$vmware_isregexp$"
		}
		"--alertonly" = {
			set_if = "$vmware_alertonly$"
		}
		"--multiline" = {
			set_if = "$vmware_multiline$"
		}
	}
}

/**
 * VMware VM
 */
template CheckCommand "vmware-esx-soap-vm" {
	import "vmware-esx-command"

	arguments += {
		"--datacenter" = {
			value = "$vmware_datacenter$"
			description = "Datacenter/Vcenter hostname."
		}
		"--host" = {
			value = "$vmware_host$"
			description = "ESX or ESXi hostname."
		}
		"--name" = {
			value = "$vmware_vmname$"
			required = true
			description = "Virtual machine name."
		}
		"--sslport" = {
			value = "$vmware_sslport$"
			description = "If a SSL port different from 443 is used."
		}
	}

	vars.vmware_host = "$address$"
	vars.vmware_sslport = "443"
}

object CheckCommand "vmware-esx-soap-vm-cpu" {
	import "vmware-esx-soap-vm"

	arguments += {
		"--select" = "cpu"
	}
}

object CheckCommand "vmware-esx-soap-vm-cpu-ready" {
	import "vmware-esx-soap-vm"

	arguments += {
		"--select" = "cpu"
		"--subselect" = "ready"
		"--warning" = "$vmware_warn$"
		"--critical" = "$vmware_crit$"
	}
}

object CheckCommand "vmware-esx-soap-vm-cpu-wait" {
	import "vmware-esx-soap-vm"

	arguments += {
		"--select" = "cpu"
		"--subselect" = "wait"
		"--warning" = "$vmware_warn$"
		"--critical" = "$vmware_crit$"
	}
}

object CheckCommand "vmware-esx-soap-vm-cpu-usage" {
	import "vmware-esx-soap-vm"

	arguments += {
		"--select" = "cpu"
		"--subselect" = "usage"
		"--warning" = "$vmware_warn$"
		"--critical" = "$vmware_crit$"
	}

	vars.vmware_warn = "80%"
	vars.vmware_crit = "90%"
}

object CheckCommand "vmware-esx-soap-vm-mem" {
	import "vmware-esx-soap-vm"

	arguments += {
		"--select" = "mem"
	}
}

object CheckCommand "vmware-esx-soap-vm-mem-usage" {
	import "vmware-esx-soap-vm"

	arguments += {
		"--select" = "mem"
		"--subselect" = "usage"
		"--warning" = "$vmware_warn$"
		"--critical" = "$vmware_crit$"
	}

	vars.vmware_warn = "80%"
	vars.vmware_crit = "90%"
}

object CheckCommand "vmware-esx-soap-vm-mem-consumed" {
	import "vmware-esx-soap-vm"

	arguments += {
		"--select" = "mem"
		"--subselect" = "consumed"
		"--warning" = "$vmware_warn$"
		"--critical" = "$vmware_crit$"
	}
}

object CheckCommand "vmware-esx-soap-vm-mem-memctl" {
	import "vmware-esx-soap-vm"

	arguments += {
		"--select" = "mem"
		"--subselect" = "memctl"
		"--warning" = "$vmware_warn$"
		"--critical" = "$vmware_crit$"
	}
}

object CheckCommand "vmware-esx-soap-vm-net" {
	import "vmware-esx-soap-vm"

	arguments += {
		"--select" = "net"
	}
}

object CheckCommand "vmware-esx-soap-vm-net-usage" {
	import "vmware-esx-soap-vm"

	arguments += {
		"--select" = "net"
		"--subselect" = "usage"
		"--warning" = "$vmware_warn$"
		"--critical" = "$vmware_crit$"
	}
}

object CheckCommand "vmware-esx-soap-vm-net-receive" {
	import "vmware-esx-soap-vm"

	arguments += {
		"--select" = "net"
		"--subselect" = "receive"
		"--warning" = "$vmware_warn$"
		"--critical" = "$vmware_crit$"
	}
}

object CheckCommand "vmware-esx-soap-vm-net-send" {
	import "vmware-esx-soap-vm"

	arguments += {
		"--select" = "net"
		"--subselect" = "send"
		"--warning" = "$vmware_warn$"
		"--critical" = "$vmware_crit$"
	}
}

object CheckCommand "vmware-esx-soap-vm-io" {
	import "vmware-esx-soap-vm"

	arguments += {
		"--select" = "io"
	}
}

object CheckCommand "vmware-esx-soap-vm-io-read" {
	import "vmware-esx-soap-vm"

	arguments += {
		"--select" = "io"
		"--subselect" = "read"
		"--warning" = "$vmware_warn$"
		"--critical" = "$vmware_crit$"
	}
}

object CheckCommand "vmware-esx-soap-vm-io-write" {
	import "vmware-esx-soap-vm"

	arguments += {
		"--select" = "io"
		"--subselect" = "write"
		"--warning" = "$vmware_warn$"
		"--critical" = "$vmware_crit$"
	}
}

object CheckCommand "vmware-esx-soap-vm-io-usage" {
	import "vmware-esx-soap-vm"

	arguments += {
		"--select" = "io"
		"--subselect" = "usage"
		"--warning" = "$vmware_warn$"
		"--critical" = "$vmware_crit$"
	}
}

object CheckCommand "vmware-esx-soap-vm-runtime" {
	import "vmware-esx-soap-vm"

	arguments += {
		"--select" = "runtime"
	}
}

object CheckCommand "vmware-esx-soap-vm-runtime-con" {
	import "vmware-esx-soap-vm"

	arguments += {
		"--select" = "runtime"
		"--subselect" = "con"
	}
}

object CheckCommand "vmware-esx-soap-vm-runtime-powerstate" {
	import "vmware-esx-soap-vm"

	arguments += {
		"--select" = "runtime"
		"--subselect" = "powerstate"
	}
}

object CheckCommand "vmware-esx-soap-vm-runtime-status" {
	import "vmware-esx-soap-vm"

	arguments += {
		"--select" = "runtime"
		"--subselect" = "status"
	}
}

object CheckCommand "vmware-esx-soap-vm-runtime-consoleconnections" {
	import "vmware-esx-soap-vm"

	arguments += {
		"--select" = "runtime"
		"--subselect" = "consoleconnections"
		"--warning" = "$vmware_warn$"
		"--critical" = "$vmware_crit$"
	}
}

object CheckCommand "vmware-esx-soap-vm-runtime-gueststate" {
	import "vmware-esx-soap-vm"

	arguments += {
		"--select" = "runtime"
		"--subselect" = "gueststate"
	}
}

object CheckCommand "vmware-esx-soap-vm-runtime-tools" {
	import "vmware-esx-soap-vm"

	arguments += {
		"--select" = "runtime"
		"--subselect" = "tools"
		"--open-vm-tools" = {
			set_if = "$vmware_openvmtools$"
		}
	}
}

object CheckCommand "vmware-esx-soap-vm-runtime-issues" {
	import "vmware-esx-soap-vm"

	arguments += {
		"--select" = "runtime"
		"--subselect" = "issues"
		"--multiline" = {
			set_if = "$vmware_multiline$"
		}
	}
}
