Module: check_mk
Branch: master
Commit: 21ef1368047de5560c2a26e181717b0e55143577
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=21ef1368047de5…
Author: Florian Kromer <fk(a)mathias-kettner.de>
Date: Thu Mar 14 09:25:29 2019 +0100
7049 FIX oracle_logswitches: Fix interchanged lower levels
Previously the warn and crit levels have been interchanged.
This werk fixes this issue.
CMK-1784
Change-Id: Iee5bd47f23fc59efc1be76b4675936d7b36f5ff0
---
.werks/7049 | 13 +++++++++++++
checks/oracle_logswitches | 2 +-
.../generictests/datasets/oracle_logswitches.py | 22 ++++++++++++++++++++++
3 files changed, 36 insertions(+), 1 deletion(-)
diff --git a/.werks/7049 b/.werks/7049
new file mode 100644
index 0000000..316c243
--- /dev/null
+++ b/.werks/7049
@@ -0,0 +1,13 @@
+Title: oracle_logswitches: Fix interchanged lower levels
+Level: 1
+Component: checks
+Compatible: compat
+Edition: cre
+Version: 1.6.0i1
+Date: 1552551807
+Class: fix
+
+Previously the warn and crit levels have been interchanged.
+This werk fixes this issue.
+
+CMK-1784
diff --git a/checks/oracle_logswitches b/checks/oracle_logswitches
index c9e8399..f3139da 100644
--- a/checks/oracle_logswitches
+++ b/checks/oracle_logswitches
@@ -44,7 +44,7 @@ def check_oracle_logswitches(item, params, info):
if isinstance(params, tuple):
params = {
'levels': (params[2], params[3]),
- 'levels_lower': (params[1], params[0]),
+ 'levels_lower': (params[0], params[1]),
}
for line in info:
diff --git a/tests/unit/checks/generictests/datasets/oracle_logswitches.py
b/tests/unit/checks/generictests/datasets/oracle_logswitches.py
new file mode 100644
index 0000000..5ef7382
--- /dev/null
+++ b/tests/unit/checks/generictests/datasets/oracle_logswitches.py
@@ -0,0 +1,22 @@
+# yapf: disable
+
+
+checkname = 'oracle_logswitches'
+
+
+info = [['pengt', '15'], ['hirni', '22']]
+
+
+discovery = {'': [('hirni', {}), ('pengt', {})]}
+
+
+checks = {'': [('hirni',
+ {'levels': (50, 100), 'levels_lower': (20, 15)},
+ [(0,
+ '22 log switches in the last 60 minutes (warn/crit below 15/20)
(warn/crit at 50/100)',
+ [('logswitches', 22, 50, 100, 0, None)])]),
+ ('pengt',
+ {'levels': (50, 100), 'levels_lower': (-1, -1)},
+ [(0,
+ '15 log switches in the last 60 minutes (warn/crit below -1/-1)
(warn/crit at 50/100)',
+ [('logswitches', 15, 50, 100, 0, None)])])]}