monit
環境 [#dbc97fa3]
CentoS6
httpd [#r0c93307]
# cd /etc/monit.d
# vim httpd.rc
---
check process httpd
with pidfile "/var/run/httpd/httpd.pid"
start program "/etc/init.d/httpd start"
stop program "/etc/init.d/httpd stop"
if failed
host サイトURL(もし名前解決できないテスト用のURLだった場合はhostsに記載しておく)
port 80
protocol http
then restart
if 5 restarts within 5 cycles then timeout
---
# monit -t
Control file syntax OK
# service monit restart
monit を停止中: [ OK ]
monit を起動中: [ OK ]
# monit status
The Monit daemon 5.14 uptime: 0m
Process 'httpd'
status Running
monitoring status Monitored
pid 16903
parent pid 1
uid 0
effective uid 0
gid 0
uptime 3m
children 8
memory 11.4 MB
memory total 66.1 MB
memory percent 0.3%
memory percent total 2.2%
cpu percent 0.0%
cpu percent total 0.0%
port response time 0.003s to [サイトURLがここに表示]:80 type TCP/IP protocol HTTP
data collected Wed, 16 Dec 2015 17:40:48
postfix [#le9f0edc]
# cd /etc/monit.d
# vim postfix.rc
---
check process postfix with pidfile /var/spool/postfix/pid/master.pid
group mail
start program = "/etc/init.d/postfix start"
stop program = "/etc/init.d/postfix stop"
if failed port 25 protocol smtp then restart
if 5 restarts within 5 cycles then timeout
---
# monit -t
Control file syntax OK
# service monit restart
monit を停止中: [ OK ]
monit を起動中: [ OK ]
# monit summary
Process 'postfix' Running