Files
aqhomecontrol/etc/munin/aqhome_power
2023-10-06 18:07:27 +02:00

57 lines
1001 B
Bash

#!/bin/bash
output_config() {
echo "graph_order stube_plug01"
echo "graph_title Stromverbrauch"
# echo "graph_args --base 1000 -u 50 -l -20"
echo "graph_args --base 1000 -l 0"
echo "graph_vlabel Watt"
echo "graph_scale no"
echo "graph_category aqhome"
echo "stube_plug01.label Stube/Heimkinosystem"
}
output_values() {
printf "stube_plug01.value %f\n" $(get_var_stube_plug01)
}
get_var_stube_plug01() {
/usr/local/bin/aqhome-tool getdata -N mqtt/plug01/powerusage -tb -300 -M | cut -d$'\t' -f 2
}
output_usage() {
printf >&2 "%s - munin plugin to monitor power usage\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