servicemon Installation Guide
Installing servicemon is reasonably straightforward. Here's the detail.
Step 1: Get servicemon
The first thing you need to do is get servicemon via the download page.
If you run Debian or a Debian-based distribution such as Ubuntu, choose the .deb, otherwise grab the tarball.If you use PGP, I recommend you verify the servicemon archive you have just downloaded, just in case it has been corrupted or maliciously altered. There are some instructions available.
If you downloaded the .deb, simply install it with 'dpkg -i servicemon-blah.deb' or using your preferred graphical tool. The .deb will install servicemon to /usr/sbin and documentation to /usr/share/doc/servicemon.
If you didn't get the .deb, you need to decompress the archive you downloaded. To decompress the tarball use 'tar -xvzf servicemon-ver.tar.gz'. Now simply change to the servicemon directory and run 'make install'.
Step 2: Configure servicemon
Copy the example servicemon configuration file, servicemon.conf.example, from the servicemon directory (or from /usr/share/doc/servicemon/examples/ if you installed the Debian package) to /etc/servicemon.conf.There are a number of values to configure:
INIT_SCRIPT_LOCATION
This is the location on your system where sysvinit script live. These are the scripts used to start/stop programs on your system. On Redhat/Fedora/Mandriva/SuSE systems this is typically /etc/rc.d/init.d/, while on Debian/Ubuntu/Xandros systems it's /etc/init.d/.
Simpy modify the existing INIT_SCRIPT_LOCATION line so that it looks something like this:
INIT_SCRIPT_LOCATION = "/etc/init.d/"
MAIL_RECIPIENT
This is the address to which e-mail error messages will be sent. If you do not wish to have servicemon send any e-mails, you can safely leave this as the default value. If you do want it to send e-mails, it needs to look something like the following:
MAIL_RECIPIENT = "mail@mydomain.co.uk"
MAIL_ON_RESTARTED
This value determines if servicemon sends a notification e-mail when a service is found not to be running and is successfully restarted. If set to 0, an e-mail is not sent. If set to 1, an e-mail will be sent. It needs to look something like the following:
MAIL_ON_RESTARTED = 1
MAIL_ON_WONTSTART
This value determines if servicemon sends a notification e-mail when a service is found not to be running and failed to restart. If set to 0, an e-mail is not sent. If set to 1, an e-mail will be sent. It needs to look something like the following:
MAIL_ON_WONTSTART = 1
Services
Copy the example servicemon services configuration file, servicemon-services.conf.example, from the servicemon directory (or from /usr/share/doc/servicemon/examples/ if you installed the Debian package) to /etc/servicemon-services.conf.
This file is in the form of a list of service names (corresponding to init scripts in /etc/init.d/), one per line. E.g.
ssh
apache2
exim4
Note that not all applications have full init scripts which support checking the service status. You can test this by calling the init script with the 'status' option and seeing whether you get some useful output or an error, for example:
/etc/init.d/foo status
Step 3: Configure your system to start servicemon on boot (optional)
If you downloaded the Debian package, servicemon has already been configured to start on boot, so you can skip this step.As every distribution is different, you'll need to see your distribution manual for how to configure services to start at boot-time.