Monitoring with Munin PDF Print E-mail
User Rating: / 1
PoorBest 
Written by Bart Dorlandt   
Tuesday, 07 July 2009 12:43

Munin is a great tool for creating graphs of your system.

"Munin is a server/node pair that graphs, htmlifies and optionally sends out notifications about data it gathers. It's designed to let it be easy to graph new datasources"

To have it on one system only is really easy. First install the files and afterwards configuring the /etc/munin/munin.conf (as always, adjust it to your needs)

sudo apt-get install munin-node munin
dbdir   /var/lib/munin
htmldir /path/to/your/website/directory
logdir /var/log/munin
rundir /var/run/munin

tmpldir /etc/munin/templates

#graph_period minute

#graph_strategy cgi

[bama.bamweb.nl]
address 127.0.0.1
use_node_name yes

Add the following to your apache virtual host:

        
AllowOverride None
#AddHandler cgi-script cgi pl
#Options ExecCGI FollowSymLinks Indexes
Options ExecCGI -MultiViews +SymLinksIfOwnerMatch

Now restart your service and have apache virtual host point to that directory and your done.

Munin with CGI

Since I'm not always watching these graphics I don't need my system to generate them every 5 minutes. We can choose to only generate the images when requested. This is done by CGI.

sudo apt-get install munin-cgi-graph 

enable cgi in the config /etc/munin/munin.conf

graph_strategy cgi

Change the following files and directories. I assume your apache user is www-data.

chgrp www-data /var/log/munin /var/log/munin/munin-graph.log
chmod g+w /var/log/munin /var/log/munin/munin-graph.log

chgrp -R www-data /path/to/your/website/directory
chmod -R g+w /path/to/your/website/directory

Next, we have to fine tune the logrotate of munin /etc/logrotate.d/munin. NOTE: the mod and the user www-data. These has been changed.

/var/log/munin/munin-graph.log {
daily
missingok
rotate 7
compress
notifempty
create 660 munin www-data
}

After all that and the next run of munin-html you've switched to cgi graphing. In case there are any problems you should watch your apache error log, and the munin-graph.log.

/etc/init.d/munin restart

Adding an extra node

To add an extra node, you need to install munin-node on the client and change the configuration on both sides.

on the client:

sudo apt-get install munin-node

change the config file: /etc/munin/munin-node.conf. Add the ip addresses you want to allow (the server) in the form as described below

allow ^103\.210\.56\.48$

on the server. Add the name and the ip address of the client machine. Make sure port 4949 is opened or choose another port to access.

[dipsy.bamweb.nl]
address 82.172.145.217
use_node_name yes

Restart munin afterwards and wait a while to let the information to be generated.

/etc/init.d/munin-node restart

 

Have your sensors in munin

Install lm-sensors and run sensors-detect. Follow the questions and let it write to /etc/modules

apt-get install lm-sensors

sensors-detect

Add the following symlinks.

ln -s /usr/share/munin/plugins/sensors_ /etc/munin/plugins/sensors_fan
ln -s /usr/share/munin/plugins/sensors_ /etc/munin/plugins/sensors_temp
ln -s /usr/share/munin/plugins/sensors_ /etc/munin/plugins/sensors_volt

you can test your sensorrs by executing

sensors

SMART Monitoring with Munin

Note that smartmontools must be installed and smartd running before munin will pick up and use smart. Configure smart using the way mentioned on this wiki here: SMART

After SMART is running:

ln -s /usr/share/munin/plugins/smart_ /etc/munin/plugins/smart_sda

edit the following:
vi /etc/munin/plugin-conf.d/munin-node

#uncomment
#[smart_*]
#user root
#include
[smart_sda]
user root
env.smartargs -d ata -a

[smart_sdb]
user root
env.smartargs -d ata -a

Extra info:

Last Updated on Tuesday, 11 August 2009 09:53
 


Related items: