From d3b393dece2de3c48cfd800190c23e566421a34b Mon Sep 17 00:00:00 2001 From: Jens Maus Date: Wed, 24 Oct 2018 09:38:53 +0200 Subject: [PATCH] added more lnx_thermal information so that the thermal zone of a GPU is also added to the check_mk output as well as the trip_point limits defined by the hardware. --- addon/addon/server.tcl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/addon/addon/server.tcl b/addon/addon/server.tcl index 1a1a4f8..77d3a9d 100755 --- a/addon/addon/server.tcl +++ b/addon/addon/server.tcl @@ -27,9 +27,9 @@ proc handle_connection { channelId clientAddress clientPort } { puts $channelId [string trim [load_from_file /proc/vmstat]] puts $channelId [string trim [load_from_file /proc/stat]] - if { [file exists /sys/class/thermal/thermal_zone0/temp] == 1} { + if { [file exists /sys/class/thermal/thermal_zone0] == 1} { puts $channelId "<<>>" - puts $channelId "thermal_zone0 enabled [string trim [load_from_file /sys/class/thermal/thermal_zone0/type]] [string trim [load_from_file /sys/class/thermal/thermal_zone0/temp]]" + puts $channelId [exec sh -c {for F in /sys/class/thermal/thermal_zone*; do if [ ! -e "$F/mode" ] || [ "$(cat ${F}/mode)" == "disabled" ]; then continue; fi; echo -n "${F##*/} "; for m in mode type temp; do cat "$F"/${m} 2>/dev/null | tr \\n " "; done; for i in $(seq 1 $(ls $F/trip_point_*_type 2>/dev/null| wc -l)); do cat "$F"/trip_point_${i}_temp "$F"/trip_point_${i}_type 2>/dev/null | tr \\n " "; done; echo; done}] } if { [file exists /proc/net/tcp6] == 1 } {