21Aug/093
Ubuntu / Debian Linux: Install Monit Linux Server Monitoring Utility
->
How do I install monit to monitor my server under Debian / Ubuntu Linux?
Monit is a utility for managing and monitoring processes, files, directories and devices on a Debian / Ubuntu Linux server system. Here a few common uses of monit:
- Monit can start a process if it does not run
- Restart a process if it does not respond
- Stop a process if it uses to much resources etc
How do I install monit utility for monitoring services?
Type the following command as the root user:
$ sudo apt-get update $ sudo apt-get install monit
Configure monit
Open monit configuration file /etc/monit/monitrc using vi text editor or nano command in linux:
# vi /etc/monit/monitrc
OR
# nano /etc/monit/monitrc
You need to set following parameters:
set daemon 120 set logfile syslog facility log_daemon set mailserver localhost # primary mailserver set alert vivek@nixcraft.com # receive all alerts
The next step is to save and close this file. Where,
- set daemon 120 : Start monit in background as daemon and check the services at 2-minute intervals.
- set logfile syslog facility log_daemon : Log messages in /var/log/messsages file
- set mailserver localhost : Send email alert via localmail server such as sendmail. Set list of mailservers for alert delivery. Multiple servers may be specified using comma separator. By default monit uses port 25 - it is possible to override it with the PORT option.
- set alert vivek@nixcraft.com : You can set the alert recipients here, which will receive the alert for each service. The event alerts may be restricted using the list.
Now open /etc/default/monit file to turn on monit service:
# vi /etc/default/monit
OR
# nano /etc/default/monit
Set startup to 1, so monit can start:
startup=1
Save and close the file.
Start the monit Linux monitor tool / service:
# /etc/init.d/monit start