You are reading

Installing Monit 5 on Ubuntu 9.04

Posted: June 16, 2009 | By: TJ | In Technology | 2 comments

Monit is a free open source utility for managing and monitoring, processes, files, directories and filesystems on a UNIX system. Monit also conducts automatic maintenance and repair and can execute meaningful causal actions in error situations. Since the Monit package for Ubuntu 9.04 is pretty old (4.x), we’re going to apt-get the package and then install from source. This way we can use the init scripts that come with the package. First, install the older Monit package:

$ apt-get install monit

Make sure all of the monit files are in place — /etc/default/monit and /etc/init.d/monit — and then we can remove the package:

$ apt-get remove monit

Now, the newer version of Monit has a few different dependencies that the 4.x version did not have. Although your system may be different, I needed to install bison and flex:

$ apt-get install bison flex

Once we’ve got the dependencies, we can download the source. I usually set up source files in /opt but it’s only a preference:

$ wget http://mmonit.com/monit/dist/monit-5.0.1.tar.gz
$ tar xzvf monit-5.0.1.tar.gz
$ cd monit-5.0.1

Now we can configure the source:

$ ./configure

Be sure to watch the output here. If you notice that you are missing any dependencies, go back and install them first. Otherwise, you will be unable to install Monit 5. If the output is clean, you can make and make install:

$ make
$ make install

Now Monit 5 should be installed. We’ll need to update the init script and the configuration file to use the new Monit installation path:

$ vi /etc/init.d/monit

Now, look for the PATH and DAEMON variables — change them so they look like this:

PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/bin
DAEMON=/usr/local/bin/monit

If you are unsure where Monit was installed, just run the following command:

$ whereis monit

The output should look something like:

monit: /etc/monit /usr/local/bin/monit

The big part is editing the monitrc file. This will differ for everyone depending on what system services you are running and what you want monitored. I would suggest checking the Monit wiki for some good configuration examples for various system services. I’ve included mine as well. One of the only quirks I noticed while setting Monit up this way was that the install paths did not update automatically with the new installation. For instance, while trying to update the monitrc file, I was prompted with this:

$ monit reload
-bash: /usr/sbin/monit: No such file or directory

I fixed this by creating a symlink and copying the monitrc file to the new location:

$ ln -s /usr/local/bin/monit /usr/sbin/monit
$ cp /etc/monit/monitrc /usr/local/etc/monitrc

Now I can reload the configuration file and check the monitrc syntax before restarting:

$ monit -c /usr/local/etc/monitrc -t

Comments for this entry

There is a sync request for Monit here:
https://bugs.edge.launchpad.net/ubuntu/+source/monit/+bug/426402

If you can help completing it according to the process linked, it woud increase chances monit install is easier in Ubuntu 10.04.

Leave your comment



Copyright © 2010. All rights reserved.

This blog is powered by WordPress and proudly hosted by (mt) Media Temple.