Install Perl and the modules that Mon requires
- DBI
- DBD::mysql
- Time::Period
- Time::HiRes
- Convert::BER
- Mon::Client
Time::Period / Time::HiRes / Convert::BER ¼³Ä¡
DBI , DBD ´Â yumÀ¸·Î ¼³Ä¡
[root@mojily ~]# yum install *DBD*
[root@mojily ~]# yum install *DBI*
µðºñ ÀÎÁõÀ» À§ÇÑ ¸ð´ÏÅ͸µ¿ë °èÁ¤ / Æнº¿öµå / Å×ÀÌºí »ý¼º
mysql> GRANT ALL PRIVILEGES ON test.* TO
'monitoring_user'@'%' IDENTIFIED BY 'password';
mysql> FLUSH PRIVILEGES;
mysql> CREATE DATABASE test
mysql> ues test;
mysql> CREATE TABLE example ( id INT, data VARCHAR(100));
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.xxx.115.xxx
watch node2
service mysql
interval 5s
monitor mysql.monitor
period wd {Sun-Sat}
alert echo.alert "node2 server is down!!"
upalert echo.alert "node2 server is live!!"
mysql.monitor ¾ÆÀ̵ð / Æнº¿öµå ÀÎÁõÀ» À§ÇÑ ÆÄÀϼöÁ¤
[root@mojily ~]# cd /usr/local/src/mon-1.2.0/mon.d
[root@mojily ~]# cp msql-monitor mysql.monitor
### mysql.monitor Áß°£ ÁÖ¼®ºÎºÐ¿¡ »ý¼ºÇØÁØ ¾ÆÀ̵ð / Æнº¿öµå / µðºñ ¼³Á¤ ###
$options{username} ||= "monitoring_user"; # ÁÖ¼®ÇØÁ¦
$options{password} ||= "password"; # ÁÖ¼®ÇØÁ¦
$options{database} ||= "test"; # ¸ð´ÏÅ͸µ µ¥ÀÌŸº£À̽º ¶óÀÎÃß°¡
ȤÀº... mon.cf ÆÄÀÏ¿¡ Á¢±Ù°èÁ¤À» ³Ö¾îÁÖ¸é µÈ´Ù.
Æнº¿öµå°¡ ´Ù¸¥ ¿©·¯´ëÀÇ µðºñ¼¹ö¸¦ ¸ð´ÏÅ͸µÇϱ⿡´Â mysql.monitor ÆÄÀÏÀ» ¼öÁ¤Çϱ⠺¸´Ù´Â mon.cf ÆÄÀÏ¿¡ Á¢±Ù°èÁ¤À» ³Ö¾îÁÖ¸é °ü¸®Çϱ⿡ ÆíÇÏ´Ù.
watch node2
service mysql
interval 5s
monitor mysql.monitor --mode=mysql --username=root --password=xxxxxx --database=mysql
period wd {Sun-Sat}
alert echo.alert "node2 server is down!!"
upalert echo.alert "node2 server is live!!"
¡Ø ¾ÆÀ̵ð. Æнº¿öµå¸¦ ¼öÁ¤ÇÏ¸é¼ º¸¸é ¹Ù·Î¹Ù·Î down À¸·Î üũµÇ¾úÀ½ÀÌ È®ÀεȴÙ.
·Î±×¸Þ¼¼Áö
Tue Mar 16 11:19:48 KST 2010-s mysql -g node2 -h 218.xxx.115.xxx -t 1268705988 node2 server is down!!
Tue Mar 16 11:19:53 KST 2010-s mysql -g node2 -h 218.xxx.115.xxx -t 1268705993 node2 server is down!!
Tue Mar 16 11:19:58 KST 2010-s mysql -g node2 -h 218.xxx.115.xxx -t 1268705998 -u node2 server is live!!
·ÎÄõðºñ¸¦ ¸ð´ÏÅ͸µÇÏ·Á¸é..... ·çÇÁ¹é ÁÖ¼Ò¸¦ ÀÌ¿ëÇϸéµÈ´Ù...
authtype = getpwnam
hostgroup node1 127.0.0.1
watch node1
service mysql
interval 5s
monitor mysql.monitor --mode=mysql --username=root --password=xxxxx --database=mysql
period wd {Sun-Sat}
alert echo.alert "localhost server is down!!"
upalert echo.alert "localhost server is live!!"
¡Ø hostgroup ¿¡ È£½ºÆ®¸í µÚ¿¡ °øÀξÆÀÌÇǸ¦ »ç¿ëÇÏ°Ô µÇ¸é...¸ð´ÏÅ͸µÀÌ ¾ÈµÈ´Ù...
ÀÌÀ¯´Â ¸ð¸£°ÚÀ½..!!