I got a mail in my inbox about a week ago from Anthony, telling me how to improve my Munin & temp script for a RPi:
I just read your (old) blog post about monitoring the temperature of the Raspberry Pi with munin.
I had the exact same error as you did when I was trying to let munin do the job all by himself:
> temp.value VCHI initialization failed)
It turns out the solution was quite easy: in
You simply need to tell munin that it needs to run as root for this specific plugin:
> user root
(the plugins also tracks clock speeds and voltages but any other will work just fine as long as the “user root” is set in the munin-node plugin config file : ). Probably the easiest way to check if it’s working is to use munin-run command before and after the change.
By the way, “Connect different LANs over openVPN” is pretty tempting, I always wondered what the performances would be like through a USB-to-ethernet adapter.
Have a nice one !
And indeed, I knew it was a permission issue, but instead of running this script as root, I tried adding Munin to a group that was supposed to be able to run
vcgencmd (which didn’t work out).
But, let’s look at a simpler solution:
- Go to
/etc/munin/pluginsand create a file
tempwith this content (and some indentation yourself):
#!/bin/sh case $1 in config) cat <<'EOM' graph_category system graph_title Temperature graph_vlabel temp temp.label Celsius EOM exit 0;; esac echo -n "temp.value " /opt/vc/bin/vcgencmd measure_temp | cut -d "=" -f2 | cut -d "'" -f1
- As you noticed, this doesn’t require any more scripts to run from cron (and thus, in case you used my previous script, remove it from cron)
chmod +x temp
- Make sure it runs as root; in
/etc/munin/plugin-conf.dcreate the file
temp.confwith this content:
[temp] user root
- Test it:
# munin-run temp temp.value 59.5
Thanks Anthony 🙂