Module: check_mk
Branch: master
Commit: 8a5b30d1513f3e51b69336cab2584ed0d5dcfca2
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=8a5b30d1513f3e…
Author: Ronny Bruska <rb(a)mathias-kettner.de>
Date: Thu Mar 7 20:18:57 2019 +0100
7197 FIX Solaris Agent: fixed problem with leading spaces in wc command output
The output of "wc -l" on solaris can lead to leading spaces.
In that case the check "cpu.threads" can not parse the agent output and will fail.
This has been fixed.
Change-Id: I164f2837f12abccaf442245f0220519865d7044d
---
.werks/7197 | 12 ++++++++++++
agents/check_mk_agent.solaris | 2 +-
2 files changed, 13 insertions(+), 1 deletion(-)
diff --git a/.werks/7197 b/.werks/7197
new file mode 100644
index 0000000..19e9281
--- /dev/null
+++ b/.werks/7197
@@ -0,0 +1,12 @@
+Title: Solaris Agent: fixed problem with leading spaces in wc command output
+Level: 1
+Component: checks
+Compatible: compat
+Edition: cre
+Version: 1.6.0i1
+Date: 1551986037
+Class: fix
+
+The output of "wc -l" on solaris can lead to leading spaces.
+In that case the check "cpu.threads" can not parse the agent output and will fail.
+This has been fixed.
diff --git a/agents/check_mk_agent.solaris b/agents/check_mk_agent.solaris
index 1c5bc66..38dfa3d 100755
--- a/agents/check_mk_agent.solaris
+++ b/agents/check_mk_agent.solaris
@@ -286,7 +286,7 @@ fi
# Simulated Output of Linux /proc/cpu
echo '<<<cpu>>>'
load=$(uptime|sed -e 's;.*average: \([0-9]\{1,\}\.[0-9]\{1,\}\), \([0-9]\{1,\}\.[0-9]\{1,\}\), \([0-9]\{1,\}\.[0-9]\{1,\}\).*;\1 \2 \3;')
-nthreads=$(ps -AL | wc -l)
+nthreads=$(($(ps -AL | wc -l)))
procs=$(($(psrinfo | wc -l)))
echo $load 1/$nthreads $$ $procs
Module: check_mk
Branch: master
Commit: 6a44cabe5c745188e71d2846385d1b893a0c939d
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=6a44cabe5c7451…
Author: Florian Kromer <fk(a)mathias-kettner.de>
Date: Thu Mar 7 16:30:58 2019 +0100
ucs_c_rack_server_health: Make check reliable against namespace conflict
Change-Id: Ia1b4873ae66fd05be633236f56147719dd7b4389
---
checks/ucs_c_rack_server_health | 24 ++++++-------
.../datasets/ucs_c_rack_server_health.py | 42 ++++++++++++----------
2 files changed, 36 insertions(+), 30 deletions(-)
diff --git a/checks/ucs_c_rack_server_health b/checks/ucs_c_rack_server_health
index f3ff547..05aa57b 100644
--- a/checks/ucs_c_rack_server_health
+++ b/checks/ucs_c_rack_server_health
@@ -30,18 +30,6 @@
# storageControllerHealth<TAB>dn
# sys/rack-unit-2/board/storage-SAS-SLOT-HBA/vd-0 <TAB>id SLOT-HBA<TAB>health Good
-# Dict keys are storage controller health strings provided via special agent -> XML
-# API of servers. Dict values are corresponding check status.
-# For information about the data provided by the special agent
-# "storageControllerHealth" refer to Cisco C-Series Rack Server XML 2.0 Schema files:
-# [https://community.cisco.com/t5/unified-computing-system/cisco-ucs-c-series-…]
-# Note: The possible string values are not defined/documented in the XML schema.
-# "Good" is the only value known from exemplary data output. Pre-process the
-# data to lowercase only chars.
-health_to_status_mapping = {
- 'good': 0,
-}
-
def parse_ucs_c_rack_server_health(info):
"""
@@ -72,6 +60,18 @@ def check_ucs_c_rack_server_health(item, params, health):
Check function is called only in case parsed is a dict and item exists as key in parsed[item].
All other potential bad case conditions are handled by @get_parsed_item_data.
"""
+ # Dict keys are storage controller health strings provided via special agent -> XML
+ # API of servers. Dict values are corresponding check status.
+ # For information about the data provided by the special agent
+ # "storageControllerHealth" refer to Cisco C-Series Rack Server XML 2.0 Schema files:
+ # [https://community.cisco.com/t5/unified-computing-system/cisco-ucs-c-series-…]
+ # Note: The possible string values are not defined/documented in the XML schema.
+ # "Good" is the only value known from exemplary data output. Pre-process the
+ # data to lowercase only chars.
+ health_to_status_mapping = {
+ 'good': 0,
+ }
+
try:
status = health_to_status_mapping[health]
status_readable = health
diff --git a/tests/unit/checks/generictests/datasets/ucs_c_rack_server_health.py b/tests/unit/checks/generictests/datasets/ucs_c_rack_server_health.py
index 52cf0de..5b05c59 100644
--- a/tests/unit/checks/generictests/datasets/ucs_c_rack_server_health.py
+++ b/tests/unit/checks/generictests/datasets/ucs_c_rack_server_health.py
@@ -1,20 +1,26 @@
+# yapf: disable
+
+
checkname = 'ucs_c_rack_server_health'
-info = [[
- 'storageControllerHealth', 'dn sys/rack-unit-1/board/storage-SAS-SLOT-HBA/vd-0', 'id SLOT-HBA',
- 'health Good'
-],
- [
- 'storageControllerHealth', 'dn sys/rack-unit-2/board/storage-SAS-SLOT-HBA/vd-0',
- 'id SLOT-HBA', 'health AnythingElse'
- ]]
-
-discovery = {
- '': [('Rack unit 1 Storage SAS SLOT HBA vd 0', {}), ('Rack unit 2 Storage SAS SLOT HBA vd 0',
- {})]
-}
-
-checks = {
- '': [('Rack unit 1 Storage SAS SLOT HBA vd 0', {}, [(0, 'Status: good', [])]),
- ('Rack unit 2 Storage SAS SLOT HBA vd 0', {}, [(3, 'Status: unknown[anythingelse]', [])])]
-}
+
+info = [['storageControllerHealth',
+ 'dn sys/rack-unit-1/board/storage-SAS-SLOT-HBA/vd-0',
+ 'id SLOT-HBA',
+ 'health Good'],
+ ['storageControllerHealth',
+ 'dn sys/rack-unit-2/board/storage-SAS-SLOT-HBA/vd-0',
+ 'id SLOT-HBA',
+ 'health AnythingElse']]
+
+
+discovery = {'': [('Rack unit 1 Storage SAS SLOT HBA vd 0', {}),
+ ('Rack unit 2 Storage SAS SLOT HBA vd 0', {})]}
+
+
+checks = {'': [('Rack unit 1 Storage SAS SLOT HBA vd 0',
+ {},
+ [(0, 'Status: good', [])]),
+ ('Rack unit 2 Storage SAS SLOT HBA vd 0',
+ {},
+ [(3, 'Status: unknown[anythingelse]', [])])]}
\ No newline at end of file
Module: check_mk
Branch: master
Commit: eb82b6e7688243e716b9505d78bc4c7e7d23c9be
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=eb82b6e7688243…
Author: Florian Kromer <fk(a)mathias-kettner.de>
Date: Wed Mar 6 17:16:28 2019 +0100
add check_levels parameter docs
Change-Id: Id99733ad057dbc542eed00d55ab100d48edd59b2
---
cmk_base/check_api.py | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/cmk_base/check_api.py b/cmk_base/check_api.py
index a926fcc..43cf88a 100644
--- a/cmk_base/check_api.py
+++ b/cmk_base/check_api.py
@@ -370,6 +370,15 @@ def check_levels(value,
value: currently measured value
dsname: name of the datasource in the RRD that corresponds to this value
+ params: None or Tuple(None, None) -> no level checking.
+ Tuple variants with non-None values:
+ Tuple[warn_upper, crit_upper] -> upper level checking only.
+ Tuple[warn_upper, crit_upper, warn_lower, crit_lower]
+ -> upper and lower level checking.
+ Dict containing "lower" as key -> lower level checking.
+ Dict containing "upper" or "levels_upper_min" as key -> upper level checking.
+ Dict containing "lower" and "upper"/"levels_upper_min" as key ->
+ lower and upper level checking.
unit: unit to be displayed in the plugin output.
Be aware: if a (builtin) human_readable_func is stated which already
provides a unit info, then this unit is not necessary. An additional