re-implantation of previously removed
Message-ID: <54cb49e2.ixh7cG+G7iOpy4NZ%bk(a)mathias-kettner.de>
User-Agent: Heirloom mailx 12.5 6/20/10
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Module: check_mk
Branch: master
Commit: cf463f31eaac2d850cb7c9ae7c3d930136b8404f
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=cf463f31eaac2d…
Author: Bastian Kuhn <bk(a)mathias-kettner.de>
Date: Fri Jan 30 09:58:37 2015 +0100
esx_vsphere_objects.count: re-implantation of previously removed
---
checkman/esx_vsphere_objects.count | 16 ++++++++++++++++
checks/esx_vsphere_objects | 25 +++++++++++++++++++++++++
2 files changed, 41 insertions(+)
diff --git a/checkman/esx_vsphere_objects.count b/checkman/esx_vsphere_objects.count
new file mode 100644
index 0000000..7784bb3
--- /dev/null
+++ b/checkman/esx_vsphere_objects.count
@@ -0,0 +1,16 @@
+title: VMWare ESX: Number of Virtualmachnies and Hostssystems
+agents: vsphere
+catalog: os/misc
+license: GPL
+distribution: check_mk
+description:
+ This Check only counts the nubmer of Virtualmachines on a Hostsystem, or the number of
+ Virtualmachines and Hostsystems on a vCenter.
+ It's always {OK}
+
+inventory:
+ One service will be created
+
+perfdata:
+ One graph for vms and one for hosts
+
diff --git a/checks/esx_vsphere_objects b/checks/esx_vsphere_objects
index 8dfba7a..d53f777 100644
--- a/checks/esx_vsphere_objects
+++ b/checks/esx_vsphere_objects
@@ -110,6 +110,31 @@ check_info['esx_vsphere_objects'] = {
"group" : "esx_vsphere_objects",
}
+def inventory_esx_vsphere_objects_count(info):
+ return [(None, None)]
+
+def check_esx_vsphere_objects_count(_no_item, _no_params, info):
+ virtualmachines = 0
+ hostsystems = 0
+ for line in info:
+ if line[0] == 'hostsystem':
+ hostsystems += 1
+ elif line[0] == 'virtualmachine':
+ virtualmachines += 1
+ messages = "Virtualmachines: %d" % virtualmachines
+ perfdata = [('vms', virtualmachines)]
+ if hostsystems > 1:
+ messages += ", Hostsystems: %d" % hostsystems
+ perfdata.append(('hosts', hostsystems))
+ return 0, messages, perfdata
+
+
+check_info['esx_vsphere_objects.count'] = {
+ "inventory_function" : inventory_esx_vsphere_objects_count,
+ "check_function" : check_esx_vsphere_objects_count,
+ "service_description" : "Object count",
+ "has_perfdata" : True,
+}
# .--Cluster-------------------------------------------------------------.
# | ____ _ _ |
# | / ___| |_ _ ___| |_ ___ _ __ |