[checkmk-commits] Check_MK Git: check_mk: printer_supply: fixed logic of Perf-O-Meter ( mixed up crit with ok)

git version control git at mathias-kettner.de
Sat Aug 13 10:56:13 CEST 2011


Module: check_mk
Branch: master
Commit: e98f1ba67093f3c1bb76964938d7ca23abb75f86
URL:    http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=e98f1ba67093f3c1bb76964938d7ca23abb75f86

Author: Mathias Kettner <mk at mathias-kettner.de>
Date:   Sat Aug 13 10:56:08 2011 +0200

printer_supply: fixed logic of Perf-O-Meter (mixed up crit with ok)

---

 ChangeLog                          |    1 +
 web/plugins/perfometer/check_mk.py |   16 ++++++----------
 2 files changed, 7 insertions(+), 10 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index c4e011f..1c63f90 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -23,6 +23,7 @@
            speed information.
     * FIX: cisco_temp_perf: add critical level to performance data
     * FIX: windows agent: hopefully fix case with quotes in directory name
+    * FIX: printer_supply: fixed logic of Perf-O-Meter (mixed up crit with ok)
     * brocade_port: check for Brocade FC ports has been rewritten with
       lots of new features.
     * AIX agent now simulates <<<netctr>>> output (by Jörg Linge)
diff --git a/web/plugins/perfometer/check_mk.py b/web/plugins/perfometer/check_mk.py
index f978e06..a7c74e9 100644
--- a/web/plugins/perfometer/check_mk.py
+++ b/web/plugins/perfometer/check_mk.py
@@ -321,24 +321,20 @@ def perfometer_check_mk_printer_supply(row, check_command, perf_data):
     s = row['service_description'].lower()
 
     fg_color = '#000000'
-    if 'black' in s:
+    if 'black' in s or s[-1] == 'k':
         colors   = [ '#000000', '#6E6F00', '#6F0000' ]
         fg_color = '#ffffff'
-    elif 'magenta' in s:
+    elif 'magenta' in s or s[-1] == 'm':
         colors = [ '#fc00ff', '#FC7FFF', '#FEDFFF' ]
-    elif 'yellow' in s:
+    elif 'yellow' in s or s[-1] == 'y':
         colors = [ '#ffff00', '#FEFF7F', '#FFFFCF' ]
-    elif 'cyan' in s:
+    elif 'cyan' in s or s[-1] == 'c':
         colors = [ '#00ffff', '#7FFFFF', '#DFFFFF' ]
     else:
         colors = [ '#cccccc', '#ffff00', '#ff0000' ]
 
-    if left > warn:
-        color = colors[0]
-    elif left > crit:
-        color = colors[1]
-    else:
-        color = colors[2]
+    st = min(2, row['service_state'])
+    color = colors[st]
 
     return "<font color=\"%s\">%.0f%%</font>" % (fg_color, left), perfometer_linear(left, color)
 



More information about the checkmk-commits mailing list