Installing Monitorix under debian.

November 10th, 2008

Monitorix appears to be the most basic server monitor graphing application I can find, seeing that all I am interested in is bandwidth in/out and server load over time it is still a lot more than is needed but with out coding my own package which would take days its the best at hand. So that I have documentation of the process by which I installed monitorix and because a google for documentation provided nothing; here is what happened when I did it.

First things first monitorix requires rrdtool and librrds-perl, these can be installed with the following lines in shell:

apt-get install rrdtool
apt-get install rrdtool-perl

Once done and it should only take a few seconds, I moved o to the download page at the monitorix project. The latest package to date for Debian is the any platform linux distro monitorix-1.2.1.tar.gz. I moved to my user space and the used wget to download the package to the server without having to mess with ftp, then I extracted the archive using gzip:

cd /
wget http://www.monitorix.org/monitorix-1.2.1.tar.gz
gzip -dc ./monitorix-1.2.1.tar.gz | tar -x

Unfortunately there is no automatic apt-get script for Debian, however the monitorix group have been kind enough to simplify things by creating an install script which is as simple to run as:

cd monitorix-1.2.1
./install.sh

After that the install script asks you which system your installing it on press three for Debian (or if your reading this for another distro which ever number equals your os), next check the paths it gives and press enter if ok. I don’t know what they should be and no manual is written that will tell me so I press enter and hope for the best, you’re then issued with a Last chance to stop the installation cross your fingers hit ‘y’ and press return. If all goes well you should end up with something that looks like the following:

Installation successfully finished.

Now you have to edit the configuration file /etc/monitorix.conf
in order to setup correctly Monitorix to your operating system.

Then you'll can start Monitorix executing the init script:

/etc/init.d/monitorix.sh [start|stop|status]

and finally go to http://localhost/monitorix/ to start to see results.

NOTE: As a crond-based application, the root user will receive emails
about Monitorix execution errors. Please check the root email..

If so your now ready to setup monitorix, there are few things you need to set here unless your a more advanced user an in that case why are you even reading this, you guys are like god. In any case I use trusty old nano for the task of text editing and then start the service.

nano /etc/monitorix.conf
/etc/init.d/monitorix.sh start

Now if your server isn’t running SE-linux then when you go to http://your.domain/monitorix/ and see pretty things, however your like me and unlucky enough to be running a secure server the damn thing don’t work and simply throws up the following:

Starting Monitorix: ERROR: while creating /var/lib/monitorix/cpu.rrd: creating '/var/lib/monitorix/cpu.rrd': No such file or directory... Failed

Where as previous people seem to stop there and either disable SE-Linux to get it working, something which I believe is akin to running windows 3.1 on an unsecured network – you just shouldn’t do it, even if it works. I simply logged in as root and created the directory it so eagerly wanted to create using mkdir before retrying the start the process and being hit again with a different error:

mkdir /var/lib/monitorix/
 /etc/init.d/monitorix.sh start
Starting Monitorix: print() on closed filehandle OHTML at /usr/bin/monitorix.pl line 705.
readline() on closed filehandle IHTML at /usr/bin/monitorix.pl line 797 ... Ok

That Ok at the end doesn’t give me much hope, however it is a sign that something has worked and in a way which didn’t involve disabling server security. The problem now however is that Apache doesn’t have enough file rights to modify the $BASE_WWW directory, the $ meaning its a fixed variable not the directory name itself. I don’t know how to find this out so a further google search is needed, it would appear that the issue has been fixed for ubuntu users via here, so I believe I should be able to follow their instructions to fix this issue. The problem here is a little similar to that shown on apps.ouwu.com however it is simply down to a setup step I didn’t follow through correctly. Within the monitorix.conf file there is the following line:

our $OSTYPE="Linux-Debian";             # choose your OS type (see below)

Linux-Debian isn’t the default, and it needs to be changed to it otherwise none of the directories setup for your debian install will be used, it will instead default to something else. A little silly if you ask me but a quick fix. Upon restarting the monitorix process all works fine.

# /etc/init.d/monitorix.sh stop
Stopping Monitorix:
# /etc/init.d/monitorix.sh start
Starting Monitorix:  ... Ok

Now you have the process running fine, you will notice that the rrd files in /var/lib/monitorix/ are not being updated every minute or so, a quick fix for this as see in steps five to seven at apps.ouwu.com is to simply do the following:

mv /etc/cron.d/monitorix.sh /etc/cron.d/monitorix
chmod +x /etc/cron.d/monitorix
ls -l /var/lib/monitorix/

Repeating the last line a couple of times over the next few minutes should show that the files are being updated and you can take a sigh of relief. One last thing you may notice is that by going to http://your.domain/monitorix gives a 404, that could be because your domain is set within apache config to another directory within /var/www/ such as would be the case if you have a lot of domains hosted on that server my /var/www/ directory contains many sub directories each for one of my domains.Therefore you may want to set up a subdomain to forward to it, or simply set up a symlink pointing to /var/www/monitorix from your /var/www/domain.dir.

¬ SHARE

Tags: , , ,

Leave a Reply

It takes intelligence to work out a sum in ones head, it takes wisdom to go straight for the calculator. – Simon Dann

Link Love

  • BubblesSOC

About Photogabble

Photogabble has been developed, edited and written by Simon Dann. Simon is a 22 year old post-grad Communication, Culture & Media student, currently studying for his Masters.

Like this Website?

If you like this website you can subscribe to the feed, or recieve email updates.

TwitterCounter for @carbontwelve