Files
ebusd/contrib/munin/plugins/ebusd_
T

60 lines
1.7 KiB
Bash
Executable File

#!/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"
echo "energy"
exit 0
fi
prefix=`basename "$0"`
if [ "$prefix" = "ebusd_temp" ]; then
sensors="outsidetemp BrineTempInput BrineTempOutput FlowTemp mcFlowTempSensor hwTankTemp RoomTemp rc4:RoomTemp"
elif [ "$prefix" = "ebusd_press" ]; then
sensors="BrinePress HeatSystemPress VaporPressHigh VaporPressLow"
elif [ "$prefix" = "ebusd_power" ]; then
sensors="ActualEnvironmentPower"
else
sensors="YieldEnvironmentEnergy"
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"
elif [ "$prefix" = "ebusd_power" ]; then
echo "graph_title ebusd Leistung"
echo "graph_vlabel kW"
else
echo "graph_title ebusd Ertrag"
echo "graph_vlabel kWh"
fi
echo 'graph_category Heizung'
for sensor in $sensors; do
echo ${prefix}_${sensor/:/_}.label $sensor
if [ "$prefix" = "ebusd_energy" ]; then
echo ${prefix}_${sensor/:/_}.type COUNTER
fi
print_warning ${prefix}_${sensor/:/_}
print_critical ${prefix}_${sensor/:/_}
done
exit 0
fi
for sensor in $sensors; do
if [ "${sensor/:/_}" = "$sensor" ]; then
RESULT=`echo "r $sensor"|nc localhost 8888 2>/dev/null|head -n 1|sed -e 's#;.*$##'`
else
RESULT=`echo "r -c ${sensor/:/ }"|nc localhost 8888 2>/dev/null|head -n 1|sed -e 's#;.*$##'`
fi
echo ${prefix}_${sensor/:/_}.value $RESULT
done