Monitoring the Rails server with Munin

By AKM
May 13, 2010
Munin is an open source alternate for monitoring your application servers

Install Munin

sudo apt-get install munin munin-node
For more detailed steps see here

Install the gems on the server 
sudo gem install request-log-analyzer munin-plugins-rails 
Add passenger plugins: 
sudo request-log-analyzer-munin install 
Add application log monitoring
sudo request-log-analyzer-munin add <app_name> <path_to_log_file> 
app_name: this will be the prefix for the graphs and the munin plugins so it should be a valid identifier i.e should be alphanumeric.
path_to_log_file: the path to the application log file. request-log-analyzer will run on this file. 

Note that the default config files assume executables are in /usr/local/bin. In case, they are in /usr/bin, run the following script on the terminal to create soft links.
for exe in ruby request-log-analyzer passenger-status passenger-memory-stats do
    ln -s /usr/bin/$exe /usr/local/bin/$exe
done
Restart Munin: 
sudo service munin-node restart 

Munin Dashboard 

Ideally, you would like to access munin dashboard from your browser. Here are the steps:

create config file /etc/apache2/sites-available/munin with following content 
<VirtualHost *:80> 
    ServerName munin.yourserver.com 
    DocumentRoot /var/cache/munin/www 
    <Directory "/var/cache/munin/www"> 
        Options -Indexes FollowSymLinks 
        AllowOverride AuthConfig FileInfo 
        Order allow,deny 
        Allow from all 
    </Directory>
</VirtualHost>
# Enable the site 
ln -s /etc/apache2/sites-available/munin /etc/apache2/sites-enabled/munin 

# Restart Apache 
apache2ctl graceful 
 
# Set up subdomain: 
Make sure the DNS is set up properly. Point the sudomain munin.yourserver.com to your server's IP address. 
 

Info

  • Plugins are installed in: /etc/munin/plugins
  • Plugin configurations are in: /etc/munin/plugin-conf.d 
  • Log files are: /var/log/munin/munin-node.log 

References

  • http://www.alfajango.com/blog/how-to-monitor-your-railspassenger-app-with-munin
  • https://github.com/barttenbrinke/munin-plugins-rails 

Alternatives

In case, you would like to explore some other options: 
/ / / /