Monit Configuration monitoring boot nginx php mysql redis mongodb server

Source: Internet
Author: User
Tags fpm mongodb mongodb server php mysql redis solr

Start: Monit-ic/etc/monitrc &
Crontab-e
*/600 * * * */USR/LOCAL/BIN/MONIT-IC/ETC/MONITRC &
Conf configuration:
————— nginx php mysql redis mongodb configuration perfect OK —————— –
# Nginx
Check process Nginx with Pidfile/usr/local/nginx/logs/nginx.pid
Start program = "/usr/local/nginx/sbin/nginx"
Stop program = "/usr/bin/killall Nginx"
If failed host 127.0.0.1 Port then restart
If CPU is greater than 40% for 2 cycles then alert
If CPU > 60% for 5 cycles then restart
If restarts within cycles then timeout
# PHP5-FPM
Check process php-fpm with Pidfile/var/run/php-fpm.pid
Start program = "/USR/LOCAL/PHP5.3/SBIN/PHP-FPM"
Stop program = "/usr/bin/killall php-fpm"
If failed port 9000 then restart
If CPU is greater than 40% for 2 cycles then alert
If CPU > 60% for 5 cycles then restart
If ten restarts within cycles then timeout# PHP5-FPM.
Check file Php5-fpm-tcp_bin with PATH/USR/LOCAL/PHP5.3/SBIN/PHP-FPM
If restarts within cycles then timeout
If failed checksum then Unmonitor
If failed permission 755 then Unmonitor
If failed UID Root then Unmonitor
If failed GID root then Unmonitor
Alert root@localhost# Test the init scripts.
Check file Php5-fpm-tcp_init with PATH/USR/LOCAL/PHP5.3/SBIN/PHP-FPM
If failed checksum then Unmonitor
If failed permission 755 then Unmonitor
If failed UID Root then Unmonitor
If failed GID root then Unmonitor
Alert Root@localhost
# MySQL
Check process MySQL with Pidfile/var/lib/mysql/localhost.localdomain.pid
Group database
Start program = "/sbin/service mysql start"
Stop program = "/sbin/service mysql stop"
If failed port 8306 then restart
If 3 restarts within cycles then timeout
# Redis
Check process Redis with Pidfile/var/run/redis.pid
Start program = "/usr/local/redis/redis-server/usr/local/redis/redis.conf"
Stop program = "/usr/bin/killall redis-server"
If failed host 127.0.0.1 Port 6379 then restart
If CPU is greater than 40% for 2 cycles then alert
If CPU > 60% for 5 cycles then restart
If restarts within cycles then timeout
# MongoDB
Check process Mongod with Pidfile/usr/local/mongodb/data/mongod.lock
Start program = "/usr/local/mongodb/bin/mongod–dbpath=/usr/local/mongodb/data/"
Stop program = "/usr/bin/killall Mongod"
If failed port 27017 protocol HTTP and request "/" with timeout seconds then
If restarts within cycles then timeout
—————-End ——————-
/usr/local/mmonit/bin/mmonit-c/usr/local/mmonit/conf/server.xml-t
/usr/local/mmonit/bin/mmonit-c/usr/local/mmonit/conf/server.xml Start
Monit-t
Killall Monit
MONIT-IC/ETC/MONITRC &
Telinit Q
PS aux |grep monit
KILL-1 1
PS aux |grep redis-server
Killall Redis-server
Ll/var/run/redis.pid
/usr/local/redis/redis-server/usr/local/redis/redis.conf &
PS aux |grep php-fpm
Killall PHP-FPM
/usr/local/php5.3/sbin/php-fpm
PS aux |grep mongod
Killall Mongod
/usr/local/mongodb/bin/mongod–dbpath=/usr/local/mongodb/data/&
Set Mmonit Http://monit:monit@142.4.48.50:8080/collector
Set Nginx port and
Use Address 142.4.48.50
Allow localhost
Allow 142.4.48.50
Http://mmonit.com/wiki/Monit/Nginx
location/monit/{
Rewrite ^/monit/(. *)/$1 break;
Proxy_ignore_client_abort on;
Proxy_pass http://192.168.1.10:2812;
Proxy_redirect Http://192.168.1.10:2812/monit;
}
Https://gist.github. Com/franck
# include/etc/monit.d/*
# MySQL
Check process mysqld with Pidfile/var/lib/mysql/localhost.localdomain.pid
Group database
Start program = "/etc/init.d/mysql start"
Stop program = "/etc/init.d/mysql Stop"
If failed host 127.0.0.1 Port 8306 then restart
If 5 restarts within 5 cycles then timeout
# Nginx
Check process Nginx with Pidfile/usr/local/nginx/logs/nginx.pid
Start program = "/usr/local/nginx/sbin/nginx"
Stop program = "/usr/bin/killall Nginx"
If failed host 127.0.0.1 Port then restart
If CPU is greater than 40% for 2 cycles then alert
If CPU > 60% for 5 cycles then restart
If restarts within cycles then timeout
# Redis
Check process Redis with Pidfile/var/run/redis.pid
Start program = "/usr/local/redis/redis-server/usr/local/redis/redis.conf"
Stop program = "/usr/bin/killall redis-server"
If restarts within cycles then timeout
Check file Dump.rdb with Path/usr/local/redis/dump.rdb
If size > MB then alert
# PHP5-FPM
Check process php-fpm with Pidfile/var/run/php-fpm.pid
Start program = "/USR/LOCAL/PHP5.3/SBIN/PHP-FPM"
Stop program = "/usr/bin/killall php-fpm"
If failed host 127.0.0.1 Port 9000 then restart
If CPU is greater than 40% for 2 cycles then alert
If CPU > 60% for 5 cycles then restart
If restarts within cycles then timeout
# PHP5-FPM Binary.
Check file Php5-fpm-tcp_bin with PATH/USR/LOCAL/PHP5.3/SBIN/PHP-FPM
If restarts within cycles then timeout
If failed checksum then Unmonitor
If failed permission 755 then Unmonitor
If failed UID Root then Unmonitor
If failed GID root then Unmonitor
Alert Root@localhost
# Test the init scripts.
Check file Php5-fpm-tcp_init with PATH/USR/LOCAL/PHP5.3/SBIN/PHP-FPM
If failed checksum then Unmonitor
If failed permission 755 then Unmonitor
If failed UID Root then Unmonitor
If failed GID root then Unmonitor
Alert Root@localhost
# MySQL
Check process mysqld with Pidfile/var/lib/mysql/localhost.localdomain.pid
Group database
Start program = "/sbin/service mysql start"
Stop program = "/sbin/service mysql stop"
If failed host 127.0.0.1 Port 8306 then restart
If 2 restarts within 6 cycles then timeout
# MongoDB
Check process Mongod with Pidfile/usr/local/mongodb/data/mongod.lock
Start program = "/usr/local/mongodb/bin/mongod–dbpath=/usr/local/mongodb/data/"
Stop program = "/usr/bin/killall Mongod"
If failed port 27017 protocol HTTP and request "/" with timeout seconds then
If restarts within cycles then timeout
#mongodb
Check process Mongod with Pidfile "/usr/local/mongodb/data/mongod.lock"
Start program = "/usr/local/mongodb/bin/mongod–dbpath=/usr/local/mongodb/data/"
Stop program = "/usr/bin/killall Mongod"
If failed port 27017 protocol HTTP and request "/" with timeout seconds then
If 5 restarts within 5 cycles then timeout
# tomcat
Check process Tomcat with Pidfile/var/run/tomcat/tomcat.pid
Start program = "/etc/init.d/tomcat start"
As UID SOLR GID
Stop program = "/etc/init.d/tomcat Stop"
As UID SOLR GID
If failed port 8080 then alert
If failed port 8080 for 5 cycles then restart
Set Mmonit Http://monit:monit@142.4.48.50:8080/collector
Set httpd port 12112 and
Use address 142.4.48.50//monit host IP
Allow localhost
IP of allow 142.4.48.50//mmonit host

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.