Monit ã§ãæ軽ã«å¤é¨ã®ãµã¼ããç£è¦ãã
Monit ã¯ãµã¼ãå ã®ããã»ã¹ããªã½ã¼ã¹ã®ä½¿ç¨çãªã©ãç£è¦ããçºã«ä½¿ãããäºãæ¯è¼çå¤ãããã§ãããå®ã¯å¤é¨ã® Web ãµã¼ãã«å¯¾ãã URL ç£è¦ã Ping ç£è¦ãªã©ãã¨ã¦ãç°¡åã«è¨å®ã§ããããé常ã«ä¾¿å©ã§ãã
ã¨ããããã§ãMonit ã使ç¨ãã¦å¤é¨ã®ãµã¼ãã®ç£è¦ãè¡ãæ¹æ³ã«ã¤ãã¦ç°¡åã«ã¾ã¨ãã¦ã¿ã¾ããã
ã¤ã³ã¹ãã¼ã«
ã¾ã㯠Monit ãã¤ã³ã¹ãã¼ã«ãã¾ãã
ããããã¨æ¹æ³ã¯ããã¾ãããCentOS 6 ã§ã¯ EPEL 㧠RPM ãæä¾ããã¦ããã®ã§ã以ä¸ãå®è¡ããã ãã§ã¤ã³ã¹ãã¼ã«ã§ãã¾ãã
# yum install -y http://ftp.riken.jp/Linux/fedora/epel/6/x86_64/monit-5.1.1-4.el6.x86_64.rpm
EPEL ã® RPM ãå
¥ããå ´åãè¨å®ãã¡ã¤ã«ã¯ã/etc/monit.confãã«ãªãã¾ãã
ç£è¦è¨å®ã¯ã/etc/monit.confããç´æ¥ç·¨éããããããã㯠ã/etc/monit.d/ã 以ä¸ã«ãã¡ã¤ã«ãä½æãã¦ããã«è¨è¿°ãã¾ãã
ä»åã®è¨å®ä¾ã§ã¯ã¨ã©ã¼æ¤ç¥æã«ã¢ã©ã¼ãã¡ã¼ã«ãéä¿¡ãã¦ããã®ã§ã以ä¸ã®ãããªè¡ã追è¨ãã¦ããã¾ãã
set alert [email protected]
URL ç£è¦
URL ç£è¦ãè¡ãå ´åã®è¨å®ã¯ä»¥ä¸ã®ããã«ãªãã¾ãã
check host example-web with address 192.0.2.0 if failed url http://192.0.2.0/urlcheck.txt then alert
ãã®å ´åããhttp://192.0.2.0/urlcheck.txtãã«ã¢ã¯ã»ã¹ã§ããªãå ´åãã¢ã©ã¼ãã¡ã¼ã«ãéä¿¡ããã¾ãã
ã¬ã¹ãã³ã¹ã«ç¹å®ã®æååãå«ã¾ãã¦ãããã©ããããã§ãã¯ããã«ã¯ã以ä¸ã®ããã«ãã¾ãã
check host example-web with address 192.0.2.0 if failed (url http://192.0.2.0/urlcheck.txt and content == 'OnService') then alert
ãã®å ´åããhttp://192.0.2.0/urlcheck.txtãã®ã¬ã¹ãã³ã¹å 容ã«æååãOnServiceããå«ã¾ãã¦ããªãã£ããã¢ã©ã¼ãã¡ã¼ã«ãéä¿¡ããã¾ãã
ããç£è¦å¯¾è±¡ãã¼ã¸ã« BASIC èªè¨¼ãããã£ã¦ããå ´åã¯ã以ä¸ã®ããã«ãµã¼ãã¢ãã¬ã¹ã®åã« BASIC èªè¨¼ã®ã¦ã¼ã¶åã¨ãã¹ã¯ã¼ããæå®ãã¾ãã
check host example-web with address 192.0.2.0 if failed (url http://exampleuser:[email protected]/auth/urlcheck.txt and content == 'OnService') then alert
Ping ç£è¦
Ping ç£è¦ãå®è¡ããã«ã¯ã以ä¸ã®ãããªè¨å®ãè¨è¿°ãã¾ãã
check host example-web with address 192.0.2.0 if failed icmp type echo with timeout 4 seconds then alert
Ping ç£è¦ã®å ´åãraw socket ãæ±ãããã monit ã root ã¦ã¼ã¶ã§å®è¡ãã¦ããå¿ è¦ãããã¾ãã
ãã¼ãç£è¦
ãã®ä»ããã¼ãçªå·ãæå®ãã¦ç£è¦ãããã¨ãã§ãã¾ãã
以ä¸ã¯ http(80) 㨠https(443) ãç£è¦ããä¾ã§ãã
check host example-web with address 192.0.2.0 if failed port 80 proto http then alert if failed port 443 type TCPSSL proto http then alert
DNS(53) ãç£è¦ããã«ã¯ä»¥ä¸ã®ããã«è¨å®ãã¾ãã
check host example-dns with address 192.0.2.1 if failed port 53 type udp proto dns then alert
マニュアルによればãç¾æç¹ã§ä»¥ä¸ã®ãããã³ã«ã«å¯¾å¿ãã¦ããããã§ãã
- APACHE-STATUS
- DNS
- DWP
- FTP
- GPS
- HTTP
- IMAP
- CLAMAV
- LDAP2
- LDAP3
- LMTP
- MEMCACHE
- MYSQL
- NNTP
- NTP3
- POP
- POSTFIX-POLICY
- RADIUS
- RDATE
- RSYNC
- SIP
- SMTP
- SSH
- TNS
- PGSQL
- HTTPS
- FTPS
- POPS
- IMAPS
ãããã®è¨å®ã¯è¤æ°å®ç¾©å¯è½ãªã®ã§ãä¸å°ã®ãµã¼ããç£è¦ãµã¼ãã¨ãã¦ããæ軽ã«è¤æ°ã®ãµã¼ãç£è¦ãè¡ãäºãã§ãã¾ãã
å°å
¥ã»è¨å®å
±ã«é常ã«ç°¡åã§æ°è»½ã«å§ããããã®ã§ããµã¼ãã¹ã®ãªãªã¼ã¹ç´å¾ãªã©ããã¨ããããç£è¦ãã¦ãããããã¨ãã£ãç¶æ³ã§ã¯ç¹ã«ä¾¿å©ãªããããªãã§ããããã
åè
CONNECTION TESTING
http://mmonit.com/monit/documentation/monit.html#connection_testing
Connection testing using the URL notation
http://mmonit.com/monit/documentation/monit.html#connection_testing_using_the_url_notation
Remote host ping test
http://mmonit.com/monit/documentation/monit.html#remote_host_ping_test