Module: check_mk
Branch: master
Commit: c12f0b81dbfc232bb125912f924074a94a767147
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=c12f0b81dbfc23…
Author: Andreas Boesl <ab(a)mathias-kettner.de>
Date: Fri Mar 3 10:36:39 2017 +0100
ucs_bladecenter_faultinst: No longer reports UNKNWOWN when no fault instances are found
Change-Id: Ida6b14d4a1e7238740477f8225c9ecdce2680db2
---
.werks/4453 | 10 ++++++++++
checks/ucs_bladecenter_faultinst | 6 ++++--
2 files changed, 14 insertions(+), 2 deletions(-)
diff --git a/.werks/4453 b/.werks/4453
new file mode 100644
index 0000000..fd068e8
--- /dev/null
+++ b/.werks/4453
@@ -0,0 +1,10 @@
+Title: ucs_bladecenter_faultinst: No longer reports UNKNWOWN when no fault instances are found
+Level: 1
+Component: checks
+Compatible: compat
+Edition: cre
+Version: 1.5.0i1
+Date: 1488533709
+Class: fix
+
+
diff --git a/checks/ucs_bladecenter_faultinst b/checks/ucs_bladecenter_faultinst
index ceb9b52..df614a5 100644
--- a/checks/ucs_bladecenter_faultinst
+++ b/checks/ucs_bladecenter_faultinst
@@ -49,10 +49,12 @@ def check_ucs_bladecenter_faultinst(item, _no_params, parsed):
severities.setdefault(entry_sev, [])
severities[entry_sev].append(values)
- state = 0
+ if not severities.items():
+ yield 0, "No fault instances found"
+ return
+
for sev, instances in severities.items():
sev_state = severity_map.get(sev, 3)
- state = max(state, sev_state)
# Right now, OK instances are also reported in detail
# If required we can increase the state level here, so that only WARN+ messages are shown
Module: check_mk
Branch: master
Commit: 095e64321cea2378531190b6161c24c9ab23e5ee
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=095e64321cea23…
Author: Marcel Arentz <ma(a)mathias-kettner.de>
Date: Thu Feb 23 10:50:48 2017 +0100
4436 FIX check_sql: fixed thresholds and added missing options
Thresholds are now actually used when the options are activated and the number is added to the output if Thresholds are set. Additionally the option "Performance Data" is now actually used. If not activated no performance data will be added, even if it is given by the result of the SQL statement.
Change-Id: Ifb3780f318f3a2bc81ade56007698bbc7fd43f16
---
.werks/4436 | 13 +++++++++++++
active_checks/check_sql | 28 +++++++++++++++++++---------
checks/check_sql | 3 +++
3 files changed, 35 insertions(+), 9 deletions(-)
diff --git a/.werks/4436 b/.werks/4436
new file mode 100644
index 0000000..c03c4c8
--- /dev/null
+++ b/.werks/4436
@@ -0,0 +1,13 @@
+Title: check_sql: fixed thresholds and added missing options
+Level: 1
+Component: checks
+Compatible: compat
+Edition: cre
+Version: 1.5.0i1
+Date: 1487842750
+Class: fix
+
+Thresholds are now actually used when the options are activated and the
+number is added to the output if Thresholds are set. Additionally the option
+"Performance Data" is now actually used. If not activated no performance
+data will be added, even if it is given by the result of the SQL statement.
diff --git a/active_checks/check_sql b/active_checks/check_sql
old mode 100755
new mode 100644
index 6cac732..18a88b2
--- a/active_checks/check_sql
+++ b/active_checks/check_sql
@@ -64,6 +64,7 @@ OPTIONS:
-c RANGE, --critical RANGE lower and upper level for the critical state, separated by a colon
-o, --procedure treat the main argument as a procedure instead of an SQL-Statement
-i CSV, --inputvars CSV values of input variables if required by the procedure; csv-list
+ -m, --metrics Add performance data to the output
--debug Debug mode: let Python exceptions come through
-v, --verbose Verbose mode: print SQL statement and levels
@@ -83,10 +84,10 @@ def bail_out(exit_code, output):
sys.exit(exit_code)
-short_options = 'hou:i:p:d:n:H:P:w:c:v'
+short_options = 'hou:i:p:d:n:H:P:w:c:v:m'
long_options = [
'help', 'user=', 'password=', 'dbms=', 'name=', 'warning=', 'critical=', 'hostname=',
- 'port=', 'debug', 'verbose', 'procedure', 'inputvars=']
+ 'port=', 'debug', 'verbose', 'procedure', 'inputvars=', 'metrics']
try:
@@ -106,10 +107,12 @@ opt_port = None
opt_sql = None
opt_input = []
opt_procedure = False
+opt_metrics = False
warn = [ None, None ]
crit = [ None, None ]
+
try:
for o,a in opts:
if o in [ '--debug' ]:
@@ -134,6 +137,8 @@ try:
crit = map(saverfloat,a.split(":",2))
elif o in [ '-o', '--procedure' ]:
opt_procedure = True
+ elif o in [ '-m', '--metrics' ]:
+ opt_metrics = True
elif o in [ '-i', '--inputvars' ]:
opt_input = a.split(",")
elif o in [ '-h', '--help' ]:
@@ -268,12 +273,13 @@ try:
else:
text = "%s" % result[1]
- try:
- perf = " | performance_data=%s" % str(result[2])
- except IndexError:
- if opt_debug:
- raise
- perf = ""
+ if opt_metrics:
+ try:
+ perf = " | performance_data=%s" % str(result[2])
+ except IndexError:
+ if opt_debug:
+ raise
+ perf = ""
state = 0
if warn != [ None, None ] or crit != [ None, None ]:
@@ -283,6 +289,7 @@ try:
if (crit[0] != None and crit[0] > number) or \
(crit[1] != None and crit[1] < number):
state = 2
+ text += ": %s" % number
else:
if number in [ 0, 1, 2, 3 ]:
state = int(number)
@@ -295,4 +302,7 @@ except Exception, e:
bail_out(3, "Error while processing result of SQL statement: %s" % e)
-bail_out(state, "%s%s" % (text, perf))
+if opt_metrics:
+ bail_out(state, "%s%s" % (text, perf))
+else:
+ bail_out(state, "%s" % text)
diff --git a/checks/check_sql b/checks/check_sql
index b689050..ac48882 100644
--- a/checks/check_sql
+++ b/checks/check_sql
@@ -65,6 +65,9 @@ def check_sql_arguments(params):
else:
lower = "", ""
+ if "perfdata" in params:
+ args += [ "--metrics" ]
+
if "levels" in params or "levels_low" in params:
args += [ "-w", "%s:%s" % (lower[0], upper[0]) ]
args += [ "-c", "%s:%s" % (lower[1], upper[1]) ]
Module: check_mk
Branch: master
Commit: 8b2e807b81c3c6119f28436bf36557672d934903
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=8b2e807b81c3c6…
Author: Simon Betz <si(a)mathias-kettner.de>
Date: Thu Mar 2 17:12:14 2017 +0100
added comment
Change-Id: I17220cdc4c4c08c3278cb24986b24d14c7186a2b
---
checks/cisco_fru_power | 2 ++
1 file changed, 2 insertions(+)
diff --git a/checks/cisco_fru_power b/checks/cisco_fru_power
index 7ca7e8a..366eba2 100644
--- a/checks/cisco_fru_power
+++ b/checks/cisco_fru_power
@@ -86,6 +86,8 @@ def parse_cisco_fru_power(info):
ppre_parsed = {}
for end_oid, oper_state, fru_current in info[0]:
+ # We discover only "real" power supplies which have current value >= 0
+ # Others such as modules do not have such values
if oper_state not in [ "", "0", "1", "5" ] and \
fru_current and int(fru_current) >= 0:
ppre_parsed.setdefault(end_oid, map_states.get(oper_state, (3, "unexpected(%s)" % oper_state)))