Installing monit on Ubuntu
Installing a package from the distribution repository
$ sudo apt-get install monit
Download the latest version from here http://mmonit.com/monit/
$ cd /usr/src/
$ sudo wget http://mmonit.com/monit/dist/ monit-5.5.tar.gz
Extract tar file
$ tar zxvf monit-5.5.tar.gz
$ mv monit-5.5/ monit/
Compiling from source
$ cd monit/
$ ./configure
$ sudo make && make install
Monit control file:
$ cp /usr/src/monit/monitrc ~/.monitrc
$ sudo chmod 0700 .monitrc
Installing a package from the distribution repository
$ sudo apt-get install monit
Download the latest version from here http://mmonit.com/monit/
$ cd /usr/src/
$ sudo wget http://mmonit.com/monit/dist/ monit-5.5.tar.gz
Extract tar file
$ tar zxvf monit-5.5.tar.gz
$ mv monit-5.5/ monit/
Compiling from source
$ cd monit/
$ ./configure
$ sudo make && make install
Monit control file:
$ cp /usr/src/monit/monitrc ~/.monitrc
$ sudo chmod 0700 .monitrc
Configure Monit :
$ sudo vi /etc/monit/monitrc
$ sudo vi /etc/monit/monitrc
Monit comes with its own web server running on port 2812. To configure the web interface, find and uncomment the section that begins with.set httpd port 2812
Once the section is uncommented, write in your server’s IP or domain name as the address, allow anyone to connect, and then create a monit user and password
set httpd port 2812
use address 12.34.56.789 # only accept connection from localhost
allow 0.0.0.0/0.0.0.0 # allow localhost to connect to the server and
allow admin:monit # require user 'admin' with password 'monit'
$ sudo service monit restart
Monit comes with its own web server running on port 2812. To configure the web interface, find and uncomment the section that begins with.
set httpd port 2812
Once the section is uncommented, write in your server’s IP or domain name as the address, allow anyone to connect, and then create a monit user and passwordset httpd port 2812
use address 12.34.56.789 # only accept connection from localhost
allow 0.0.0.0/0.0.0.0 # allow localhost to connect to the server and
allow admin:monit # require user 'admin' with password 'monit'
$ sudo service monit restart
Configuring Programs Self-Monitoring :
To simply ensure that programs stay online, you can use the /etc/init.d commands to stop or start a program.
$ sudo vi /etc/monit/monitrc
Here are some example configurations:
Apache:
check process apache with pidfile /run/apache2.pid
start program = "/etc/init.d/apache2 start" with timeout 60 seconds
stop program = "/etc/init.d/apache2 stop"
MySQL
check process mysqld with pidfile /var/run/mysqld/mysqld.pid
start program = "/etc/init.d/mysql start"
stop program = "/etc/init.d/mysql stop"
Nginx
check process nginx with pidfile /var/run/nginx.pid
start program = "/etc/init.d/nginx start"
stop program = "/etc/init.d/nginx stop"
To simply ensure that programs stay online, you can use the /etc/init.d commands to stop or start a program.
$ sudo vi /etc/monit/monitrc
Here are some example configurations:
Apache:
check process apache with pidfile /run/apache2.pid
start program = "/etc/init.d/apache2 start" with timeout 60 seconds
stop program = "/etc/init.d/apache2 stop"
MySQL
check process mysqld with pidfile /var/run/mysqld/mysqld.pid
start program = "/etc/init.d/mysql start"
stop program = "/etc/init.d/mysql stop"
Nginx
check process nginx with pidfile /var/run/nginx.pid
start program = "/etc/init.d/nginx start"
stop program = "/etc/init.d/nginx stop"
Comments
Post a Comment