Installing Munin on CentOS to monitor MySQL and Apache
I'll make this guide quick and straight to the point. Follow these steps and Munin will be up and collecting stats quickly.
Apache and MySQL
You are monitoring the same server that munin is installed on, The server's name is server1.example.com., /var/www = document root
- Add the RPMforge repository rpm -Uhv http://apt.sw.be/packages/rpmforge-release/rpmforge-release-0.3.6-1.el4....
- Install munin, munin-node, and dependencies yum -y install munin munin-node
- Create a directory to serve the Munin site underneath your document root md /var/www/monitor
- Grant the proper permissions chown munin:munin monitor Note: You may need to adjust the permissions on the parent directory to allow Munin to "see" the monitor directory. chmod 751 /var/www should do the trick
- Edit the munin.conf file to change the location where munin will serve its files and change the host information vi /etc/munin/munin.conf htmldir /var/www/monitor ... # a simple host tree [server1.example.com] address 127.0.0.1 use_node_name yes
That completes munin and munin-node installation. Now onto the munin-node configuration. By default, Munin doesn't monitor Apache or MySQL. Fortunately it does include the plugins to do so.
- Create a MySQL user with no permissions to any databases. See the MySQL documentation for more detail. You could use the root account, but I'd advise against that.
- Edit the munin-node plugin configuration file vi /etc/munin/plugin-conf.d/munin-node [mysql*] env.mysqlopts -u muninuser -pmuninpassword Note: Its important to remember not to put a space between the -p and the password. Your MySQL user account doesn't have to have a password.
- Create symbolic links to the MySQL and Apache plugins ln -s /usr/share/munin/plugins/apache_* /etc/munin/plugins/ ln -s /usr/share/munin/plugins/mysql_* /etc/munin/plugins/
- Edit the Apache configuration (httpd.conf) to allow extended status Uncomment the following lines: ExtendedStatus On <Location /server-status> SetHandler server-status Order deny,allow Deny from all Allow from 127.0.0.1 </Location>
- Add munin-node to the bootup and start the service chkconfig munin-node on service munin-node start
That's it. Sit back and watch Munin do its thing.