Module: check_mk
Branch: master
Commit: 893eb49cb5b1aebc5e5507addef380a0f3c16c86
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=893eb49cb5b1ae…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Mon Apr 29 14:57:14 2013 +0200
Added esx vsphere ramdisk check
---
agents/special/agent_vsphere | 87 +++++++++++++++++++--------------
checkman/esx_vsphere_counters.ramdisk | 19 +++++++
checks/esx_vsphere_counters | 48 ++++++++++++++++++
3 files changed, 116 insertions(+), 38 deletions(-)
diff --git a/agents/special/agent_vsphere b/agents/special/agent_vsphere
index 47c4972..0be9c33 100755
--- a/agents/special/agent_vsphere
+++ b/agents/special/agent_vsphere
@@ -203,10 +203,13 @@ if error:
sys.stderr.write(error + "\n")
sys.exit(error_exit)
+esx_version = host.get_api_version()
+esx_version_num = float(esx_version)
+
print "<<<check_mk>>>"
-print "Version: %s" % host.get_api_version()
+print "Version: %s" % esx_version
print "AgentOs: %s " % host.get_server_type()
-
+
# Prepare list of all hosts systems
all_hosts = host.get_hosts()
@@ -434,45 +437,53 @@ def output_hostsystem_counters():
# a couple of seconds. To check out which counters are available just comment
out
# the hardcoded needed_ids and uncomment the following three lines of code. This
will
# give you a) A dict of name to id mappings and b) Current values of all
counters.
- # counterids = pm.get_entity_counters(mor)
- # needed_ids = counterids.keys() # retrieve all ids....
- # print counterids
+ #counterids = pm.get_entity_counters(mor)
+ #needed_ids = counterids.keys() # retrieve all ids....
+ #print counterids
needed_ids = [
- # net.*
- 196616, 196621, 196617, 196625, 196619, 196623, 196609, 196614,
- 196620, 196624, 196615, 196622, 196618, 196612, 196613, 196626,
- # sys.uptime
- 262144,
- # mem.*
- # 65635, 65537, 65577, 65625, 65545, 65611, 65573, 65615, 65582,
- # 65549, 65630, 65622, 65618, 65621, 65561, 65623, 65632, 65557,
- # 65628, 65633, 65541, 65643, 65586, 65553, 65569, 65589, 65639,
- # 65620, 65599, 65580, 65619, 65603,
- # 'disk.deviceLatency': 131091,
- # 'disk.deviceReadLatency': 131083,
- # 'disk.deviceWriteLatency': 131087,
- # 'disk.kernelLatency': 131092,
- # 'disk.kernelReadLatency': 131084,
- # 'disk.kernelWriteLatency': 131088,
- # 'disk.maxQueueDepth': 131096,
- # 'disk.maxTotalLatency': 131095,
- # 'disk.numberRead': 131076,
- # 'disk.numberReadAveraged': 131097,
- # 'disk.numberWrite': 131077,
- # 'disk.numberWriteAveraged': 131098,
- # 'disk.queueLatency': 131094,
- # 'disk.queueReadLatency': 131086,
- # 'disk.queueWriteLatency': 131090,
- # 'disk.read': 131078,
- # 'disk.totalLatency': 131093,
- # 'disk.totalReadLatency': 131085,
- # 'disk.totalWriteLatency': 131089,
- # 'disk.usage': 131073,
-
- # disk.read/write/deviceLatency/numberRead/numberWrite
- 131078, 131079, 131091, 131076, 131077,
+ # net.*
+ 196616, 196621, 196617, 196625, 196619, 196623, 196609, 196614,
+ 196620, 196624, 196615, 196622, 196618, 196612, 196613, 196626,
+ # sys.uptime
+ 262144,
+ # mem.*
+ # 65635, 65537, 65577, 65625, 65545, 65611, 65573, 65615, 65582,
+ # 65549, 65630, 65622, 65618, 65621, 65561, 65623, 65632, 65557,
+ # 65628, 65633, 65541, 65643, 65586, 65553, 65569, 65589, 65639,
+ # 65620, 65599, 65580, 65619, 65603,
+ # 'disk.deviceLatency': 131091,
+ # 'disk.deviceReadLatency': 131083,
+ # 'disk.deviceWriteLatency': 131087,
+ # 'disk.kernelLatency': 131092,
+ # 'disk.kernelReadLatency': 131084,
+ # 'disk.kernelWriteLatency': 131088,
+ # 'disk.maxQueueDepth': 131096,
+ # 'disk.maxTotalLatency': 131095,
+ # 'disk.numberRead': 131076,
+ # 'disk.numberReadAveraged': 131097,
+ # 'disk.numberWrite': 131077,
+ # 'disk.numberWriteAveraged': 131098,
+ # 'disk.queueLatency': 131094,
+ # 'disk.queueReadLatency': 131086,
+ # 'disk.queueWriteLatency': 131090,
+ # 'disk.read': 131078,
+ # 'disk.totalLatency': 131093,
+ # 'disk.totalReadLatency': 131085,
+ # 'disk.totalWriteLatency': 131089,
+ # 'disk.usage': 131073,
+
+ # disk.read/write/deviceLatency/numberRead/numberWrite
+ 131078, 131079, 131091, 131076, 131077,
]
+
+ # Seems as this is not available in ESX 5.0 but we saw it on 5.1
+ if esx_version_num > 5.0:
+ # sys.resourceMemConsumed
+ needed_ids += [
+ 262171,
+ ]
+
#needed_ids = [
# # sys.resourceMem*
# 262151, 262155, 262169, 262152, 262154, 262153, 262157, 262156, 262168,
diff --git a/checkman/esx_vsphere_counters.ramdisk
b/checkman/esx_vsphere_counters.ramdisk
new file mode 100644
index 0000000..6ef4255
--- /dev/null
+++ b/checkman/esx_vsphere_counters.ramdisk
@@ -0,0 +1,19 @@
+title: Ramdisks of ESX host system
+agents: vsphere
+author: Lars Michelsen <lm(a)mathias-kettner.de>
+license: GPL
+distribution: check_mk
+description:
+ This check monitors the usage of ramdisks used by the operating system
+ of ESX host systems.
+
+ The check needs a host system with version 5.1 or newer. Older versions
+ do not provide the needed information.
+
+ The check makes use of generic the {df} check code. Therefor parameters,
+ perfdata, configuration and results are similar to the {df} check. So
+ please take a look at that check man page for details.
+
+inventory:
+ One check per ramdisk is created from the counters reported by
+ the vsphere special agent.
diff --git a/checks/esx_vsphere_counters b/checks/esx_vsphere_counters
index d604edc..9d05388 100644
--- a/checks/esx_vsphere_counters
+++ b/checks/esx_vsphere_counters
@@ -272,3 +272,51 @@ check_info['esx_vsphere_counters.uptime'] = {
'group': 'uptime',
}
+# .--Ramdisk-------------------------------------------------------------.
+# | ____ _ _ _ |
+# | | _ \ __ _ _ __ ___ __| (_)___| | __ |
+# | | |_) / _` | '_ ` _ \ / _` | / __| |/ / |
+# | | _ < (_| | | | | | | (_| | \__ \ < |
+# | |_| \_\__,_|_| |_| |_|\__,_|_|___/_|\_\ |
+# | |
+# +----------------------------------------------------------------------+
+
+# We assume that all ramdisks have the same size (in mb) on all hosts
+esx_vsphere_cunters_ramdisk_sizes = {
+ 'root': 32,
+ 'etc': 28,
+ 'tmp': 192,
+ 'hostdstats': 319,
+}
+
+def inventory_esx_vsphere_counters_ramdisk(info):
+ ramdisks = []
+ for name, instance, counter, unit in info:
+ if name == 'sys.resourceMemConsumed' \
+ and instance.startswith('host/system/kernel/kmanaged/visorfs/'):
+ ramdisks.append(instance.split('/')[-1])
+
+ return df_inventory(ramdisks)
+
+def check_esx_vsphere_counters_ramdisk(item, params, info):
+ ramdisks = []
+ for name, instance, counter, unit in info:
+ if name == 'sys.resourceMemConsumed' \
+ and instance.startswith('host/system/kernel/kmanaged/visorfs/'):
+ name = instance.split('/')[-1]
+ size_mb = esx_vsphere_cunters_ramdisk_sizes[name]
+ used_mb = float(counter) / 1000
+ avail_mb = size_mb - used_mb
+ ramdisks.append((name, size_mb, avail_mb))
+
+ return df_check_filesystem_list(item, params, ramdisks)
+
+check_info['esx_vsphere_counters.ramdisk'] = {
+ 'inventory_function': inventory_esx_vsphere_counters_ramdisk,
+ 'check_function': check_esx_vsphere_counters_ramdisk,
+ 'service_description': 'Ramdisk %s',
+ 'has_perfdata': True,
+ 'includes': [ 'df.include' ],
+ 'group': 'filesystem',
+ 'default_levels_variable': 'filesystem_default_levels',
+}