Package: munin-plugins-core
Version: 2.0.25-1
Severity: normal
Tags: upstream patch

Hi,

As the subject says; I'm including a patch to get ACPI thermal
zones from /sys, as this is the current interface for modern
kernels (I don't have a single machine where the old one is
supported anymore). Also means non-ACPI machines like ARM
single-board computers are supported.

-- System Information:
Debian Release: 8.4
  APT prefers stable
  APT policy: (750, 'stable'), (500, 'proposed-updates')
Architecture: amd64 (x86_64)
Foreign Architectures: i386

Kernel: Linux 4.4.0 (SMP w/40 CPU cores)
Locale: LANG=en_DK.UTF-8, LC_CTYPE=en_DK.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Init: systemd (via /run/systemd/system)

Versions of packages munin-plugins-core depends on:
ii  munin-common  2.0.25-1
ii  perl          5.20.2-3+deb8u4

Versions of packages munin-plugins-core recommends:
ii  libnet-snmp-perl  6.0.1-2

Versions of packages munin-plugins-core suggests:
pn  conntrack                     <none>
pn  libcache-cache-perl           <none>
ii  libdbd-mysql-perl             4.028-2+b1
ii  libnet-dns-perl               0.81-2
pn  libnet-netmask-perl           <none>
ii  libnet-telnet-perl            3.04-1
ii  libxml-parser-perl            2.41-3
ii  python                        2.7.9-1
ii  ruby                          1:2.1.5+deb8u2
ii  ruby1.9.1 [ruby-interpreter]  1.9.3.194-8.1+deb7u3
ii  ruby2.1 [ruby-interpreter]    2.1.5-2+deb8u2

-- no debconf information
>From 724d90f600bdd5c91736a54b80641a2110c403e4 Mon Sep 17 00:00:00 2001
From: "Steinar H. Gunderson" <se...@google.com>
Date: Tue, 24 May 2016 00:53:10 +0200
Subject: [PATCH 1/1] Update acpi plugin to use the /sys interface.

This is pretty universal now; none of my machines even have
thermal zones in /proc/acpi anymore, but all of them have
them in /sys, which has a much more uniform interface anyway.

As an extra bonus (and the original motivation for the patch),
allows the plugin to understand non-ACPI thermal zones, e.g.
on my ARM SBC, which doesn't have ACPI at all, but has thermal
sensors for both CPU and GPU.
---
 plugins/node.d.linux/acpi.in | 28 +++++++++++++---------------
 1 file changed, 13 insertions(+), 15 deletions(-)

diff --git a/plugins/node.d.linux/acpi.in b/plugins/node.d.linux/acpi.in
index 95ce21c..e64e283 100644
--- a/plugins/node.d.linux/acpi.in
+++ b/plugins/node.d.linux/acpi.in
@@ -13,7 +13,7 @@ Linux systems with ACPI support.
 
 =head1 CONFIGURATION
 
-Load the 'thermal_zone' kernel module and the plugin gets the thermal zones from /proc/acpi/thermal_zones/*/ automagically.
+Load the 'thermal' kernel module and the plugin gets the thermal zones from /sys/class/thermal/thermal_zone*/ automagically.
 
 =head1 USAGE
 
@@ -47,33 +47,31 @@ GPLv2
 =cut
 
 
-ATZ="$(echo /proc/acpi/thermal_zone/*/temperature)"
+ATZ="$(echo /sys/class/thermal/thermal_zone*)"
 
 do_ () { # Fetch
-    echo "$ATZ" | tr ' ' '\n' | awk -F'[ /\t]*' '{
-         ZONE=$5
-         getline < $0
-         print ZONE".value "$2
-    }'
+    for ZONE in $ATZ; do
+         TEMP=`cat $ZONE/temp`
+         echo `basename $ZONE`.value `echo $TEMP \* 0.001 | bc`
+    done
     exit 0
 }
 
 do_config () {
     echo "graph_title ACPI Thermal zone temperatures"
-    echo "graph_vlabel Celcius"
+    echo "graph_vlabel Celsius"
     echo "graph_category sensors"
     echo "graph_info This graph shows the temperature in different ACPI Thermal zones.  If there is only one it will usually be the case temperature."
-    echo "$ATZ" |
-    awk -F'[ /]' '{
-         print $5".label "$5;
-    }'
-                  
+    for ZONE in $ATZ; do
+         TYPE=`cat $ZONE/type`
+         echo `basename $ZONE`.label $TYPE
+    done
 }
 
 do_autoconf () {
     for f in $ATZ; do
-	test -r $f || {
-	    echo "no (cannot read $f)"
+	test -r $f/temp || {
+	    echo "no (cannot read $f/temp)"
 	    exit 0
 	}
     done
-- 
2.8.0.rc3.226.g39d4020

Reply via email to