[checkmk-commits] Check_MK Git: check_mk: Adapt outpur of akcp_daisy_temp and akcp_sensor_temp

Bastian Kuhn bk at mathias-kettner.de
Tue Aug 5 15:57:17 CEST 2014


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

Author: Bastian Kuhn <bk at mathias-kettner.de>
Date:   Tue Aug  5 15:57:08 2014 +0200

Adapt outpur of akcp_daisy_temp and akcp_sensor_temp

---

 checks/akcp_daisy_temp  |    6 +++---
 checks/akcp_sensor_temp |   22 +++++++++++-----------
 2 files changed, 14 insertions(+), 14 deletions(-)

diff --git a/checks/akcp_daisy_temp b/checks/akcp_daisy_temp
index 15cd6bf..1a36e98 100644
--- a/checks/akcp_daisy_temp
+++ b/checks/akcp_daisy_temp
@@ -42,12 +42,12 @@ def check_akcp_daisy_temp(item, params, info):
         if name == item:
             warn, crit = params
             temp = savefloat(temp) / 10
-            infotext = "%.1f °C " % temp
+            infotext = "Temperature is: %.1f °C " % temp
             levels = " (warn/crit at %.1f/%.1f °C)" % (warn, crit)
             perfdata = [ ( "temperature", temp, warn, crit ) ]
-            if temp > crit:
+            if temp >= crit:
                 return 2, infotext + levels, perfdata
-            if temp > warn:
+            if temp >= warn:
                 return 1, infotext + levels, perfdata
             return 0, infotext, perfdata
     return 3, "Sensor not found"
diff --git a/checks/akcp_sensor_temp b/checks/akcp_sensor_temp
index 0da73e0..eeda696 100644
--- a/checks/akcp_sensor_temp
+++ b/checks/akcp_sensor_temp
@@ -40,9 +40,9 @@ def check_akcp_sensor_temp(item, params, info):
     for desc, degree, status, online, degreetype, degreeraw in info:
         if desc == item:
             if degreetype == "0":
-                type = "F"
+                unit = "F"
             else:
-                type = "C"
+                unit = "C"
             warn, crit = params
             if degreeraw != "":
                 temp = saveint(degreeraw) / 10.0
@@ -53,20 +53,20 @@ def check_akcp_sensor_temp(item, params, info):
             else:
                 if online == "1":
                     # break temp down to celsius if it had been defined as Fahrenheit.
-                    if type == "F":
+                    if unit == "F":
                         temp = to_celsius(temp)
-                        type = "C"
-                    infotext = "%.1f " % temp + type + " (warn/crit at %.1f/%.1f " % (warn, crit) + type + ")"
+                        unit = "C"
+                    infotext = "Temperature is: %.1f °%s" % ( temp, unit)
+                    levels = " (warn/crit at %1f/%1f °%s)" % ( warn, crit, unit )
                     perfdata = [ ( "temperature", temp, warn, crit ) ]
                     if temp >= crit:
-                        return (2, "Temperature is: " + infotext, perfdata)
+                        return 2, infotext+levels, perfdata
                     elif temp >= warn:
-                        return (1, "Temperature is: " + infotext, perfdata)
+                        return 1, infotext+levels, perfdata
                     else:
-                        return (0, "Temperature is: " + infotext, perfdata )
-                else:
-                    return (3, "Sensor is offline")
-    return (3, "Sensor not found")
+                        return 0, infotext, perfdata 
+                return 3, "Sensor is offline"
+    return 3, "Sensor not found"
 
 # possible values for sensorProbeTempStatus:
 # noStatus(1), normal(2), highWarning(3), highCritical(4),



More information about the checkmk-commits mailing list