From ccb9d45a3ce32449901d0325ee460f9db2ef8778 Mon Sep 17 00:00:00 2001 From: john30 Date: Mon, 26 Jan 2015 23:31:52 +0100 Subject: [PATCH] first version with combined plugin for pressure, temperature, and power --- contrib/munin/README.md | 8 +++---- contrib/munin/plugins/ebusd_ | 46 ++++++++++++++++++++++++++++++++++++ 2 files changed, 50 insertions(+), 4 deletions(-) create mode 100755 contrib/munin/plugins/ebusd_ diff --git a/contrib/munin/README.md b/contrib/munin/README.md index f874bb31..d8bfc65f 100644 --- a/contrib/munin/README.md +++ b/contrib/munin/README.md @@ -8,9 +8,9 @@ Personally, I use them for checking mainly temperatures, pressures and earned en - prerequisite is of course a running munin installation on the local host - to install the plugins: - git checkout https://github.com/john30/ebusd-munin.git - - chmod a+x ebusd-munin/plugins/* - - sudo cp ebusd-munin/plugins/* /etc/munin/plugins + - sudo cp ebusd-munin/plugins/* /usr/share/munin/plugins/ - sudo munin-node-configure --shell - - run all "ln -s" commands printed by munin-node-configure + - run all "ln -s" commands printed by munin-node-configure and containing "ebusd_" - sudo service munin-node reload - - that's it + +that's it. diff --git a/contrib/munin/plugins/ebusd_ b/contrib/munin/plugins/ebusd_ new file mode 100755 index 00000000..49634882 --- /dev/null +++ b/contrib/munin/plugins/ebusd_ @@ -0,0 +1,46 @@ +#!/bin/bash +#%# family=auto +#%# capabilities=autoconf +#%# capabilities=suggest +. $MUNIN_LIBDIR/plugins/plugin.sh +if [ "$1" = "autoconf" ]; then + echo "yes" + exit 0 +fi +if [ "$1" = "suggest" ]; then + echo "temp" + echo "press" + echo "power" + exit 0 +fi +prefix=`basename "$0"` +if [ "$prefix" = "ebusd_temp" ]; then + sensors="outsidetemp BrineTempInput BrineTempOutput FlowTemp mcFlowTempSensor hwTankTemp" +elif [ "$prefix" = "ebusd_press" ]; then + sensors="BrinePress HeatSystemPress VaporPressHigh VaporPressLow" +else + sensors="ActualEnvironmentPower" +fi +if [ "$1" = "config" ]; then + if [ "$prefix" = "ebusd_temp" ]; then + echo "graph_title ebusd Temperaturen" + echo "graph_vlabel Grad" + elif [ "$prefix" = "ebusd_press" ]; then + echo "graph_title ebusd Drucksensoren" + echo "graph_vlabel Bar" + else + echo "graph_title ebusd Ertrag" + echo "graph_vlabel kW" + fi + echo 'graph_category Heizung' + for sensor in $sensors; do + echo ${prefix}_${sensor}.label $sensor + print_warning ${prefix}_$sensor + print_critical ${prefix}_$sensor + done + exit 0 +fi +for sensor in $sensors; do + RESULT=`echo "r $sensor"|nc localhost 8888 2>/dev/null|head -n 1|sed -e 's#;.*$##'` + echo ${prefix}_${sensor}.value $RESULT +done