Differences

This shows you the differences between two versions of the page.

Link to this comparison view

linux:munin [2017/09/06 16:34]
linux:munin [2014/09/19 13:54] (current)
onno [Munin]
Line 1: Line 1:
 +====== Munin ======
  
 +[[http://munin.projects.linpro.no/|munin]]: is a graphing tool that uses rrdtool. It has a lot of Apache plugins (including two for Passenger!).  See [[http://muninexchange.projects.linpro.no/?search=&cid=1&os[4]=on&os[7]=on&os[3]=on&os[2]=on&os[5]=on&os[8]=on&os[1]=on&os[6]=on|list]].
 +
 +Here's [[http://waste.mandragor.org/munin_tutorial/munin.html#plugins|a guide]] on how to install and configure plugins.
 +
 +Restart your ''node'' after you've installed or configured a plugin:
 +
 +<code>
 +/etc/init.d/munin-node restart
 +</code>
 +
 +Please note that it may take up to five minutes before your plugin shows up in your munin website (apparently, munin polls only every 5 minutes).
 +
 +
 +===== Installation & Configuration =====
 +
 +I had no trouble installing Munin through apt-get on Ubuntu 6.06. You have to install two packages:
 +
 +<code>
 +apt-get install munin
 +apt-get install munin-node
 +</code>
 +
 +The ''node'' gathers data, the 'monitor' plots it.
 +
 +Note, added 20140908: I did have some dependency problems while installing munin-node on Ubuntu 8.04. In the end, I solved these by downloading and installing each of the required ''.deb'' packages (a number of Perl libraries or modules, one of which is ''libwww-perl'' to get Apache monitoring all set).
 +
 +If you run into any further trouble with Apache monitoring, see [[http://articles.slicehost.com/2010/4/9/enabling-munin-node-plug-ins-on-ubuntu|Enabling munin node plug-ins on Ubuntu]]
 +
 +=== Website ===
 +
 +The monitoring graphs are displayed on a website. By default, munin places the website scripts in ''/var/www/munin''. I have created an Apache virtual host which symlinks to this location:
 +
 +<code>
 +ln -s /var/www/munin public_html
 +# public_html -> /var/www/munin
 +</code>
 +
 +And for a later version of munin, under Debian 6.0.5:
 +<code>
 + ln -s /var/cache/munin/www /home/muninstats/public_html
 +</code>
 +
 +Don't forget to restrict access to this website through e.g. [[linux:apache_webserver#securing_a_web_directory_with_apache|.htpasswd]].
 +===== Plugins =====
 +
 +The default plugins are in ''/usr/share/munin/plugins/''. They appear in your munin website if they're symlinked in ''/etc/munin/plugins''. You must also configure them in the file ''/etc/munin/plugin-conf.d/munin-node''.
 +
 +
 +
 +
 +
 +
 +
 +==== Plugin configuration ====
 +
 +If you want to configure multiple plugins at once, use an asterisk notation. E.g.:
 +
 +<code>
 +[apache*]
 +</code>
 +
 +This addresses all apache plugins, which are by default:
 +
 +<code>
 +apache_accesses
 +apache_processes 
 +apache_volume
 +</code>
 +
 +Usually when you look at the source code of the plugins (they're mostly perl scripts), you will find configuration instructions. For instance, the apache plugins need access to Apache's server status, so you have to configure Apache (i.e. httpd.conf):
 +
 +<code>
 +<Location /server-status>
 +    SetHandler server-status
 +    Order deny,allow
 +    Deny from all
 +    Allow from 127.0.0.1
 +</Location>
 +ExtendedStatus on
 +</code>
 +
 +I should also mention that some plugins seem to exclude each other. For instance, the ''apache_average_time_last_n_requests'' plugin (not installed by default) seems to exclude the other (default) apache plugins.
 +
 +
 +
 +
 +
 +===== Adding a New Server for Monitoring =====
 +
 +This comes down to:
 +
 +  - installing munin-node on the new server (don't forget to configure the plugins for this munin node)
 +  - adding the new server's ip-address to ''/etc/munin/munin.conf'' (on the munin server)
 +
 +You should also make sure that the new server's firewall is configured for telnet (port 4949).
 +
 +
 +
 +
 +
 +
 +
 +
 +
 +
 +
 +
 +==== 1. Installing munin-node ====
 +
 +<code>
 +apt-get install munin-node
 +</code>
 +
 +Add the ip address of the Munin server (i.e. the "master") to ''/etc/munin/munin-node.conf'':
 +
 +<code>
 +  allow ^xxx\.xxx\.xxx\.xxx$
 +</code>
 +
 +(Yes, you have to use the regexp format)
 +
 +Now go to ''/etc/munin/plugins'', add symlinks to the apache plugins:
 +
 +<code>
 +ln -s /usr/share/munin/plugins/apache_accesses .
 +ln -s /usr/share/munin/plugins/apache_processes .
 +ln -s /usr/share/munin/plugins/apache_volume .
 +</code>
 +
 +Add the plugins to the list in ''/etc/munin/plugin-conf.d/munin-node'':
 +
 +<code>
 +[apache*]
 +</code>
 +
 +Restart the munin node:
 +<code>
 +/etc/init.d/munin-node restart
 +</code>
 +
 +Remember to open the firewall for port 4949 (Telnet)!
 +
 +=== Apache Plugins ===
 +
 +Apache plugins use Apache's mod_status to retrieve information. So, make sure that you've got mod_status installed (which it is by default under Ubuntu), and configured in ''/etc/apache2/apache2.conf'':
 +
 +<code>
 +<Location /server-status>
 +    SetHandler server-status
 +    Order deny,allow
 +    Deny from all
 +    Allow from 127.0.0.1
 +</Location>
 +
 +ExtendedStatus on
 +</code>
 +
 +Don't forget to restart Apache. You can test the server-status call using wget:
 +
 +<code>
 +wget http://localhost/server-status
 +--21:33:13--  http://localhost/server-status
 +           => `server-status'
 +Resolving localhost... 127.0.0.1
 +Connecting to localhost|127.0.0.1|:80... connected.
 +HTTP request sent, awaiting response... 200 OK
 +Length: 2.811 (2.7K) [text/html]
 +
 +100%[===================================================================================================================================================================>] 2.811         --.--K/s             
 +
 +21:33:13 (65.38 MB/s) - `server-status' saved [2811/2811]
 +</code>
 +
 +You should get a 200 OK response. (You might want to delete the new file 'server-status' afterwards).
 +
 +
 +
 +
 +==== 2. Configure Munin Server ====
 +
 +Add the ip address of the node server to the file ''/etc/munin/munin.conf'':
 +
 +<code>
 +[ArbitraryServerName] # Apparently, you can't use spaces in this name
 +    address xxx.xxx.xxx.xxx
 +    use_node_name yes
 +</code>
 +
 +The Munin server (the 'master') will read the new values within 5 minutes (the default polling interval).

Personal Tools