How to install Monit
monit is a utility for managing and monitoring, processes, files, directories and filesystems on a UNIX system. Monit conducts automatic maintenance and repair and can execute meaningful causal actions in error situations.
Admin note: Doing source on this, RPM Repos have older versions.
Pre Install Step:
Step 1: Installing monit from Source
Step 1.1: Cleanup source files after working install
Step 2: Create Monit config file
Step 2.1: Paste in this text
# Set mail notification options:
## Inbuilt httpd
## httpd access control
# Put your Service config in /etc/monit/cfg/, They will be included.
* REMEMBER to change username and password in above config file *
Step 2.2: chmod config file to root only
Step 3: Creating Log file
Step 4: Making monit run as a service
Step 5: Optional config files for different services:
System state cfg:
SSHD cfg:
Apache2 Web server cfg:
MySQLd SQL server cfg:
Admin note: Doing source on this, RPM Repos have older versions.
Pre Install Step:
- Code: Select all
yum install openssl*
Step 1: Installing monit from Source
- Code: Select all
cd /usr/local/src
wget http://mmonit.com/monit/dist/monit-5.0.3.tar.gz
tar -zxvf monit-5.0.3.tar.gz
cd monit-5.0.3
./configure --sysconfdir=/etc/monit/
make && make install
Step 1.1: Cleanup source files after working install
- Code: Select all
rm -Rf /usr/local/src/monit* && cd
Step 2: Create Monit config file
- Code: Select all
mkdir /etc/monit/
mkdir /etc/monit/cfg
cd /etc/monit/
nano -w /etc/monit/monitrc
Step 2.1: Paste in this text
- Code: Select all
set daemon 60
set logfile /var/log/monit.log
set mailserver localhost
set alert change@me.net
# Set mail notification options:
- Code: Select all
mail-format {
from: monit@changeme.net
subject: $SERVICE $EVENT at $DATE
message: Monit $ACTION $SERVICE at $DATE on $HOST,
Yours sincerely,
AI
}
## Inbuilt httpd
- Code: Select all
set httpd port 3500 and
allow admin:monit
## httpd access control
- Code: Select all
allow localhost
#allow 10.0.0.10
# Put your Service config in /etc/monit/cfg/, They will be included.
- Code: Select all
include /etc/monit/cfg/*
* REMEMBER to change username and password in above config file *
Step 2.2: chmod config file to root only
- Code: Select all
chmod 700 /etc/monit/monitrc
Step 3: Creating Log file
- Code: Select all
touch /var/log/monit.log
Step 4: Making monit run as a service
- Code: Select all
cd /etc/init.d/
wget --output-document=monit http://www.securecentos.com/temp/files/monit/monit.d
chmod +x /etc/init.d/monit
chkconfig --levels 235 monit on
Step 5: Optional config files for different services:
System state cfg:
- Code: Select all
wget --output-document=/etc/monit/cfg/system.cfg http://www.securecentos.com/get/monit/system.cfg
SSHD cfg:
- Code: Select all
wget --output-document=/etc/monit/cfg/sshd.cfg http://www.securecentos.com/get/monit/sshd.cfg
Apache2 Web server cfg:
- Code: Select all
wget --output-document=/etc/monit/cfg/apache2.cfg http://www.securecentos.com/get/monit/apache2.cfg
MySQLd SQL server cfg:
- Code: Select all
wget --output-document=/etc/monit/cfg/mysqld.cfg http://www.securecentos.com/get/monit/mysqld.cfg