check process nginx with pidfile /run/nginx.pid
start program = "/usr/bin/sudo service nginx start" with timeout 30 seconds
restart program = "/usr/bin/sudo service nginx restart"
if failed port 80 type tcp then alert
if failed port 80 type tcp then restart
或者
# 匹配进程名
check process mongo MATCHING mongo
# 配置服务启动和重启命令
start program = "/usr/bin/sudo service mongod start"
restart program = "/usr/bin/sudo service mongod restart"
# 如果端口27017无法访问则认为服务失败,发报警邮件并重启服务
if failed port 27017 type tcp then alert
if failed port 27017 type tcp then restart
# 如果在三个周期内重启了3次,则不再监控
# if 3 restarts within 3 cycles then unmonitor