Module: check_mk
Branch: master
Commit: 6569e7f5881dbe882c4733f35cd4f5e9deeb9332
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=6569e7f5881dbe…
Author: Simon Betz <si(a)mathias-kettner.de>
Date: Thu Sep 6 09:41:37 2018 +0200
6488 FIX storeonce_servicesets, storeonce_clusterinfo: Consider new API keys of capacity
and free space values
Change-Id: I23b8886e6df9c2236348c0f3b5b9a998ffa8ad0a
---
.werks/6488 | 10 ++++++++++
checks/storeonce.include | 34 ++++++++++++++++++++++++++++++++++
checks/storeonce_clusterinfo | 14 +++-----------
checks/storeonce_servicesets | 26 ++++++++++++++++++--------
4 files changed, 65 insertions(+), 19 deletions(-)
diff --git a/.werks/6488 b/.werks/6488
new file mode 100644
index 0000000..153f703
--- /dev/null
+++ b/.werks/6488
@@ -0,0 +1,10 @@
+Title: storeonce_servicesets, storeonce_clusterinfo: Consider new API keys of capacity
and free space values
+Level: 1
+Component: checks
+Compatible: compat
+Edition: cre
+Version: 1.6.0i1
+Date: 1536219593
+Class: fix
+
+
diff --git a/checks/storeonce.include b/checks/storeonce.include
index 08e37fc..e0f5b14 100644
--- a/checks/storeonce.include
+++ b/checks/storeonce.include
@@ -31,6 +31,7 @@ def parse_storeonce_clusterinfo(info):
parsed[line[0]] = line[1]
return parsed
+
def parse_storeonce_servicesets(info):
parsed = {}
for line in info:
@@ -41,6 +42,7 @@ def parse_storeonce_servicesets(info):
parsed[item][line[0]] = line[1]
return parsed
+
def translate_storeonce_status(status):
translate_state = {
'0' : 3, # Unknown
@@ -51,3 +53,35 @@ def translate_storeonce_status(status):
}
return translate_state[status]
+
+def _get_storeonce_space_values(values, type_):
+ key = "%s Space in bytes" % type_
+ if key in values:
+ return float(values[key]), 0, 0
+
+ # combined(total) = local + cloud
+ combined_key = "combined%sBytes" % type_
+ cloud_key = "cloud%sBytes" % type_
+ local_key = "local%sBytes" % type_
+ return float(values.get(combined_key, 0)),\
+ float(values.get(cloud_key, 0)),\
+ float(values.get(local_key, 0))
+
+
+def check_storeonce_space(item, params, values):
+ total_bytes, cloud_bytes, local_bytes = _get_storeonce_space_values(values,
"Capacity")
+ free_bytes, free_cloud_bytes, free_local_bytes = _get_storeonce_space_values(values,
"Free")
+ factor = 1024*2
+ yield df_check_filesystem_list(item, params, [(item, total_bytes/factor,
free_bytes/factor, 0)])
+
+ if cloud_bytes and local_bytes:
+ yield 0, "Total cloud: %s, Total local: %s" % (
+ get_bytes_human_readable(cloud_bytes),
+ get_bytes_human_readable(local_bytes))
+
+ if free_cloud_bytes and free_local_bytes:
+ yield 0, "Free cloud: %s, Free local: %s" % (
+ get_bytes_human_readable(free_cloud_bytes),
+ get_bytes_human_readable(free_local_bytes))
+
+ yield 0, "Dedup ratio: %.2f" % float(values['Deduplication
Ratio'])
diff --git a/checks/storeonce_clusterinfo b/checks/storeonce_clusterinfo
index 2393932..f83ffc4 100644
--- a/checks/storeonce_clusterinfo
+++ b/checks/storeonce_clusterinfo
@@ -132,25 +132,17 @@ check_info['storeonce_clusterinfo.cluster'] = {
# | |
# '----------------------------------------------------------------------'
+
def inventory_storeonce_clusterinfo_space(parsed):
return [ ('Total Capacity', {}) ]
-def check_storeonce_clusterinfo_space(item, params, parsed):
- total_mb = float(parsed['Total Capacity (bytes)'])/1024/1024
- free_mb = float(parsed['Free Space (bytes)'])/1024/1024
-
- yield df_check_filesystem_list(item, params, [ (item, total_mb, free_mb, 0) ])
-
- dedup = float(parsed['Dedupe Ratio'])
-
- yield 0, "Dedup: %.2f" % dedup
check_info['storeonce_clusterinfo.space'] = {
'inventory_function' : inventory_storeonce_clusterinfo_space,
- 'check_function' : check_storeonce_clusterinfo_space,
+ 'check_function' : check_storeonce_space,
'service_description' : "%s",
'has_perfdata' : True,
- 'includes' : [ "size_trend.include",
"df.include"],
+ 'includes' : [ "size_trend.include",
"df.include", "storeonce.include"],
'group' : "filesystem",
'default_levels_variable' : "filesystem_Default_levels",
}
diff --git a/checks/storeonce_servicesets b/checks/storeonce_servicesets
index d9e4d4f..0d75f1f 100644
--- a/checks/storeonce_servicesets
+++ b/checks/storeonce_servicesets
@@ -55,6 +55,22 @@
# Primary Node hpcz25132ltd
# Secondary Node None
# Active Node hpcz25132ltd
+#
+# In newer agent outputs 'capacity' has changed:
+# cloudCapacityBytes 0
+# cloudDiskBytes 0
+# cloudReadWriteLicensedDiskBytes 0
+# cloudFreeBytes 0
+# cloudUserBytes 0
+# localCapacityBytes 136721392009216
+# localDiskBytes 47759419043899
+# localFreeBytes 85220347674624
+# localUserBytes 265622218292968
+# combinedCapacityBytes 136721392009216
+# combinedDiskBytes 47759419043899
+# combinedFreeBytes 85220347674624
+# combinedUserBytes 265622218292968
+
def inventory_storeonce_servicesets(parsed):
@@ -102,13 +118,7 @@ def check_storeonce_servicesets_capacity(item, params, parsed):
for key, values in parsed.iteritems():
if not item == values["ServiceSet ID"]:
continue
- total_mb = float(values['Capacity in bytes'])/1024/1024
- free_mb = float(values['Free Space in bytes'])/1024/1024
- yield df_check_filesystem_list(item, params, [ (item, total_mb, free_mb, 0) ])
-
- dedup = float(values['Deduplication Ratio'])
-
- yield 0, "Dedup ratio: %.2f" % dedup
+ yield check_storeonce_space(item, params, values)
check_info['storeonce_servicesets.capacity'] = {
@@ -117,5 +127,5 @@ check_info['storeonce_servicesets.capacity'] = {
'service_description' : "ServiceSet %s Capacity",
'has_perfdata' : True,
'group' : "filesystem",
- 'includes' : [ "size_trend.include",
"df.include" ],
+ 'includes' : ["size_trend.include",
"df.include", "storeonce.include"],
}