check process nginx with pidfile /dh/nginx/servers/httpd-xxxxxxx/var/logs/nginx.pid #Pid file for nginx in my case it located in /opt/nginx/logs/
start program = "/etc/init.d/nginx start" stop program = "/etc/init.d/nginx stop" if failed host direct.xxxxxx.com port 80 protocol HTTP then restart #set your server IP that runs nginx
if failed host direct.xxxxxx.com port 80 protocol HTTP then alert if 5 restarts with 5 cycles then alert #check file webserver_count_php with path /tmp/php # if match "\b[0-1][0-5]?|15\b" then alert # 0...15
# if match "\b[0-1][0-5]?|15\b" then exec "/usr/bin/killall -9 php53.cgi" # 0...15 check file webserver_response with path /tmp/web if match "502" then exec "/usr/bin/killall -9 php53.cgi"
# if match "502" then exec "/etc/init.d/nginx restart" if match "502" then alert depends on nginx
in /tmp/web is a output from bash script see what is the code returned in webserver(200, 404, 502 etc..)
i have 502 in the last line inside /tmp/web, why the ruleĀ if match "502" then exec "/usr/bin/killall -9 php53.cgi" is not work? if i killall php53.cgi the host is failed so need restart (if failed host direct.xxxxxx.com port 80 protocol)