MON Àº À̺¥Æ®¸¦ ÀÌ¿ëÇؼ ¼ºñ½º¿¡ ´ëÇÑ »ç¿ëÀ» ¸ð´ÏÅ͸µÇÏ´Â ¸ðµâÀÌ´Ù. ÀÚ±âÀڽŻӸ¸ ¾Æ´Ï¶ó »ó´ë¹æ¿¡ ´ëÇØ ping ÇÁ·Î±×·¥À» ÀÌ¿ëÇؼ ¸ð´ÏÅ͸µÇϴ°Ͱú °°Àº °£´ÜÇÑ °æ¿ì¿¡¼ºÎÅÍ DBºÎÅÍ °¢Á¾ ¼ºñ½º±îÁö °¡´ÉÇÑ ¸ð´ÏÅ͸µ ¸ðµâ·Î½á ÀÌÈÄ ÀÛ¾÷À» ÁøÇàÇÏ°Ô²û ÇØÁÖ´Â ¸ð´ÏÅ͸µÅøÀÔ´Ï´Ù.
Heartbeart ³ª DRBD, ipvsadm °ú °°ÀÌ »ç¿ëÇÏ½Ã¸é ¹«Áߴܼºñ½º ±¸¼º¿¡ À¯¿ëÇÕ´Ï´Ù.
Á»´õ ÀÚ¼¼ÇÑ INSTALL ¹æ¹ýÀº MON ¼Ò½º ¾ÐÃàÀ» Ç®¾îº¸½Ã¸é INSTALL ÆÄÀÏÀ» ÂüÁ¶Çϼ¼¿ä.
OVERVIEW
--------
There are several components you'll need to get working to
have a fully functional mon installation.
1. mon, the server
2. Mon::Client, the Perl library used by some clients
3. C programs in mon.d
4. Optional (but highly useful) monitors
5. A customized mon.cf to make the server do what you want
# ´Ù¿î·Îµå 2010. 02.04 ÀÏ ÇöÀç....1.2.0 ÀÌ ÃÖ½ÅÀ̳׿ä...
ftp://ftp.kernel.org/pub/software/admin/mon/mon-1.2.0.tar.gz¼³Ä¡Çϱâ À§Çؼ´Â perl ¸ðµâÀÌ ÇÊ¿äÇϸç 5.005_01 À̻󿡼 ÀÛµ¿ÀÌ µÈ´Ù.
perl ¸ðµâÀ» ¼³Ä¡Çϱâ ÀÌÀü¿¡ C Çì´õ ÆÄÀÏ¿¡ ´ëÀÀÇÏ´Â perl Çì´õÆÄÀÏÀ» ¸¸µé¾î¾ß µÈ´Ù.
[root@node1 mon]# cd /usr/include
[root@node1 mon]# h2ph -r -l .
À§ ¸í·É¾î¸¦ ½ÇÇà½ÃÅ°¸é xxx.h -> xxx.ph µîÀÇ ¸Þ¼¼Áö¿Í ÇÔ²² º¯È¯ÀÌ µÈ´Ù.
´ÙÀ½ ÇÊ¿ä·Î ÇÏ´Â perl ¸ðµâÀ» ¼³Ä¡ÇÑ´Ù.
Time::Period PRYAN/Period-1.20.tar.gz
Time::HiRes J/JH/JHI/Time-HiRes-1.59.tar.gz
ÆÄÀÏÀº wget À» ÅëÇؼ ´Ù¿î·Îµå ÇÏ½Ã¸é µË´Ï´Ù.
ÀÌÁ¦´Â mon ¼Ò½º¸¦ ´Ù¿î·Îµå Çϼż ¼³Ä¡ÇÑ´Ù.
¡Ø ¾ÐÃàÀ» Ç®¾îº¸¸é µð·ºÅ丮 ±¸Á¶´Â ¾Æ·¡¿Í °°½À´Ï´Ù.
mon ---- alert.d : °¢Á¾ alert µ¥¸óÀÌ µé¾îÀÖ´Â µð·ºÅ丮
clients : mon Ŭ¶óÀ̾ðÆ® µ¥¸óÀÌ ÀÖ´Â µð·ºÅ丮
doc : ¸Þ´º¾óÀÌ µé¾îÀÖ´Â µð·ºÅ丮
etc : ¼³Á¤ÈÀÏÀÌ µé¾îÀÖ´Â µð·ºÅ丮
mon.d : ¸ð´ÏÅ͸µ ÇÁ·Î±×·¥ÀÌ µé¾îÀÖ´Â µð·ºÅ丮
muxpect : ¸ÖƼÇ÷º½º TCP¶ó´Â ±â´ÉÀ» À§ÇØ °³¹ßµÇ¾îÁö°í ÀÖ´Â ÇÁ·Î±×·¥
state.d : pid °¡ µé¾î°¥ ÀÚ¸®
utils : mon ¿ë À¯Æ¿¸®Æ¼°¡ µé¾îÀÖ´Â ÀÚ¸®
¸ð´ÏÅ͸µ µ¥¸ó (mon/mon.d Æú´õ³» Á¸Àç)
freespace.monitor : µð½ºÅ©ÀÇ ¿ë·®À» ÆľÇÇÏ´Â ¸ð´ÏÅ͸µ µ¥¸ó/ Filesys::DiskSpace ÇÊ¿ä
fping.monitor : »ó´ëÀÇ ¼¹ö°¡ ping ¿¡ ÀÀ´äÇÏ´ÂÁö È®ÀÎÇÏ´Â Åø
telnet.monitor : ÅÚ³ÝÁ¢¼Ó»óŸ¦ È®ÀÎÇÏ´Â ¸ð´ÏÅ͸µ µ¥¸ó / Net::Telnet ¸ðµâ
reboot.monitor
asyncreboot.monitor
netappfree.monitor
process.monitor
hpnp.monitor
ldap.monitor : Net:LDAPapi ¸ðµâÀ» ÇÊ¿ä
dialin.monitor : ÀüÈ °É¾îº¸´Â °Ç°¡..? Perl Expect ¸ðµâÀÌ ÇÊ¿äÇϴٳ׿ä...¸ðÁö ÀÌ°Ç..
dns.monitor : dns ¸¦ °Ë»çÇÏ´Â ¸ð´ÏÅ͸µ µ¥¸ó / ¸ðµâÀº Net:DNS ¸¦ ÇÊ¿ä
msql-mysql.monitor : msql À̳ª mysql ¼ºñ½º ¸ð´ÏÅ͸µ / MSQL, MySQL DBD ¸ðµâ°ú DBI ¸ðµâÀÌ ÇÊ¿ä
±âº»ÆÄÀÏÀ» /etc/mon/ µð·ºÅ丮·Î º¹»çÇÑ´Ù.
[root@node1 mon-1.2.0]# mkdir /etc/mon
[root@node1 mon-1.2.0]# cp etc/example.cf /etc/mon/mon.cf
[root@node1 mon-1.2.0]# cp etc/auth.cf /etc/mon/auth.cf
/etc/service ÆÄÀÏ¿¡ ÇØ´ç ¼ºñ½º Æ÷Æ®¸¦ µî·ÏÇÑ´Ù.
mon 2583/tcp #MON
mon 2583/udp #MON traps
¼³Ä¡´Â ÀÌ·Î½á ³¡ÀÌ´Ù...ÀÌÁ¦´Â ¼³Á¤À» Àâ¾ÆÁÖ±â À§ÇÑ cf ÆÄÀÏ ¼öÁ¤¸¸ ÇØÁÖ¸é µÈ´Ù.
- example.cf ÆÄÀÏÀ» ÂüÁ¶Çؼ »ý¼ºÇÏ¸é µÈ´Ù.
- /etc/mon.cf (Å×½ºÆ®¿ëµµ¶ó¸é ¾Æ·¡Ã³·³ ¸¸µé¾î¼ È®ÀÎÇغ¸¸é µÈ´Ù.)
cfbasedir = /etc/mon
alertdir = /usr/local/src/mon-1.2.0/alert.d
mondir = /usr/local/src/mon-1.2.0/mon.d
maxprocs = 20
histlength = 100
randstart = 30s
authtype = getpwnam
hostgroup node2 218.236.115.226 # ¸ð´ÏÅ͸µ ´ë»ó¼¹ö
watch node2
service http # ¸ð´ÏÅ͸µ ¼ºñ½º
interval 5s # ¸ð´ÏÅ͸µ °£°Ý
monitor http.monitor # ÂüÁ¶ÆÄÀÏ
period wd {Sun-Sat} # ¸ð´ÏÅ͸µ ±â°£ (¿äÀÏ/½Ã°£)
alert echo.alert "node2 server is down!!" # ½ÇÇàÆÄÀÏ ¹× ¸Þ¼¼Áö
upalert echo.alert "node2 server is live!!"
- °£´ÜÈ÷ ·Î±×¸¦ ³²°Ü¼ ¼ºñ½º ¸ð´ÏÅ͸µ ¿©ºÎ¸¦ ÆÇ´ÜÇϱâ À§ÇÑ echo ÆÄÀÏÀ» Çϳª ¸¸µé¾îÁØ´Ù.
ÀÛµ¿ÇÏ´Â ½Ã°£À» /var/log/echo.alert.log ¶ó´Â ÆÄÀÏ¿¡ ·Î±ë!
- ´Ù¸¥ ÆÄÀÏ°ú Æ۹̼ÇÀ» µ¿ÀÏÇÏ°Ô 755
[root@node1 alert.d]# pwd
/usr/local/src/mon-1.2.0/alert.d
[root@node1 alert.d]# cat echo.alert
#!/bin/sh
echo "`date`$*" >> /var/log/echo.alert.log;
[root@node1 alert.d]# chmod 755 echo.alert.log
==> À̺κп¡ ¼ºñ½º down/up ½Ã ÀÛ¾÷ÇØ¾ßµÉ ½ºÅ©¸³Æ®¸¦ ¸¸µé¾î µÎ¸é....¹«Áß´Ü ¼ºñ½º ±¸¼ºÀ» ÇÒ¼ö ÀÖ´Ù.
¼ºñ½º½ÇÇà
[root@node1 root]# /usr/local/src/mon-1.2.0/mon -f -c /etc/mon/mon.cf
ÇÁ·Î¼¼¼¸¦ ½ÇÇàµÇ¾îÁø »óÅ (ps -aux)
root 3957 0.0 1.0 50812 8764 ? S Feb04 0:05 /usr/bin/perl /usr/local/src/mon-1.2.0/mon -f -c /etc/mon/mon.cf
¡Ø -c config config file, defaults to "mon.cf"
-f fork and become a daemon
- node2 (218.236.115.226) ¾ÆÆÄÄ¡ µ¥¸óÀ» stop / start ½ÃÅ°¸é¼ ·Î±ëÀ» È®ÀÎÇغ»´Ù.
/var/log/echo.alert.log
Thu Feb 4 17:04:06 KST 2010-s http -g node2 -h 218.236.115.226 -t 1265270646 node2 server is down!!
Thu Feb 4 17:04:11 KST 2010-s http -g node2 -h 218.236.115.226 -t 1265270651 node2 server is down!!
Thu Feb 4 17:04:16 KST 2010-s http -g node2 -h 218.236.115.226 -t 1265270656 -u node2 server is live!!
Thu Feb 4 17:07:28 KST 2010-s http -g node2 -h 218.236.115.226 -t 1265270848 node2 server is down!!
Thu Feb 4 17:07:34 KST 2010-s http -g node2 -h 218.236.115.226 -t 1265270854 node2 server is down!!
Thu Feb 4 17:07:39 KST 2010-s http -g node2 -h 218.236.115.226 -t 1265270859 node2 server is down!!
Thu Feb 4 17:07:44 KST 2010-s http -g node2 -h 218.236.115.226 -t 1265270864 node2 server is down!!
Thu Feb 4 17:07:49 KST 2010-s http -g node2 -h 218.236.115.226 -t 1265270869 -u node2 server is live!!
Thu Feb 4 17:33:09 KST 2010-s http -g node1 -h 218.236.115.225 -t 1265272389 node1 server is down!!
Thu Feb 4 17:33:15 KST 2010-s http -g node1 -h 218.236.115.225 -t 1265272395 node1 server is down!!
Thu Feb 4 17:33:20 KST 2010-s http -g node1 -h 218.236.115.225 -t 1265272400 node1 server is down!!
Thu Feb 4 17:33:25 KST 2010-s http -g node1 -h 218.236.115.225 -t 1265272405 node1 server is down!!
¸¶Áö¸·À¸·Î mon µ¥¸óÀ» ¿Ã¸®°í ³»¸®±â ½±°Ô ½ºÅ©¸³Æ®·Î ¸¸µé¾îµÖ¼ »ç¿ëÇÑ´Ù.
- /etc/init.d/mon (Æ۹̼ÇÀº 755)
#!/bin/bash
MON_HOME=/usr/local/src/mon-1.2.0 # º»ÀÎÀÌ ¼³Ä¡ÇÑ Æú´õÀ§Ä¡
MON_CF=/etc/mon # mon.cf ¼³Á¤ÆÄÀÏÀÌ µé¾î°¥ À§Ä¡
case "$1" in
start)
if [ -f $MON_HOME/mon.pid ]; then
echo "mon already started"
exit
fi
echo "Starting Mon"
$MON_HOME/mon -c $MON_CF/mon.cf -L $MON_HOME -P $MON_HOME/mon.pid &
;;
stop)
if [ -f $MON_HOME/mon.pid ]; then
echo "Stopping Mon"
kill -9 `cat $MON_HOME/mon.pid`
rm -f $MON_HOME/mon.pid
else
echo "no server pid, server doesn't seem to run"
fi
;;
status)
echo "doing good"
;;
*)
echo "Usage: $0 {start|stop|status|reload|restart}"
exit 1
esac
exit 0