twem
Posts: 3
Joined: Sun Jul 08, 2012 12:04 pm

Munin Temperature Monitoring

Sat Sep 29, 2012 9:43 pm

I installed Munin on my PI today and wanted to see if i could get it to monitor the temperature.

I could not find a conclusive guide on how to set this up so i thought i would post my notes in case it helped anyone else.

Install munin as per normal.

Within the munin plugins folder

Code: Select all

/etc/munin/plugins
Write a new file, I called mine "temp"

Copy the below into the file

Code: Select all

#!/bin/sh

case $1 in
   config)
        cat <<'EOM'

graph_title Temperature
graph_vlabel temp in C
graph_args --base 1000 -l 0
graph_category Temperature
temp.label Temperature
temp.warning 60
temp.critical 85


EOM
        exit 0;;
esac
temp=`sudo /opt/vc/bin/vcgencmd measure_temp | cut -d"=" -f 2 | cut -d"'" -f 1`
echo "temp.value "$temp""
Then you need to change the sudoers file to allow the command to run, i kept getting

Code: Select all

VCHI initialization failed
for a long time before i worked this out.

Code: Select all

sudo visudo
Change the below

Code: Select all

#includedir /etc/sudoers.d
pi ALL=(ALL) NOPASSWD: ALL
to

Code: Select all

#includedir /etc/sudoers.d
pi ALL=(ALL) NOPASSWD: ALL
nobody ALL=(ALL) NOPASSWD: /opt/vc/bin/vcgencmd

To save and quit
Ctrl+x
y
Enter

its now ready to test

Code: Select all

munin-run temp
It should display the current temperature of your pi, after 5 min the new graph should show up in the munin web screens.

Code snippets are pulled from lots of different sites on the web I would give credit but I have forgotten where it all come from

Commends, Criticism, Improvements are all welcome

val
Posts: 2
Joined: Sun Nov 04, 2012 2:58 pm

Re: Munin Temperature Monitoring

Sun Nov 04, 2012 3:09 pm

Hey,

just wanted to tell you that the the usage of sudo + sudoers is not really the way to do things for munin-node.

You can specify the user under which the script is run in the plugin configuration.

Create a file with the plugin name: /etc/munin/plugin-conf.d/temp

Put this inside the file:

Code: Select all

[ptemp]
user root
Cheers,
Val

val
Posts: 2
Joined: Sun Nov 04, 2012 2:58 pm

Re: Munin Temperature Monitoring

Sun Nov 04, 2012 3:57 pm

val wrote:

Code: Select all

[ptemp]
user root
Woops.. copy+paste error (my plugin was named ptemp). This is the correct content of the file:

Code: Select all

[temp]
user root

sanchomuzax
Posts: 13
Joined: Tue Apr 09, 2013 9:36 pm

Re: Munin Temperature Monitoring

Tue Apr 23, 2013 11:44 am

Can you help me?

What is it? I don't know that "this by eating or drinking". :mrgreen:

Code: Select all

VCHI initialization failed
What is the problem?

Code: Select all

$ munin-run temp
# Unknown service 'temp'
List of folder:
Image
Thank you for your help!

karlos13
Posts: 13
Joined: Wed May 01, 2013 3:36 am

Re: Munin Temperature Monitoring

Wed May 01, 2013 3:52 am

I get the same thing, The standard graphs work though.

Its like the plugin is not enabled and it does not show up when I do the munin configure command.

This one also does not work either:
https://github.com/perception101/pisense

I get the impression I'm doing something wrong or is the plugin amiss?

EDIT: A permissions change on the /cache/plugins new plugin enabled it and all is good

Tony2k
Posts: 4
Joined: Sun May 26, 2013 10:15 pm

Re: Munin Temperature Monitoring

Sun May 26, 2013 10:26 pm

karlos13 wrote: EDIT: A permissions change on the /cache/plugins new plugin enabled it and all is good
Hi karlos,
I have the same problem with the pisense plugin... where did you change the permissions exacly? cant find cache/plugins

karlos13
Posts: 13
Joined: Wed May 01, 2013 3:36 am

Re: Munin Temperature Monitoring

Mon May 27, 2013 12:28 am

Tony2k wrote:
karlos13 wrote: EDIT: A permissions change on the /cache/plugins new plugin enabled it and all is good
Add the plugin here: /usr/share/munin/plugins and make it 0755 (?)
Then add to etc/munin/plugin conf
[pisense_*]
user root

Then run the link command and that should be it.

Code: Select all

ln -s /usr/share/munin/plugins/pisense_ /etc/munin/plugins/pisense_
From there I think if you have success running

Code: Select all

munin-node pisense
the new plugin will be seen by the 5 minute cron, otherwise the /var/munin log is helpful.

Tony2k
Posts: 4
Joined: Sun May 26, 2013 10:15 pm

Re: Munin Temperature Monitoring

Mon May 27, 2013 10:39 am

karlos13 wrote:
Tony2k wrote:
karlos13 wrote: EDIT: A permissions change on the /cache/plugins new plugin enabled it and all is good
otherwise the /var/munin log is helpful.
log:

Code: Select all

2013/05/27-12:19:08 [3088] Error output from pisense_temp:
2013/05/27-12:19:08 [3088]      /etc/munin/plugins/pisense_temp: 5: /etc/munin/plugins/pisense_temp: Syntax error: newline unexpected
2013/05/27-12:19:08 [3088] Service 'pisense_temp' exited with status 2/0.
2013/05/27-12:19:08 [3088] Error output from pisense_:
2013/05/27-12:19:08 [3088]      /etc/munin/plugins/pisense_: 5: /etc/munin/plugins/pisense_: Syntax error: newline unexpected
2013/05/27-12:19:08 [3088] Service 'pisense_' exited with status 2/0.
2013/05/27-12:19:09 [3088] Error output from pisense_volt:
2013/05/27-12:19:09 [3088]      /etc/munin/plugins/pisense_volt: 5: /etc/munin/plugins/pisense_volt: Syntax error: newline unexpected
2013/05/27-12:19:09 [3088] Service 'pisense_volt' exited with status 2/0.
2013/05/27-12:19:09 [3088] Error output from pisense_clock:
2013/05/27-12:19:09 [3088]      /etc/munin/plugins/pisense_clock: 5: /etc/munin/plugins/pisense_clock: Syntax error: newline unexpected
2013/05/27-12:19:09 [3088] Service 'pisense_clock' exited with status 2/0.
2013/05/27-12:19:14 Pid_file already exists for running process (3088)... aborting
the path I followed:

Code: Select all

/usr/share/munin/plugins/pisense_
sudo chmod 755 /usr/share/munin/plugins/pisense_
sudo chown root:root /usr/share/munin/plugins/pisense_
sudo nano /etc/munin/plugin-conf.d/munin-node
add
[pisense_*]
user root
ln -s /usr/share/munin/plugins/pisense_ /etc/munin/plugins/pisense_clock
ln -s /usr/share/munin/plugins/pisense_ /etc/munin/plugins/pisense_volt
ln -s /usr/share/munin/plugins/pisense_ /etc/munin/plugins/pisense_temp
sudo /etc/init.d/munin-node restart
I have no idea why this does not work... :(

sanchomuzax
Posts: 13
Joined: Tue Apr 09, 2013 9:36 pm

Re: Munin Temperature Monitoring

Mon May 27, 2013 11:20 am

Pid_file already exists for running process (3088)... aborting
Is it possible that you running more than once the munin service?

Test it:

Code: Select all

service munin-node status
If "yes", then stop the services, and restart again.

Or test it with it:

Code: Select all

sudo munin-run pisense_clock config

Tony2k
Posts: 4
Joined: Sun May 26, 2013 10:15 pm

Re: Munin Temperature Monitoring

Mon May 27, 2013 12:07 pm

Code: Select all

root@raspberrypi /usr/share/munin/plugins > service munin-node status
[ ok ] Munin-Node is running (PID: 14985).

root@raspberrypi /usr/share/munin/plugins > sudo munin-run pisense_clock config
/etc/munin/plugins/pisense_clock: 5: /etc/munin/plugins/pisense_clock: Syntax error: newline unexpected

sanchomuzax
Posts: 13
Joined: Tue Apr 09, 2013 9:36 pm

Re: Munin Temperature Monitoring

Mon May 27, 2013 12:24 pm

I think that your plugin configuration is bad.

Because the munin-run on pisense_clock config should be the following:

Code: Select all

sudo munin-run pisense_clock config
graph_title Raspberry Pi clock frequencies
graph_args --base 1000
graph_vlabel herz
graph_category sensors
clockarm.label arm clock Frequency
clockarm.min 0
...
I'm not linux expert, but is it possible that you and I using different root privilege. My default root user the "pi", not the root. I'm not using the "root", because the "pi" is the root, as you can see the sudo on my examples.

I'm using the temp monitor also and it's working correctly:
Image

My file privileges:
Image
and
Image

The all symlinks are linking to "/usr/.../pisense_":
Image

Tony2k
Posts: 4
Joined: Sun May 26, 2013 10:15 pm

Re: Munin Temperature Monitoring

Mon May 27, 2013 1:15 pm

I also use the default user "pi", but I was in with "sudo -s" so i dont have to type sudo again and again.

My privileges seems equal to yours:

Code: Select all

pi@raspberrypi /etc/munin/plugins $ ls -l pis*
lrwxrwxrwx 1 root root 33 Mai 27 12:17 pisense_ -> /usr/share/munin/plugins/pisense_
lrwxrwxrwx 1 root root 33 Mai 16 23:44 pisense_clock -> /usr/share/munin/plugins/pisense_
lrwxrwxrwx 1 root root 33 Mai 16 23:45 pisense_temp -> /usr/share/munin/plugins/pisense_
lrwxrwxrwx 1 root root 33 Mai 16 23:44 pisense_volt -> /usr/share/munin/plugins/pisense_

pi@raspberrypi /usr/share/munin/plugins $ ls -l pis*
-rwxr-xr-x 1 root root 53542 Mai 17 00:39 pisense_

Return to “Advanced users”

Who is online

Users browsing this forum: No registered users and 25 guests