Consider new API keys of capacity and free space values"
Message-ID: <5b9137ad.pEpe4J3pECuRlYyC%si(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: 71939c5d676ed92c245dc1edc62460a55af7de22
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=71939c5d676ed9…
Author: Simon Betz <si(a)mathias-kettner.de>
Date: Thu Sep 6 16:11:41 2018 +0200
Revert "6488 FIX storeonce_servicesets, storeonce_clusterinfo: Consider new API keys
of capacity and free space values"
This reverts commit 6569e7f5881dbe882c4733f35cd4f5e9deeb9332.
---
.werks/6488 | 10 ----------
checks/storeonce.include | 34 ----------------------------------
checks/storeonce_clusterinfo | 14 +++++++++++---
checks/storeonce_servicesets | 26 ++++++++------------------
4 files changed, 19 insertions(+), 65 deletions(-)
diff --git a/.werks/6488 b/.werks/6488
deleted file mode 100644
index 153f703..0000000
--- a/.werks/6488
+++ /dev/null
@@ -1,10 +0,0 @@
-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 e0f5b14..08e37fc 100644
--- a/checks/storeonce.include
+++ b/checks/storeonce.include
@@ -31,7 +31,6 @@ def parse_storeonce_clusterinfo(info):
parsed[line[0]] = line[1]
return parsed
-
def parse_storeonce_servicesets(info):
parsed = {}
for line in info:
@@ -42,7 +41,6 @@ def parse_storeonce_servicesets(info):
parsed[item][line[0]] = line[1]
return parsed
-
def translate_storeonce_status(status):
translate_state = {
'0' : 3, # Unknown
@@ -53,35 +51,3 @@ 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 f83ffc4..2393932 100644
--- a/checks/storeonce_clusterinfo
+++ b/checks/storeonce_clusterinfo
@@ -132,17 +132,25 @@ 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_space,
+ 'check_function' : check_storeonce_clusterinfo_space,
'service_description' : "%s",
'has_perfdata' : True,
- 'includes' : [ "size_trend.include",
"df.include", "storeonce.include"],
+ 'includes' : [ "size_trend.include",
"df.include"],
'group' : "filesystem",
'default_levels_variable' : "filesystem_Default_levels",
}
diff --git a/checks/storeonce_servicesets b/checks/storeonce_servicesets
index 0d75f1f..d9e4d4f 100644
--- a/checks/storeonce_servicesets
+++ b/checks/storeonce_servicesets
@@ -55,22 +55,6 @@
# 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):
@@ -118,7 +102,13 @@ def check_storeonce_servicesets_capacity(item, params, parsed):
for key, values in parsed.iteritems():
if not item == values["ServiceSet ID"]:
continue
- yield check_storeonce_space(item, params, values)
+ 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
check_info['storeonce_servicesets.capacity'] = {
@@ -127,5 +117,5 @@ check_info['storeonce_servicesets.capacity'] = {
'service_description' : "ServiceSet %s Capacity",
'has_perfdata' : True,
'group' : "filesystem",
- 'includes' : ["size_trend.include",
"df.include", "storeonce.include"],
+ 'includes' : [ "size_trend.include",
"df.include" ],
}