Module: check_mk
Branch: master
Commit: a7ee01c404f83d5dc4d10d1b3b69ba9addc4bdd9
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=a7ee01c404f83d…
Author: Andreas Boesl <ab(a)mathias-kettner.de>
Date: Fri Sep 12 17:22:59 2014 +0200
#1112 esx_vsphere_hostsystem.mem_usage_cluster: allows to monitor total RAM usage of all
nodes in a cluster
This check can not be inventorized. You need to create a manual check and assign it to a
cluster.
The memory information of each cluster node is added to the total memory pool.
You are able to set limits for the total RAM usage depending on the number of cluster
nodes.
---
.werks/1112 | 11 +++++
ChangeLog | 1 +
checkman/esx_vsphere_hostsystem.mem_usage_cluster | 34 ++++++++++++++
checks/esx_vsphere_hostsystem | 50 +++++++++++++++++++++
web/plugins/wato/check_parameters.py | 25 +++++++++++
5 files changed, 121 insertions(+)
diff --git a/.werks/1112 b/.werks/1112
new file mode 100644
index 0000000..4fe2a01
--- /dev/null
+++ b/.werks/1112
@@ -0,0 +1,11 @@
+Title: esx_vsphere_hostsystem.mem_usage_cluster: allows to monitor total RAM usage of all
nodes in a cluster
+Level: 1
+Component: checks
+Compatible: compat
+Version: 1.2.5i6
+Date: 1410535073
+Class: feature
+
+This check can not be inventorized. You need to create a manual check and assign it to a
cluster.
+The memory information of each cluster node is added to the total memory pool.
+You are able to set limits for the total RAM usage depending on the number of cluster
nodes.
diff --git a/ChangeLog b/ChangeLog
index dbf911a..5ff327b 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -58,6 +58,7 @@
* 1108 printer_io.include: included tray description in check output
* 0657 diskstat: cluster support added for single disk modes
* 1111 vCenter monitoring: greatly improved performance (at least 40 times
faster)...
+ * 1112 esx_vsphere_hostsystem.mem_usage_cluster: allows to monitor total RAM usage of
all nodes in a cluster...
* 1051 FIX: tcp_conn_stats: fix missing performance data...
* 1142 FIX: winperf_ts_sessions: fix computation, check has never really worked
* 1090 FIX: zfsget: fixed exception which happened on incomplete zfs entries
diff --git a/checkman/esx_vsphere_hostsystem.mem_usage_cluster
b/checkman/esx_vsphere_hostsystem.mem_usage_cluster
new file mode 100644
index 0000000..36e00fd
--- /dev/null
+++ b/checkman/esx_vsphere_hostsystem.mem_usage_cluster
@@ -0,0 +1,34 @@
+title: VMware ESX vCenter: Total physical RAM usage of clustered ESX hosts
+agents: vsphere
+catalog: os/kernel
+license: GPL
+distribution: check_mk
+description:
+ This check measures the total physical RAM usage for a cluster of hosts.
+ This check is only applicable for clusters and cannot be inventorized.
+ You need to create a manual check for it in WATO and assign it to a cluster host.
+
+examples:
+ static_checks['mem_cluster'] = [
+ ( ('esx_vsphere_hostsystem.mem_usage_cluster', None,
+ [(2, (60.0, 70.0)),
+ (5, (70.0, 80.0)),
+ (7, (85.0, 90.0))
+ ]), [], ['esx_cluster'] ),
+ ] + static_checks['mem_cluster']
+
+
+
+inventory:
+ Not applicable
+
+perfdata:
+ One value: the current total usage in bytes.
+
+[parameters]
+parameters (dict): A list of tuples where you can define the number of
+ minimum required nodes and the corresponding levels.
+
+OneElement Tuple: number_of_nodes(int), (WARN(float), CRIT(float))
+
+ Please refer example.
diff --git a/checks/esx_vsphere_hostsystem b/checks/esx_vsphere_hostsystem
index e518ea1..745e97f 100644
--- a/checks/esx_vsphere_hostsystem
+++ b/checks/esx_vsphere_hostsystem
@@ -99,6 +99,56 @@ check_info['esx_vsphere_hostsystem.cpu_usage'] = {
#.
+# .--Mem-Cluster---------------------------------------------------------.
+# | __ __ ____ _ _ |
+# | | \/ | ___ _ __ ___ / ___| |_ _ ___| |_ ___ _ __ |
+# | | |\/| |/ _ \ '_ ` _ \ _____| | | | | | / __| __/ _ \ '__| |
+# | | | | | __/ | | | | |_____| |___| | |_| \__ \ || __/ | |
+# | |_| |_|\___|_| |_| |_| \____|_|\__,_|___/\__\___|_| |
+# | |
+# +----------------------------------------------------------------------+
+
+def check_esx_vsphere_hostsystem_mem_cluster(item, params, info):
+ data = {}
+ for line in info:
+ if line[0] in ["summary.quickStats.overallMemoryUsage",
"hardware.memorySize", "name"]:
+ data.setdefault(line[0], []).append(line[1])
+ sorted_params = sorted(params, reverse = True)
+
+ nodes_count = len(data['name'])
+ total_memory_usage = sum(map(lambda x: savefloat(x) * 1024 * 1024,
data['summary.quickStats.overallMemoryUsage']))
+ total_memory_size = sum(map(lambda x: savefloat(x),
data['hardware.memorySize']))
+
+ level = total_memory_usage / total_memory_size * 100
+ label = ""
+ state = 0
+ for count, levels in sorted_params:
+ if nodes_count >= count:
+ warn, crit = levels
+ if level > crit:
+ state = 2
+ label = " (Levels at %d%%/%d%%)" % (warn, crit)
+ elif level > warn:
+ state = 1
+ label = " (Levels at %d%%/%d%%)" % (warn, crit)
+ break
+
+
+ perf = [("usage", total_memory_usage, warn * total_memory_size / 100,
+ crit * total_memory_size / 100, 0, total_memory_size)]
+ yield state, "%d%%%s used - %s/%s" % \
+ (level, label, get_bytes_human_readable(total_memory_usage),
get_bytes_human_readable(total_memory_size)), perf
+
+
+check_info['esx_vsphere_hostsystem.mem_usage_cluster'] = {
+ "check_function" : check_esx_vsphere_hostsystem_mem_cluster,
+ "service_description" : "Memory used",
+ "group" : "mem_cluster",
+ "has_perfdata" : True,
+}
+
+
+
# .--Memory--------------------------------------------------------------.
# | __ __ |
# | | \/ | ___ _ __ ___ ___ _ __ _ _ |
diff --git a/web/plugins/wato/check_parameters.py b/web/plugins/wato/check_parameters.py
index 8ef194f..3876013 100644
--- a/web/plugins/wato/check_parameters.py
+++ b/web/plugins/wato/check_parameters.py
@@ -2599,6 +2599,31 @@ register_check_parameters(
)
register_check_parameters(
+ subgroup_networking,
+ "mem_cluster",
+ _("Memory Usage of Clusters"),
+ ListOf(
+ Tuple(
+ elements = [
+ Integer(title = _("Equal or more than"), unit =
_("nodes")),
+ Tuple(
+ title = _("Specify levels in percentage of total RAM"),
+ elements = [
+ Percentage(title = _("Warning at a RAM usage of"),
default_value = 80.0),
+ Percentage(title = _("Critical at a RAM usage of"),
default_value = 90.0),
+ ])
+ ]
+ ),
+ help = _("Here you can specify the total memory usage levels for clustered
hosts "),
+ title = _(""),
+ add_label = _("Add setting")
+ ),
+ None,
+ "first",
+ False
+)
+
+register_check_parameters(
subgroup_os,
"esx_host_memory",
_("Main memory usage of ESX host system"),