Install Monit



Product Name: MONIT
Product Version: 5.1.1
Homepage: http://mmonit.com/monit/
Description: 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:

yum install openssl*

Step 1: Installing monit from Source

cd /usr/local/src
wget http://mmonit.com/monit/dist/monit-5.1.1.tar.gz
tar -zxvf monit-5.1.1.tar.gz
cd monit-5.1.1
./configure --sysconfdir=/etc/monit/
make && make install

Step 1.1: Cleanup source files after working install

rm -Rf /usr/local/src/monit* && cd

Step 2: Create Monit config file

mkdir /etc/monit/
mkdir /etc/monit/cfg
cd /etc/monit/
nano -w /etc/monit/monitrc

Step 2.1: Paste in this text

set daemon  60
set logfile /var/log/monit.log
set mailserver localhost
set alert change@me.net
 
# Set mail notification options:
mail-format {
   from: monit@changeme.net
   subject: $SERVICE $EVENT at $DATE
   message: Monit $ACTION $SERVICE at $DATE on $HOST,
 
   Yours sincerely,
   AI
   }
 
## Inbuilt httpd
## Disabled the httpd for extra security. Use it at your own risk.
#set httpd port 3500 and
## Change the username and password if you activate the inbuild httpd solution
#allow admin:monit
 
## httpd access control
#allow localhost       
#allow 10.0.0.10
 
# Put your Service config in /etc/monit/cfg/, They will be included.
include /etc/monit/cfg/*

Step 2.2: chmod config file to root only

chmod 700 /etc/monit/monitrc

Step 3: Creating Log file

touch /var/log/monit.log

Step 4: Making monit run as a service

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:

wget --output-document=/etc/monit/cfg/system.cfg http://www.securecentos.com/get/monit/system.cfg

SSHD cfg:

wget --output-document=/etc/monit/cfg/sshd.cfg http://www.securecentos.com/get/monit/sshd.cfg

* Change localhost to the right ip, if you are running sshd on a specific ip.
* Change port to the right port, if you have changed it to something else than 22

Apache2 Web server cfg:

wget --output-document=/etc/monit/cfg/apache2.cfg http://www.securecentos.com/get/monit/apache2.cfg

MySQLd SQL server cfg:

wget --output-document=/etc/monit/cfg/mysqld.cfg http://www.securecentos.com/get/monit/mysqld.cfg

Remember to edit every file to match your system, before you restart monit. Doublecheck file path etc..



See Monit Wiki for more examples



Share and Enjoy:
  • Print
  • Digg
  • Sphinn
  • del.icio.us
  • Facebook
  • Mixx
  • Google Bookmarks
  • email
  • PDF
  • StumbleUpon
  • Technorati

One Comment

  1. omair says:

    How we can remove it

    i was try to uninstall but i did not know the way to uninstall

    regards,

Leave a Reply