From 0de6620fe521233e9fe73308f88e217dfcf88d09 Mon Sep 17 00:00:00 2001 From: "Thomas A. F. Thorne" Date: Wed, 25 Apr 2018 16:30:27 +0100 Subject: [PATCH 1/5] Add Basic MUNIN Plugin Add a very basic MUNIN plugin based on the Munin example shell plugin. For this munin-plugin to work, you must already have "installed" a copy of TEMPered to /usr/local/bin/tempered. As TEMPered requires root permissions to access some devices, a TEMPered.conf.d plugin configuration file is included. Copy this to the /etc/munin/plugin-conf.d/ directory on your system. Either copy the TEMPered munin-plugin file to your /etc/munin/plugins/ directory or take the more common approach of creating a symlink in there to the munin-plugin/TEMPered file. Restart your munin-node service and you should see readings begin for the sensor. --- munin-plugin/TEMPered | 41 ++++++++++++++++++++++++++++++++++++ munin-plugin/TEMPered.conf.d | 5 +++++ 2 files changed, 46 insertions(+) create mode 100755 munin-plugin/TEMPered create mode 100644 munin-plugin/TEMPered.conf.d diff --git a/munin-plugin/TEMPered b/munin-plugin/TEMPered new file mode 100755 index 0000000..f4e00ce --- /dev/null +++ b/munin-plugin/TEMPered @@ -0,0 +1,41 @@ +#!/bin/sh + +output_config() { + echo "graph_title TEMPered Readings" + echo "plugins.label Temperature readings from TEMPered" +} + +output_values() { + printf "plugins.value %f\n" $(tempered_reading) +} + +tempered_reading() { + /usr/local/bin/tempered | grep -oE "\-{0,1}[[:digit:]]+\.[[:digit:]]+" +} + +output_usage() { + printf >&2 "%s - munin plugin to show TEMPered readings\n" ${0##*/} + printf >&2 "Usage: %s [config]\n" ${0##*/} +} + +case $# in + 0) + output_values + ;; + 1) + case $1 in + config) + output_config + ;; + *) + output_usage + exit 1 + ;; + esac + ;; + *) + output_usage + exit 1 + ;; +esac + diff --git a/munin-plugin/TEMPered.conf.d b/munin-plugin/TEMPered.conf.d new file mode 100644 index 0000000..79e01e2 --- /dev/null +++ b/munin-plugin/TEMPered.conf.d @@ -0,0 +1,5 @@ +# Configuration for the TEMPered Plugin + +[TEMPered] +user root + From 4d1462bcace6cab3526910d32d02e37fa557ff52 Mon Sep 17 00:00:00 2001 From: "Thomas A. F. Thorne" Date: Fri, 27 Apr 2018 08:42:40 +0100 Subject: [PATCH 2/5] Record Every Temperature Reported In Munin Previously only the first temperature reading was recorded in the Munin plugin. This update records each reading in turn. --- munin-plugin/TEMPered | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/munin-plugin/TEMPered b/munin-plugin/TEMPered index f4e00ce..733c79a 100755 --- a/munin-plugin/TEMPered +++ b/munin-plugin/TEMPered @@ -2,11 +2,21 @@ output_config() { echo "graph_title TEMPered Readings" - echo "plugins.label Temperature readings from TEMPered" + count=0 + for i in $(tempered_reading) + do + echo "temp_$count.label Temp $count" + count=$((count+1)) + done } output_values() { - printf "plugins.value %f\n" $(tempered_reading) + count=0 + for i in $(tempered_reading) + do + printf "temp_%d.value %f\n" $count $i + count=$((count+1)) + done } tempered_reading() { From 799587ee74d201139387b93fa23fb134069d5a8c Mon Sep 17 00:00:00 2001 From: "Thomas A. F. Thorne" Date: Fri, 27 Apr 2018 08:43:47 +0100 Subject: [PATCH 3/5] Put Munin Chart Under sensors Category Many of the other temperature reading plugins for Munin are under the sesnors category. If we do not specify a category we get placed under "other". --- munin-plugin/TEMPered | 1 + 1 file changed, 1 insertion(+) diff --git a/munin-plugin/TEMPered b/munin-plugin/TEMPered index 733c79a..9071cf6 100755 --- a/munin-plugin/TEMPered +++ b/munin-plugin/TEMPered @@ -2,6 +2,7 @@ output_config() { echo "graph_title TEMPered Readings" + echo "graph_category sensors" count=0 for i in $(tempered_reading) do From 53dbeee2c1bc61ceedb1021275e317bf4b7a3a68 Mon Sep 17 00:00:00 2001 From: "Thomas A. F. Thorne" Date: Fri, 27 Apr 2018 08:47:21 +0100 Subject: [PATCH 4/5] Label Vertical Axis Of Munin Chart MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Existing temperature reading charts label their vertical axis as Degrees Celsius. I would use a degree symbol ° and a capital C but Munin's support for rendering this seems a little off. --- munin-plugin/TEMPered | 1 + 1 file changed, 1 insertion(+) diff --git a/munin-plugin/TEMPered b/munin-plugin/TEMPered index 9071cf6..777167b 100755 --- a/munin-plugin/TEMPered +++ b/munin-plugin/TEMPered @@ -3,6 +3,7 @@ output_config() { echo "graph_title TEMPered Readings" echo "graph_category sensors" + echo "graph_vlabel Degrees Celsius" count=0 for i in $(tempered_reading) do From 4aec089cfbb412d55ede916ec24e1c5b0eff129f Mon Sep 17 00:00:00 2001 From: "Thomas A. F. Thorne" Date: Fri, 27 Apr 2018 08:48:56 +0100 Subject: [PATCH 5/5] Add Graph Info To Munin Chart Of Temperatures graph_info gives a little background to what the readings on a chart are. Add short note explaining where these reading come from. --- munin-plugin/TEMPered | 1 + 1 file changed, 1 insertion(+) diff --git a/munin-plugin/TEMPered b/munin-plugin/TEMPered index 777167b..a120dd1 100755 --- a/munin-plugin/TEMPered +++ b/munin-plugin/TEMPered @@ -4,6 +4,7 @@ output_config() { echo "graph_title TEMPered Readings" echo "graph_category sensors" echo "graph_vlabel Degrees Celsius" + echo "graph_info Temperature readings taken from TEMPere devices" count=0 for i in $(tempered_reading) do