Http://blog.chinaunix.net/uid-21516619-id-1825022.html
Some time ago in the Linux, need to use Monit to monitor Tomcat, studied the Monit, now will install and configure the process to write down, maybe later forget to use,
monit Installation and configuration
I. INTRODUCTION
Monit is a software used to monitor processes, files, directories, and devices under a Unix-like platform to repair programs that stop operating or operate abnormally, and to handle software errors that are caused by a variety of reasons.
Second, the installation
Assume that the following installation and configuration are performed under root status.
Installation is very simple, download Monit source code (now the latest version is 4.10.1) monit-4.10.1.tar.gz, put it in the appropriate directory, and then extract, configure (the default settings can), Make,make install. Use the following command specifically in the terminal:
Tar–xzf monit-4.10.1.tar.gz
CD monit-4.10.1
./configure
Make
Make install
It will be ready for installation soon.
Third, the configuration
After installation, copy the Monit configuration file monitrc to the/etc directory in the Monit source directory, using the command:
CP Monitrc/etc
Note/ETC/MONITRC access to this file cannot be greater than 0700, so you may also need to modify its access rights:
chmod 600/ETC/MONITRC
Then open/etc/monitrc This file for configuration, Monit has been most of the configuration of the example in the inside, most of the configuration can only be configured in front of the # (note) removed and then modify it accordingly. We primarily use Monit to monitor Tomcat servers, so the configuration is as follows:
Set Daemon 120 # setting Monit to run as a daemon and monitor once every 2 minutes
# 2 minutes is the default time interval, with examples of multiple configurations seen from the Web
# See the time interval is also 2 minutes, should be more reasonable
Set Logfile/var/log/monit.log # Sets the location of the log file, and if you want to write to the system log, you can
# set LogFile Syslog
Set httpd port 2812 and # Monit built-in one for viewing monitored services
# Status of HTTP server, note open in firewall
# This port ' 1 ', otherwise non-localhost inaccessible