### System

check system $HOST
    if memory usage > 90% for 5 cycles then alert
    if swap usage > 25% for 5 cycles then alert
    if cpu usage > 90% for 5 cycles then alert
    if loadavg(5min) greater than 4 for 5 cycles then alert

### Nginx

check process nginx with pidfile /var/run/nginx.pid
	start program = "/etc/init.d/nginx start" with timeout 5 seconds
	stop program = "/etc/init.d/nginx stop" with timeout 5 seconds
	restart program = "/etc/init.d/nginx restart"
	if cpu > 70% for 5 cycles then restart
	if 3 restarts within 5 cycles then timeout

### Apache

check process httpd with pidfile /var/run/httpd/httpd.pid
	start program = "/etc/init.d/httpd start" with timeout 5 seconds
	stop program = "/etc/init.d/httpd stop" with timeout 5 seconds
	restart program = "/etc/init.d/httpd restart"
	if failed host 127.0.0.1 port 80 protocol http
		and request "/monit.html" with timeout 10 seconds then restart	
	if 3 restarts within 5 cycles then timeout

### PHP-FPM

check process php-fpm.www with pidfile /var/run/php-fpm/php-fpm.pid
	start program = "/etc/init.d/php-fpm start"
	stop program  = "/etc/init.d/php-fpm stop"
	restart program  = "/etc/init.d/php-fpm restart"
	if failed host localhost port 80 protocol http
		and request '/ping' with timeout 20 seconds for 5 cycles then restart
	if 3 restarts within 5 cycles then timeout
	depends on nginx

### MySQL

check process mysqld with pidfile /var/run/mysqld/mysqld.pid
	start program = "/etc/init.d/mysqld start"
	stop program = "/etc/init.d/mysqld stop"
	restart program = "/etc/init.d/mysqld restart"
	if failed host 127.0.0.1 port 3306 then restart
	if 3 restarts within 5 cycles then timeout

### Memcached

check process memcached with pidfile /var/run/memcached/memcached.pid
	start program = "/etc/init.d/memcached start"
	stop program = "/etc/init.d/memcached stop"
	restart program = "/etc/init.d/memcached restart"
	if failed host 127.0.0.1 port 11211 protocol MEMCACHE then restart
	if memory usage > 90% for 5 cycles then restart
	if 3 restarts within 5 cycles then timeout


### Node.js worker

check process node_worker1 matching /home/www/domain/public_html/app.js
	start program = "/bin/su - www -c 'pm2 start /home/www/domain/public_html/app.js'"
	stop program = "/bin/su - www -c 'pm2 start /home/www/domain/public_html/app.js'"
	if cpu > 90% for 3 cycles then restart
	if 3 restarts within 5 cycles then timeout