2010-03-17 11:48:24 +01:00
|
|
|
#!/bin/bash
|
|
|
|
|
2012-03-01 17:03:07 +01:00
|
|
|
# Written by Lars Falk-Petersen <cleware@falk-petersen.no>
|
|
|
|
# Version 0.4. See https://github.com/ways
|
|
|
|
# To be used with http://www.vanheusden.com/clewarecontrol/
|
2010-07-19 14:00:15 +02:00
|
|
|
# Clewarecontrol device serial must be set in config file:
|
|
|
|
|
|
|
|
# #Put the following lines in /etc/munin/plugin-conf.d/cleware
|
2012-03-01 17:03:07 +01:00
|
|
|
# [cleware*]
|
|
|
|
# #device serial. find it by running: clewarecontrol -l
|
|
|
|
# env.serial 7778
|
|
|
|
# #path of clewarecontrol
|
|
|
|
# env.bin /usr/bin/clewarecontrol
|
|
|
|
#
|
|
|
|
# Munin must be able to read and write to the device.
|
|
|
|
# Run the following as root:
|
|
|
|
# # chgrp munin /dev/usb/hiddev0
|
|
|
|
# # chmod g+rw /dev/usb/hiddev0
|
|
|
|
#
|
|
|
|
# If that works, you have to make it permanent. On Ubuntu:
|
|
|
|
# Create this file: /etc/udev/rules.d/99-hidraw-permissions.rules
|
|
|
|
# #Allow munin to read hidraws from Cleware
|
|
|
|
# SUBSYSTEM=="usb", KERNEL=="hiddev*", GROUP="munin", MODE="0660"
|
2010-03-17 11:48:24 +01:00
|
|
|
|
|
|
|
case $1 in
|
|
|
|
config)
|
|
|
|
cat <<'EOM'
|
|
|
|
graph_title Temperature And Humidity
|
|
|
|
graph_vlabel C / %
|
|
|
|
graph_category sensors
|
|
|
|
temp.label Temperature
|
|
|
|
hum.label Humidity
|
|
|
|
graph_order temp hum
|
|
|
|
graph_args --base 1000
|
|
|
|
|
|
|
|
EOM
|
|
|
|
exit 0;;
|
|
|
|
esac
|
|
|
|
|
2010-07-19 14:00:15 +02:00
|
|
|
[ ! $bin ] && bin="clewarecontrol"
|
|
|
|
if [ ! $serial ]; then
|
|
|
|
echo "Serial not set! Hint: Read the top of this script."
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
2012-03-01 17:03:07 +01:00
|
|
|
$bin -d $serial -c 1 -ag > /dev/null 2>&1
|
2010-03-17 11:48:24 +01:00
|
|
|
|
|
|
|
echo -n "temp.value "
|
2011-12-18 15:11:52 +01:00
|
|
|
$bin -d $serial -b -c 1 -rt
|
2010-03-17 11:48:24 +01:00
|
|
|
|
|
|
|
echo -n "hum.value "
|
2011-12-18 15:11:52 +01:00
|
|
|
$bin -d $serial -b -c 1 -rh
|