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

68 lines
1.3 KiB
Bash
Executable File

#!/bin/bash
output_config() {
echo "graph_order buero server2 server2"
echo "graph_title Luftfeuchtigkeit"
echo "graph_args --base 1000 -u 100 -l -0"
echo "graph_vlabel %"
echo "graph_scale no"
echo "graph_category aqhome"
echo "buero.label Buero"
echo "server1.label Serverschrank vorne"
echo "server2.label Serverschrank hinten"
}
output_values() {
printf "buero.value %f\n" $(get_var_buero)
printf "server1.value %f\n" $(get_var_server_front)
printf "server2.value %f\n" $(get_var_server_back)
}
get_var_buero() {
/usr/local/bin/aqhome-tool getdata -N nodes/e7882098/2/humidity -tb -300 -M | cut -d$'\t' -f 2
}
get_var_server_front() {
/usr/local/bin/aqhome-tool getdata -N nodes/5f8883d2/2/humidity -tb -300 -M | cut -d$'\t' -f 2
}
get_var_server_back() {
/usr/local/bin/aqhome-tool getdata -N nodes/75766d68/2/humidity -tb -300 -M | cut -d$'\t' -f 2
}
output_usage() {
printf >&2 "%s - munin plugin to monitor humidity\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