Module: check_mk
Branch: master
Commit: 5457fca3c986919ea478bf79bf28529a9b742898
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=5457fca3c98691…
Author: Bastian Kuhn <bk(a)mathias-kettner.de>
Date: Mon Oct 1 14:42:15 2012 +0200
FIX: printer_alerts, small improvment
---
checks/printer_alerts | 9 ++++++---
1 files changed, 6 insertions(+), 3 deletions(-)
diff --git a/checks/printer_alerts b/checks/printer_alerts
index 07ece85..ae5a11c 100644
--- a/checks/printer_alerts
+++ b/checks/printer_alerts
@@ -93,8 +93,10 @@ def check_printer_alerts(_not_used, _not_used1, info):
state = 3 # UNKNOWN
if desc in printer_alerts_text_map:
- sum_state = max(printer_alerts_text_map[desc], sum_state)
- #sum_txt.append("%s - %s" % (nagios_state_names[state], desc))
+ state = printer_alerts_text_map[desc]
+ if state != 0:
+ sum_state = max(state, sum_state)
+ sum_txt.append("%s - %s" % (nagios_state_names[state], desc))
continue
code = saveint(code)
@@ -123,7 +125,8 @@ def check_printer_alerts(_not_used, _not_used1, info):
info_text += " (code: %d)" % code
sum_txt.append(info_text)
-
+ if len(sum_txt) == 0:
+ sum_txt.append("OK - No alerts found")
return (sum_state, ', '.join(sum_txt))
check_info['printer_alerts'] = (check_printer_alerts, "Alerts", 0,
inventory_printer_alerts)