Module: check_mk
Branch: master
Commit: 70545f17cf22d926a4d393c70cec039730381a80
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=70545f17cf22d9…
Author: Florian Kromer <fk(a)mathias-kettner.de>
Date: Tue Apr 9 16:01:34 2019 +0200
lparstat_aix.cpu_util: Robustify inventorization to known agent output
Change-Id: I12b987d757ffb0536441fdcbd0bd913aa7b74d3f
---
checks/lparstat_aix | 6 ++++--
.../datasets/lparstat_aix_3_missing_info.py | 18 ++++++++++++++++++
2 files changed, 22 insertions(+), 2 deletions(-)
diff --git a/checks/lparstat_aix b/checks/lparstat_aix
index e78e5c5..db67f86 100644
--- a/checks/lparstat_aix
+++ b/checks/lparstat_aix
@@ -91,8 +91,10 @@ check_info["lparstat_aix"] = {
def inventory_lparstat_aix_cpu(parsed):
- if parsed.get('cpu') or parsed.get('update_required'):
- yield None, {}
+ if parsed.get('update_required'):
+ return [(None, {})]
+ if all(k in parsed.get('cpu', {}) for k in ('user', 'sys',
'wait', 'idle')):
+ return [(None, {})]
def check_lparstat_aix_cpu(_no_item, params, parsed):
diff --git a/tests/unit/checks/generictests/datasets/lparstat_aix_3_missing_info.py
b/tests/unit/checks/generictests/datasets/lparstat_aix_3_missing_info.py
new file mode 100644
index 0000000..9305253
--- /dev/null
+++ b/tests/unit/checks/generictests/datasets/lparstat_aix_3_missing_info.py
@@ -0,0 +1,18 @@
+# yapf: disable
+checkname = 'lparstat_aix'
+
+info = [[
+ u'System', u'configuration:', u'type=Shared',
u'mode=Uncapped', u'smt=4', u'lcpu=8',
+ u'mem=16384MB', u'psize=4', u'ent=1.00'
+],
+ [
+ u'%user', u'%wait', u'%idle', u'physc',
u'%entc', u'lbusy', u'vcsw', u'phint',
+ u'%nsp', u'%utcyc'
+ ],
+ [
+ u'-----', u'------', u'------', u'-----',
u'-----', u'------', u'-----',
+ u'-----', u'-----', u'------'
+ ],
+ [u'0.4', u'0.0', u'99.3', u'0.02',
u'1.7', u'0.0', u'215', u'3', u'101',
u'0.64']]
+
+discovery = {'': [(None, {})], 'cpu_util': []}