インストールは、rpmforgeから行う。
yum install --enablerepo=rpmforge monit
/etc/monit.d/includes/ServerPortMonitor
## Server Port Monitor
## DBserver : 192.168.100.10
## APserver : 192.168.100.11
## WEBserver : 192.168.100.12
check host DBserver with address 192.168.100.10
if failed icmp type echo count 5 with timeout 15 seconds then alert
#if failed port 25 type tcp protocol smtp with timeout 15 seconds then alert
if failed port 22 protocol ssh with timeout 15 seconds then alert
if failed port 161 type udp with timeout 15 seconds then alert
#if failed port 199 type tcp with timeout 15 seconds then alert
check host APserver with address 192.168.100.11
if failed icmp type echo count 5 with timeout 15 seconds then alert
if failed port 80 protocol HTTP request / with timeout 15 seconds then alert
if failed port 81 protocol HTTP request / with timeout 15 seconds then alert
if failed port 21 protocol ftp with timeout 15 seconds then alert
if failed port 22 protocol ssh with timeout 15 seconds then alert
if failed port 161 type udp with timeout 15 seconds then alert
#if failed port 199 type tcp with timeout 15 seconds then alert
check host WEBserver with address 192.168.100.12
if failed icmp type echo count 5 with timeout 15 seconds then alert
if failed port 80 protocol HTTP request / with timeout 15 seconds then alert
if failed port 25 type tcp protocol smtp with timeout 15 seconds then alert
if failed port 587 type tcp protocol smtp with timeout 15 seconds then alert
if failed port 110 type tcp protocol pop with timeout 15 seconds then alert
if failed port 21 protocol ftp with timeout 15 seconds then alert
if failed port 22 protocol ssh with timeout 15 seconds then alert
if failed port 161 type udp with timeout 15 seconds then alert
#if failed port 199 type tcp with timeout 15 seconds then alert
/etc/inittabの最終行に下記を追記する。
# Run monit in standard runlevels
mo:2345:respawn:/usr/bin/monit -Ic /etc/monit.d/monitrc
inittabをすぐさま有効にするため下記コマンドを実行する。
tail /var/log/messagesにinitが再読み込みされた旨メッセージが出ていることを確認する。
init q
コメント