monit

環境

CentoS6

httpd

# 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

# 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

トップ   編集 凍結 差分 履歴 添付 複製 名前変更 リロード   新規 一覧 検索 最終更新   ヘルプ   最終更新のRSS
Last-modified: 2022-06-30 (木) 01:40:11