Module: check_mk
Branch: master
Commit: 23088515886a1b0706a10c38440cbdda2b0dd5be
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=23088515886a1b…
Author: Mathias Kettner <mk(a)mathias-kettner.de>
Date: Thu Apr 25 16:46:25 2013 +0200
ESX: added simple CPU check for VMs
Not yet finished.
---
agents/special/agent_vsphere | 9 +++++----
checks/esx_vsphere_vm | 36 ++++++++++++++++++++++++++++++++++++
2 files changed, 41 insertions(+), 4 deletions(-)
diff --git a/agents/special/agent_vsphere b/agents/special/agent_vsphere
index a211692..47c4972 100755
--- a/agents/special/agent_vsphere
+++ b/agents/special/agent_vsphere
@@ -639,17 +639,18 @@ if "virtualmachine" in mortypes:
output_mors("virtualmachine", {
"name": str,
"guestHeartbeatStatus": str,
- "summary.quickStats.overallCpuUsage": str,
- "summary.quickStats.overallCpuDemand": str,
"summary.quickStats.uptimeSeconds": str,
+ # CPU Statistics
"summary.quickStats.overallCpuUsage": str,
"summary.quickStats.overallCpuDemand": str,
+ "summary.quickStats.staticCpuEntitlement": str,
+ "summary.quickStats.distributedCpuEntitlement": str,
+
+ # Memory
"summary.quickStats.guestMemoryUsage": str,
"summary.quickStats.hostMemoryUsage": str,
- "summary.quickStats.distributedCpuEntitlement": str,
"summary.quickStats.distributedMemoryEntitlement": str,
- "summary.quickStats.staticCpuEntitlement": str,
"summary.quickStats.staticMemoryEntitlement": str,
"summary.quickStats.privateMemory": str,
"summary.quickStats.sharedMemory": str,
diff --git a/checks/esx_vsphere_vm b/checks/esx_vsphere_vm
index 6921c47..8c9df6f 100644
--- a/checks/esx_vsphere_vm
+++ b/checks/esx_vsphere_vm
@@ -156,3 +156,39 @@ check_info['esx_vsphere_vm.heartbeat'] = {
"service_description" : "ESX Heartbeat",
}
+#.
+# .--CPU-----------------------------------------------------------------.
+# | ____ ____ _ _ |
+# | / ___| _ \| | | | |
+# | | | | |_) | | | | |
+# | | |___| __/| |_| | |
+# | \____|_| \___/ |
+# | |
+# +----------------------------------------------------------------------+
+# | |
+# '----------------------------------------------------------------------'
+
+# <<<esx_vsphere_vm>>>
+# config.hardware.numCPU 8
+# config.hardware.numCoresPerSocket 2
+# summary.quickStats.overallCpuUsage 8
+
+def inventory_esx_vsphere_vm_cpu(info):
+ data = esx_vsphere_vm_convert(info)
+ if 'summary.quickStats.overallCpuUsage' in data:
+ return [(None, None)]
+
+def check_esx_vsphere_vm_cpu(_no_item, _no_params, info):
+ data = esx_vsphere_vm_convert(info)
+ usage_mhz = int(data['summary.quickStats.overallCpuUsage'][0])
+ cpus = int(data['config.hardware.numCPU'][0])
+ return 0, "demand is %.3f Ghz, %d virtual CPUs" % (usage_mhz / 1000.0,
cpus), [ ("demand", usage_mhz) ]
+
+
+
+check_info['esx_vsphere_vm.cpu'] = {
+ "inventory_function" : inventory_esx_vsphere_vm_cpu,
+ "check_function" : check_esx_vsphere_vm_cpu,
+ "service_description" : "ESX CPU",
+ "has_perfdata" : True,
+}