Suite à l’installation d’un Raspberry Pi dans ma salon avec raspbmc, et ayant déjà une solution de monitoring Munin @Home, je suis tombé sur cet article fort intéressant pour surveiller la température de ce boitier.
Pour cela, une fois munin-node installé sur le raspberry, il suffit de créer un plugin basé sur la commande vcgencmd permettant d’obtenir la température.
root@raspbmc:/home/pi# vim /usr/share/munin/plugins/pi_temp
#!/bin/sh
#
# Plugin to monitor raspberry pi internal Temperature
# version: 2013-01-18
# author: Dju
#
# install the plugin :
# save it in /usr/share/munin/plugins, then activate it with a symbolic link
# ln -s /usr/share/munin/plugins/pi_temp /etc/munin/plugins/
#
# Magic markers (optional - only used by munin-config and some installation scripts):
#%# family=contrib
VCG=/opt/vc/bin/vcgencmd
WARN=70
CRIT=75
if [ "$1" = "autoconf" ]; then
if [ -x $VCG ]; then
echo yes
exit 0
else
echo no
exit 1
fi
elif [ "$1" = "config" ]; then
echo "graph_title Pi Temperature"
echo "graph_args --base 1000"
echo "graph_vlabel Celsius"
echo "graph_category sensors"
echo "graph_info This graph shows Temperatur data from $LOCATION"
echo "temp.label temp"
echo "temp.type GAUGE"
echo "temp.info Celsius."
echo "temp.colour 00ff00"
echo "temp.warning $WARN"
echo "temp.critical $CRIT"
exit 0
fi
temp=$($VCG measure_temp | cut -d'=' -f2 | cut -d"'" -f1)
echo "temp.value $temp"
Une fois ce plugin créé, faire un chmod +x du fichier puis activez le plugin avec un lien symbolique :
chmod +x /usr/share/munin/plugins/pi_temp ln -s /usr/share/munin/plugins/pi_temp /etc/munin/plugins/
Il vous suffit alors de rédémarrer le service munin-node et attendre quelques minutes pour voir apparaitre le graphique :

Pour plus de détails sur la source de ce plugin et le fonctionnement du Raspberry Pi, voir ici : http://blog.crifo.org/post/2013/01/19/reception-et-installation-du-raspberry-pi
2 Comments