Munin is a monitoring tool for servers. It uses RRDtool to log and graph data from your servers. The plugin API is very easy to grasp. Actually, I haven’t read the API documentation yet. I just looked at the output of the plugins and it looks easy to achieve. The data can be accessed through the web.
Munin works by polling your servers for the data hence two applications, Munin and Munin Node. The former periodically gathers data (cronned) and the latter serves the data to the former. Please refer to the following for our example configuration. You can make up a domain if you want Munin to group your servers similar to the live demo.
Munin “Graph Server” – graph-server.net (10.10.10.1)
A Munin Node – munin-sample.net (100.100.100.2)
1. Installing and Configuring Munin
In this section, we set it up on graph-server.net
Add the RPMforge repository.
#rpm -Uhv http://apt.sw.be/packages/rpmforge-release/rpmforge-release-0.3.6-1.el4.rf.i386.rpm
This step is optional if your Linux distribution has the packages in its default repositories.
Install munin.
#yum -y install munin
Change the ownership of the Munin web docroot to munin.
#chown -R munin:munin /var/www/munin
The default configuration file (in version 1.2.5-1) the value for the web docroot points to the wrong directory. Replace the value of htmldir from /var/www/html/munin to /var/www/munin at /etc/munin/munin.conf (line 7).
Restart Apache and Cron, service httpd restart && service crond restart
You can check if it’s working through your browser (i.e. http://10.10.10.1/munin/). You will get a 404 (not found) if you don’t supply a trailing slash.
2. Add a Node
In this section, we will configure munin-sample.net.
Add the RPMforge repository (see 1.1).
Install Munin Node.
#yum -y install munin-node
Configure. Edit /etc/munin/munin-node.conf with your favorite text editor.
Allow the graph server (graph-server.net/10.10.10.1) to poll the node.
allow ^192\.168\.1\.1$
If your server doesn’t report the correct hostname, add the following line
host_name munin-sample.net
If your servers have two interfaces and on the same LAN (e.g. one for Internet and another for LAN), you can configure the node to bind and listen on the local interface by changing the value of host (line 13) from * to the local IP of the node.
Start munin-node and set to start on bootup.
#service munin-node start
#chkconfig munin-node on
Edit Munin’s configuration on the graph server (/etc/munin/munin.conf).
[munin-sample.net]
address 100.100.100.2
use_node_name yes
Wait for at least 5 minutes for the new node to appear. You can also install the node on the graph server. The default node configuration will work out of the box.
3. Install/Activate Some Plugins
This section should familiarize you with the plugin installation routine. Plugins are installed in the nodes.
Apache
Create a symbolic link to the Apache plugins (stored in /usr/share/munin/plugins) in the plugin folder.
#ln -s /usr/share/munin/plugins/apache_* /etc/munin/plugins/
Enable server status reports. Add the following to Apache’s configuration file.
ExtendedStatus On
<Location /server-status>
SetHandler server-status
Order Deny,Allow
Deny from all
Allow from 127.0.0.1
</Location>
Restart Apache and the node
service httpd restart && service munin-node restart
Asterisk
Download the plugins for your Asterisk version from here.
Extract them to /usr/share/munin/plugins.
Make the files executable
#chmod 755 /usr/share/munin/plugins/asterisk_*
Configure Asterisk Manager by adding/changing the following in /etc/asterisk/manager.conf
[general]
enabled = yes
port = 5038
[munin]
secret = somepassword
permit = 127.0.0.1 ;if this doesn't work, use the local IP
write = system,call,log,verbose,command,agent,user
Add the following to the plugin configuration file in /etc/munin/plugin-conf.d/munin-node
[asterisk_*]
env.username munin
env.secret somepassword
Reload Asterisk's configuration and restart the node.
asterisk -rx reload >> /dev/null && service munin-node restart
MySQL
Create a symbolic link to the MySQL plugins (stored in /usr/share/munin/plugins) in the plugin folder.
#ln -s /usr/share/munin/plugins/mysql_* /etc/munin/plugins/
If your root user has a password (or want to use a different user), edit the plugin configuration file in /etc/munin/plugin-conf.d/munin-node and uncomment line 16 by removing the leading hash (#). Then change the parameters that will be used when mysqladmin is run.
Restart the node
#service munin-node restart
MTR
Make sure you have the latest version of MTR.
#yum -y install mtr && yum -y update mtr
Extract to /usr/share/munin/plugins
Make the file executable.
#chmod 755 /usr/share/munin/plugins/mtr100_
Create a symbolic link to the plugin (stored in /usr/share/munin/plugins) in the plugin folder. Append the host that you want to query to the link of the name.
#ln -s /usr/share/munin/plugins/mtr100_ /etc/munin/plugins/mtr100_somehost.com
To add another host to query, just create another symbolic link.
Add the following to the plugin configuration file in /etc/munin/plugin-conf.d/munin-node
[mtr100_*]
timeout 60
Restart the node
#service munin-node restart
No comments:
Post a Comment