Resolving troubleshooting with Munin
Linux April 14th, 2010
This are some problems that you may encounter after installing Munin:
Apache modules are not tracking, so they are not showing statistics, you may want to check Munin logs (specifically /var/log/munin/munin-node.log) to see what is going on.
If you got something like Can’t locate object method “new” via package “LWP::UserAgent”, you need to install the package libwww-perl which contains the LWP::UserAgent required. Thanks to Crowdway.
If you already have installed the libwww-perl package, but Munin is still not showing data, you may need to enable and configure the status module on Apache. Make sure you allow localhost (and the name of the server as well) to access the location server-status on apache2.conf or status.conf. Also, this plugins need the ExtendedStatus flag to be On.
You should have something like:
<IfModule mod_status.c>
#
# Allow server status reports generated by mod_status,
# with the URL of http://servername/server-status
# Uncomment and change the ".example.com" to allow
# access from other hosts.
#
ExtendedStatus On
<Location /server-status>
SetHandler server-status
Order deny,allow
Deny from all
Allow from localhost ip6-localhost
Allow from vps02.graphium.net
#Allow from .example.com
</Location>
<IfModule>
Sometimes you can get permission errors on your logs, so the best way to get rid of them is to ensure that all involved files in Munin process are own by munin user and group. We can run as root:
$ chown -R munin.munin /var/lib/munin /var/log/munin /var/www/munin
There are some plugins that require a parameter to work. For example, those that refer to networking (if_, if_err_, ip_) needs the network interface we want to track. In my case (VPS), this is venet0, but on a usual box it can be eth0.
We can list the available interfaces by running the command:
$ ifconfigThen, to correctly enable this modules, we need to append the name of the interface:
$ ln -s /usr/share/munin/plugins/if_ /etc/munin/plugins/if_venet0
A convenient way to see the result of each module, we can run them independently:
$ munin-run apache_processes busy80.value 7 idle80.value 1 $ munin-run if_venet0 down.value 7721322 up.value 37550800
By this command, we can ensure that the plugin is working fine and getting results.
Tags: Apache, Monitoring, Munin, Ubuntu, VPS
Install Munin on Ubuntu Server
Linux, Ubuntu April 6th, 2010
Munin is a small tool for monitoring resources on servers. I think it is very useful, specially on small VPS, that needs to save resources. Reports are written as HTML files, so we will need a Web Server like Apache to see this reports.
First, we install it and add some extra plugins:
$ sudo apt-get install munin munin-plugins-extra
Now, we can make some changes to the default configuration, located at /etc/munin/munin.conf. For example, we can change any of the paths where Munin works:
dbdir /var/lib/munin htmldir /var/www/munin logdir /var/log/munin rundir /var/run/munin
Specially, the htmldir path, where all the reports are written to see through Apache or the one you are using. Remember to move the directory /var/www/munin to where you wanted if you change that configuration line. We can protect this directory with an htaccess file to only give access to some users.
We can configure email notifications if a change occur (like from a OK situation to a WARNING). To do this, we just need to uncomment or add the following line:
contact.someuser.command mail -s "Munin notification" your@email.com
By default, Munin will monitor localhost, but we can add other boxes (clients), these machines will only need to install munin-node package.
Then, we can enable some plugins (more plugins can be found here and here). To do this, we need to create a symbolic link per each plugin we want to activate. I’m going to enable apache and mysql modules, but you are free to enable the modules you need:
$ cd /etc/munin/plugins $ sudo ln -s /usr/share/munin/plugins/apache_* . $ sudo ln -s /usr/share/munin/plugins/mysql_* .
Each time a module is enable or disable, we need to restart the service, so we can do the following:
$ sudo /etc/init.d/munin-node restart
Also, it is recommended to reassign all files on the htmldir to munin user and group by doing:
$ sudo chown munin.munin -R /var/www/munin
And then, to avoid waiting 5 minutes until munin cron runs again, we force it by:
$ sudo /usr/bin/munin-cron --force-root
If we are not completely satisfied with the default template, we can modify it, they are HTML files (with some minor special template tags). Anyone with some knowledge of HTML and CSS can do that. We can even download other already created templates (I have found some errors on that template’s JavaScript, I hope I’ll get some time to post the modified template, in the meanwhile, if anyone need it, please drop me a line to send you the files).
Finally, as this post is not as complete as I would like, I leave some links that may help:
Cloud Computing en el mundo del Web Hosting
Cloud Computing, Web March 21st, 2009
Encontré este artículo sobre el Cluod Computing, específicamente en el mercado del web hosting y como está revolucionando una industria que no ha sufrido de cambios importantes en los últimos años (nada más allá del incremento de espacio, procesamiento y ancho de banda). Vale la pena leerlo.
Además, ya existen plataformas open-source como esta y esta, que permiten convertir la infraestructura actual en una verdadera Cloud Computing.
Por último, también queria comentar sobre el nuevo servicio (lanzado recién esta semana) que ofrece Mosso (del gigante Rackspace) en lo que es servidores on demand, Cloud Servers, un concepto similar al Amazon EC2 (Elastic Compute Cloud), pero con la ventaja de poder contratar instancias (servidores) más pequeños (desde 256MB de RAM).
Permite trabajar con varias distribuciones de Linux (incluida Ubuntu
) y a diferencia del servicio de Amazon, existe persistencia en la data (si apagamos una instancia de EC2, toda la informacion del servidor se pierde). Lo he estado probando algunos días y va muy bien (instale el Tomcat y el PostgreSQL), aunque aún hay cosas que mejorar, como permitir que los backups que se hacen de los servidores, sigan existiendo a pesar de eliminar el servidor (para evitar que sigan cobrando por el, y que podamos levantarlo en otro momento cuando lo necesitemos).
Voy a seguir probandolo algunos días más, y si todo va bien, le doy de baja al VPS que tengo con eApps (que lo uso básicamente para mis repositorios de Subversion) y me quedo con Cloud Servers.
Tags: Amazon, Amazon AWS, Amazon EC2, Cloud Servers, Hosting, Linux, Mosso, On Demand, Open Source, Rackspace, Ubuntu, VPS
About