¿ù°£ Àα⠰Խù°

°Ô½Ã¹° 138°Ç
   
[MON] mysql.monitor
±Û¾´ÀÌ : ÃÖ°í°ü¸®ÀÚ ³¯Â¥ : 2010-03-16 (È­) 11:38 Á¶È¸ : 12527
±ÛÁÖ¼Ò :
                          

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 ¼³Ä¡

[root@mojily src]# wget http://search.cpan.org/CPAN/authors/id/P/PR/PRYAN/Period-1.20.tar.gz
[root@mojily src]# wget http://search.cpan.org/CPAN/authors/id/J/JH/JHI/Time-HiRes-1.9719.tar.gz
[root@mojily src]# wge http://www.cpan.org/modules/by-module/Convert/Convert-BER-1.3101.tar.gz

[root@mojily src]# tar xvf Time-HiRes-1.9719.tar.gz
[root@mojily src]# cd Time-HiRes-1.9719
[root@mojily Time-HiRes-1.9719]# perl Makefile.PL
[root@mojily Time-HiRes-1.9719]# make; make install


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 ¿¡ È£½ºÆ®¸í µÚ¿¡ °øÀξÆÀÌÇǸ¦ »ç¿ëÇÏ°Ô µÇ¸é...¸ð´ÏÅ͸µÀÌ ¾ÈµÈ´Ù...
ÀÌÀ¯´Â ¸ð¸£°ÚÀ½..!!

À̸§ Æнº¿öµå
ºñ¹Ð±Û (üũÇÏ¸é ±Û¾´À̸¸ ³»¿ëÀ» È®ÀÎÇÒ ¼ö ÀÖ½À´Ï´Ù.)
¿ÞÂÊÀÇ ±ÛÀÚ¸¦ ÀÔ·ÂÇϼ¼¿ä.
   

 



 
»çÀÌÆ®¸í : ¸ðÁö¸®³× | ´ëÇ¥ : ÀÌ°æÇö | °³ÀÎÄ¿¹Â´ÏƼ : ·©Å°´åÄÄ ¿î¿µÃ¼Á¦(OS) | °æ±âµµ ¼º³²½Ã ºÐ´ç±¸ | ÀüÀÚ¿ìÆí : mojily°ñ¹ðÀÌchonnom.com Copyright ¨Ï www.chonnom.com www.kyunghyun.net www.mojily.net. All rights reserved.