Package: munin-plugins-extra
Version: 2.0.21-2
Severity: normal
Tags: patch

Dear Maintainer,

The ipmi_sensor_ munin-plugins-extra Python script parses output of the
ipmitool command and splits key/value pairs into a dictionary.

Unfortunately the output of ipmitool changed in version 1.8.13 that has
been introduced to jessie.  Tracked down the change to this commit
upstream:

  commit c97d9d5b85bedecaa32881859f6101e55f55ff4d
  Author: Zdenek Styblik <zdenek.styb...@gmail.com>
  Date:   Thu Jan 17 14:36:13 2013 +0000

    ID: 3601106 - # ipmitool sensor get NACname; output
    incorrect/inconsistent

    Commit re-works output of # ipmitool sensor get; command. It removes
    calls to sensor specific functions with call to
    ipmi_sdr_print_listentry(). This way, output is unified with the
    output of '-v sdr list' and actually has corrent information. Well,
    at least errors are gone and no information seems to be missing.

    Commit fixes help and return codes as well.

Example output from ipmitool 1.8.11 on wheezy:

# ipmitool -V
ipmitool version 1.8.11

# ipmitool -I open sensor get -- 'CPU Temp'
Locating sensor record...
Sensor ID              : CPU Temp (0x1)
 Entity ID             : 3.1
 Sensor Type (Analog)  : Temperature
 Sensor Reading        : 35 (+/- 0) degrees C
 Status                : ok
 Lower Non-Recoverable : 0.000
 Lower Critical        : 0.000
 Lower Non-Critical    : 0.000
 Upper Non-Critical    : 86.000
 Upper Critical        : 89.000
 Upper Non-Recoverable : 91.000
 Assertion Events      :
 Assertions Enabled    : unc+ ucr+ unr+
 Deassertions Enabled  : unc+ ucr+ unr+

Example output from ipmitool 1.8.14 on jessie:

# ipmitool -V
ipmitool version 1.8.14

# ipmitool -I open sensor get -- 'CPU Temp'
Locating sensor record...
Sensor ID              : CPU Temp (0x1)
 Entity ID             : 3.1 (Processor)
 Sensor Type (Threshold)  : Temperature (0x01)
 Sensor Reading        : 29 (+/- 0) degrees C
 Status                : ok
 Nominal Reading       : 40.000
 Normal Minimum        : -4.000
 Normal Maximum        : 89.000
 Upper non-recoverable : 98.000
 Upper critical        : 96.000
 Upper non-critical    : 93.000
 Lower non-recoverable : 0.000
 Lower critical        : 0.000
 Lower non-critical    : 0.000
 Positive Hysteresis   : 2.000
 Negative Hysteresis   : 2.000
 Minimum sensor range  : Unspecified
 Maximum sensor range  : Unspecified
 Event Message Control : Per-threshold
 Readable Thresholds   : lnr lcr lnc unc ucr unr
 Settable Thresholds   : lnr lcr lnc unc ucr unr
 Threshold Read Mask   : lnr lcr lnc unc ucr unr
 Assertion Events      :
 Assertions Enabled    : lcr- lnr- ucr+ unr+
 Deassertions Enabled  : lcr- lnr- ucr+ unr+

Note the minor case inconsistencies, e.g. s/Non-Critical/non-critical/.

Attached is a patch to ipmi_sensor_ that lower-cases the dictionary
keys, should work on either past or present versions of ipmitool
(however I only tested on jessie).

Thanks!

-- System Information:
Debian Release: jessie/sid
  APT prefers testing-updates
  APT policy: (500, 'testing-updates'), (500, 'testing'), (50, 'unstable')
Architecture: amd64 (x86_64)

Kernel: Linux 3.14-1-amd64 (SMP w/8 CPU cores)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash

Versions of packages munin-plugins-extra depends on:
ii  munin-common  2.0.21-2
ii  perl          5.18.2-4

munin-plugins-extra recommends no packages.

Versions of packages munin-plugins-extra suggests:
ii  libnet-netmask-perl  1.9019-1
ii  libnet-telnet-perl   3.04-1
ii  python               2.7.6-2

-- no debconf information

-- 
Gerald Turner <gtur...@unzane.com>        Encrypted mail preferred!
OpenPGP: 4096R / CA89 B27A 30FA 66C5 1B80  3858 EC94 2276 FDB8 716D
--- /usr/share/munin/plugins/ipmi_sensor_	2014-05-11 05:53:22.000000000 -0700
+++ /etc/munin/plugins/ipmi_sensor_u_degrees_c	2014-06-08 14:44:15.070139568 -0700
@@ -119,7 +119,7 @@
         if not cur_sensor:
             continue
         label, data = line.split(":", 1)
-        cur_sensor[label.strip()] = data.strip()
+        cur_sensor[label.strip().lower()] = data.strip()
     return sensors
 
 def get_sensor_names():
@@ -242,16 +242,16 @@
         nname = normalize_sensor(lbl)
         
         print "%s.label %s" % (nname, lbl)
-        assertions = values['Assertions Enabled'].split()
+        assertions = values['assertions enabled'].split()
         warn_l = warn_u = crit_l = crit_u = ""
         if 'lcr-' in assertions:
-            crit_l = values['Lower Critical'].replace("na","")
+            crit_l = values['lower critical'].replace("na","")
         if 'lnc-' in assertions:
-            warn_l = values['Lower Non-Critical'].replace("na","")
+            warn_l = values['lower non-critical'].replace("na","")
         if 'ucr+' in assertions:
-            crit_u = values['Upper Critical'].replace("na","")
+            crit_u = values['upper critical'].replace("na","")
         if 'unc+' in assertions:
-            warn_u = values['Upper Non-Critical'].replace("na","")
+            warn_u = values['upper non-critical'].replace("na","")
         warn = "%s:%s" % (warn_l,warn_u)
         crit = "%s:%s" % (crit_l,crit_u)
         if warn!=":":
@@ -270,7 +270,7 @@
     data = get_sensors()
     for lbl in info['sensors']:
         nname = normalize_sensor(lbl)
-        value = data[lbl]["Sensor Reading"].split()[0]
+        value = data[lbl]["sensor reading"].split()[0]
         print "%s.value %s" % (nname, value)
     
 
@@ -299,10 +299,10 @@
     print SENSORS
     data = get_sensors()
     for key, value in data.items():
-        print "%s : %s (%s - %s) [%s - %s] %s" % (key, value['Sensor Reading'],
-                                                  value['Lower Non-Critical'], value['Upper Non-Critical'],
-                                                  value['Lower Critical'], value['Upper Critical'],
-                                                  value['Assertions Enabled'],)
+        print "%s : %s (%s - %s) [%s - %s] %s" % (key, value['sensor reading'],
+                                                  value['lower non-critical'], value['upper non-critical'],
+                                                  value['lower critical'], value['upper critical'],
+                                                  value['assertions enabled'],)
 
 def main():
     if len(sys.argv)>1:

Attachment: pgpmqWpU7jBOS.pgp
Description: PGP signature

Reply via email to