|
커피향이 나는 *NIX
커피닉스
시스템/네트웍/보안을 다루는 곳
|
|
|
|
| 이전 주제 보기 :: 다음 주제 보기 |
| 글쓴이 |
메시지 |
jjun_ 손님
|
올려짐: 2010.3.10 수, 5:14 pm 주제: 시스템 모니터링 Munin |
|
|
회사 시스템에 적용하면서 정리해둔 문서입니다.
홈페이지 : http://munin.projects.linpro.no/
장점 : 무료, 간편한 설정, 깔끔한 그래프, 다양한 플러그인
단점 : 기간 검색 안됨, 그래프 크기 조절 안됨
설치참조 : http://thuannvn.blogspot.com/2009/06/howto-install-munin-on-centos.html
munin 데모 : http://h1550830.stratoserver.net/munin/stratoserver.net/index.html
*** CentOS 5.3 i386 기준으로 작성하고 테스트하였음
1. 패키지 설치 준비
rpm -Uvh http://download.fedora.redhat.com/pub/epel/5/i386/epel-release-5-3.noarch.rpm
wget http://packages.sw.be/rpmforge-release/rpmforge-release-0.3.6-1.el5.rf.i386.rpm
rpm -Uvh rpmforge-release-0.3.6-1.el5.rf.i386.rpm
2. 서버 설치
패키지 설치
yum -y install httpd
yum -y install munin
yum -y install munin-node
서버쪽 설정
vi /etc/munin/munin.conf
[localhost-server] // munin 서버에서 사용될 이름을 지정한다.
address 127.0.0.1
use_node_name yes
노드(클라이언트) 설정 // munin 서버 자체를 모니터링 하기 위해서
vi /etc/munin/munin-node.conf
host_name localhost-server // munin 서버에서 사용될 이름을 지정한다.
munin 시작
/etc/rc.d/init.d/munin-node start
chkconfig munin-node on
잘 전송되는지 tail -f /var/log/munin/munin-node.log 해서 로그를 확인한다.
2009/10/14-17:35:01 CONNECT TCP Peer: "127.0.0.1:37109" Local: "127.0.0.1:4949"
2009/10/14-17:40:01 CONNECT TCP Peer: "127.0.0.1:57802" Local: "127.0.0.1:4949"
이렇게 나온다면 정상.
시간이 조금 지난 후에(데이타가 저장되면) http://localhost/munin 에서 확인
3. 노드(클라이언트) 추가
패키지 설치
yum install munin-node
노드 설정
vi /etc/munin/munin-node.conf
host_name localhost2 // munin 서버에서 사용될 이름을 지정한다.
allow ^192\.168\.0\.4$ // munin 서버를 지정한다.
munin-node 시작
/etc/rc.d/init.d/munin-node start
chkconfig munin-node on
마지막으로 서버 /etc/munin/munin.conf 에서 노드를 추가해준다.
[localhost-server]
address 127.0.0.1
use_node_name yes
// 아래와 같이 /etc/munin/munin-node.conf 수정할때 입력한 host_name과 맞추어서 추가하면 된다.
[localhost2]
address 192.168.0.5
use_node_name yes
잘 전송되는지 tail -f /var/log/munin/munin-node.log 해서 로그를 확인한다.
2009/10/14-17:35:01 CONNECT TCP Peer: "192.168.0.4:33896" Local: "192.168.0.5:4949"
2009/10/14-17:40:01 CONNECT TCP Peer: "192.168.0.4:34895" Local: "192.168.0.5:4949"
이렇게 나온다면 정상.
업데이트가 잘 되는 지 tail -f /var/log/munin/munin-update.log 해서 로그를 확인한다.
Oct 14 18:35:06 [4955] - Fetched service: localhost-server -> memory (0.08 sec)
Oct 14 18:35:07 [4955] - Fetched service: localhost-server -> vmstat (1.06 sec)
Oct 14 18:35:07 [4955] - Fetched node: localhost-server (4.71 sec)
Oct 14 18:35:01 [4954] - Processed node: localhost2 (0.01 sec)
Oct 14 18:35:01 [4954] - Processed domain: localhost2 (0.01 sec)
Oct 14 18:35:07 [4954] - connection from localhost2 -> localhost2 (4957)
Oct 14 18:35:07 [4954] - connection from localhost2 -> localhost2 (4957) closed
Oct 14 18:35:07 [4954] - connection from localhost-server -> localhost-server (4955)
Oct 14 18:35:07 [4954] - connection from localhost-server -> localhost-server (4955) closed
Oct 14 18:35:07 [4954] - Munin-update finished (6.43 sec)
이렇게 나온다면 정상.
만약 같은 도메인으로 분류할려면 서버의 /etc/munin/munin.conf에서 다음과 같이 추가한다.
[testdomain;localhost-server]
address 192.168.0.4
use_node_name yes
[testdomain;localhost2]
address 192.168.0.5
use_node_name yes
4. 플러그인 사용
4.1. 아파치 모니터링
아파치 웹서버를 모니터링 할려면
ln -s /usr/share/munin/plugins/apache_* /etc/munin/plugins/
해서 플러그인을 쓸수 있도록 하고,
아파치 설정에서도 server-status 를 사용할 수 있도록 수정한다.
ExtendedStatus On
<Location /server-status>
SetHandler server-status
Order deny,allow
Deny from all
Allow from 127.0.0.1
</Location>
마지막으로 service munin-node restart 를 하여 적용시킨다. 시간이 지나면 모니터링화면에서 갱신되어 볼 수 있다.
4.2. MySQL 모니터링(테스트 진행중)
ln -s /usr/share/munin/plugins/mysql_* /etc/munin/plugins/
If your root user has a password (or want to use a different user),
edit the plugin configuration file in /etc/munin/plugin-conf.d/munin-node and
uncomment line 16 by removing the leading hash (#).
Then change the parameters that will be used when mysqladmin is run.
그외 플러그인 다운로드
http://muninexchange.projects.linpro.no
설치방법은 위에서도 알겠지만 /etc/munin/plugins/ 에 해당 플러그인을 복사하거나 링크를 걸어주면 된다.
자세한 것들은 각 플러그인의 README 문서등을 확인하자.
5. munin 모니터링 페이지 보안
서버에서 httpd.conf 에 다음 내용 추가
<Directory "/var/www/html/munin">
Options -Indexes FollowSymLinks
AllowOverride All
Allow from all
</Directory>
/var/www/html/munin/.htaccess 파일 작성
AuthType Basic
AuthName "Members Only"
AuthUserFile /var/www/html/munin/.mypasswd
<limit GET PUT POST>
require valid-user
</limit>
/var/www/html/munin/.mypasswd 파일 작성
[root@localhost munin]# htpasswd -c /var/www/html/munin/.mypasswd admin
New password:
Re-type new password:
Adding password for user admin
[root@localhost munin]# cat .mypasswd
admin:WOQyFQnaXXA4E
6. 오류 수정
설정에 이상이 없는데도 그래프가 그려지지 않으면(정확히는 png 파일이 생성이 안되면), 완전히 삭제하고 재설치해본다.
yum remove munin munin-node
rm -rf /etc/munin/
rm -rf /var/log/munin/
rm -rf /var/www/html/munin/
rm -rf /var/run/munin/
방화벽에 막혀서 그럴수 도 있으나 tcpdump나 telnet 호스트명 4949 로 열려있는지 확인
서버에서 :
tcpdump host 노드IP
15:45:06.026183 IP 192.168.0.4.56021 > 192.168.0.5.munin: . ack 18168 win 501 <nop,nop,timestamp 856234716 2614717493>
15:45:06.026283 IP 192.168.0.5.munin > 192.168.0.4.56021: P 18168:18536(368) ack 850 win 46 <nop,nop,timestamp 2614717533 856234716>
15:45:06.026299 IP 192.168.0.4.56021 > 192.168.0.5.munin: . ack 18536 win 501 <nop,nop,timestamp 856234716 2614717533>
15:45:06.028062 IP 192.168.0.4.56021 > 192.168.0.5.munin: F 850:850(0) ack 18536 win 501 <nop,nop,timestamp 856234718 2614717533>
15:45:06.028300 IP 192.168.0.5.munin > 192.168.0.4.56021: F 18536:18536(0) ack 851 win 46 <nop,nop,timestamp 2614717535 856234718>
15:45:06.028316 IP 192.168.0.4.56021 > 192.168.0.5.munin: . ack 18537 win 501 <nop,nop,timestamp 856234718 2614717535>
이렇게 통신을 주고 받으면 정상.
[root@ns2 ~]# telnet 192.168.0.6 4949
Trying 192.168.0.6...
Connected to 192.168.0.6 (192.168.0.6).
Escape character is '^]'.
# munin node at localhost2
이렇게 나오면 정상.
로그에 아래와 같이 찍힌다면 (확인중)
Use of uninitialized value in eval {block} exit at /usr/sbin/munin-node line 385, <CHILD> line 17.
http://osdir.com/ml/db.rddtool.munin.general/2008-02/msg00059.html
을 보면 FQDN으로 hostname을 입력하라고 나온다. 다음 것도 보자. 제대로된 hostname을 지정하면 된단다.
http://charles.lescampeurs.org/2009/03/11/munin-and-use-of-uninitializer-value-in-eval
좀더 발전적인 참고 자료
http://waste.mandragor.org/munin_tutorial/munin.html
http://wiki.kartbuilding.net/index.php/Munin_Statistics
http://www.arnebrodowski.de/blog/improving-munin-snmp-performance.html |
|
| 위로 |
|
 |
t5mk2t 손님
|
올려짐: 2010.4.09 금, 3:06 pm 주제: 오.. 좋은정보 감사합니다 ^^ |
|
|
저도 한번 적용해봐야겠네요~
감사합니다 ^^ |
|
| 위로 |
|
 |
jjun
가입: 2009년 12월 10일 올린 글: 8
|
올려짐: 2010.4.14 수, 10:22 am 주제: Munin에서 MySQL 모니터링 |
|
|
어제 회사서버 설정하다가 확인이 되어서 추가합니다.
4.2. MySQL 모니터링
ln -s /usr/share/munin/plugins/mysql_* /etc/munin/plugins/
mysqladmin 접속을 위해서 로그인 정보를 추가해주어야 한다.
관련 에러는 /var/log/munin/munin-node.log 에 기록된다.
| 코드: | | mysqladmin: connect to server at 'localhost' failed |
해당 설정은 /etc/munin/plugin-conf.d/munin-node 에서 하면 되고 내용은 다음과 같다.
| 코드: | [mysql*]
user root
env.mysqladmin /usr/bin/mysqladmin
env.mysqlopts --defaults-extra-file=/root/.my.cnf |
-> user 지정을 mysql 실행 유저인 mysql 로 해도 되는지는 확인하지 않음
.my.conf의 내용은 다음과 같다.
| 코드: | [client]
user=계정
password=암호
socket=/var/lib/mysql/mysql.sock |
참고자료 : http://forums.cpanel.net/f42/munin-not-show-mysql-graphs-62093.html |
|
| 위로 |
|
 |
bugfree 손님
|
올려짐: 2010.4.20 화, 11:01 pm 주제: Munin에서 MySQL 모니터링 (추가) |
|
|
저도 몇개 추가 해 봅니다.
1. mysql 접근에 패스워드가 걸려 있는 경우
/etc/munin/plugins.conf 에 아래를 추가 한다.
| 코드: |
[mysql*]
env.mysqlopts -u유저명 -p패스워드
env.mysqladmin mysqladmin경로
|
2. munin 서버에서 munin-node 값을 가져오지 못할때
telnet 을 통해서 값을 가져오는지 먼저 확인해본다
[root@dosirak plugins]# telnet 218.xxx.xxx.21 4949
Trying 218.xxx.xxx.21...
Connected to 218.xxx.xxx.21 (218.xxx.xxx.21).
Escape character is '^]'.
# munin node at 218.xxx.xxx.21
위 상태에서 list, nodes, config, fetch, version or quit 를 사용 할 수 있다.
list
irqstats mysql_slowqueries apache_accesses if_eth0 df mysql_threads uptime swap load cpu mysql_queries iostat memory vmstat apache_processes apache_activity processes apache_volume interrupts netstat mysql_bytes port_www mysql_cachememory hddtemp_smartctl
실제로 값을 가져오는지 확인해 본다.
fetch mysql_queries
delete.value 258
insert.value 26003
replace.value 0
select.value 684503
update.value 51821
cache_hits.value 0
이렇게 나온다면 정상
ps. /var/lib/munin 에 munin user 가 R/W 할 수 있는 권한이 있는지도 확인 |
|
| 위로 |
|
 |
|
|
새로운 주제를 올릴 수 있습니다 답글을 올릴 수 있습니다 주제를 수정할 수 없습니다 올린 글을 삭제할 수 없습니다 투표를 할 수 없습니다
|
Powered by phpBB © 2001, 2005 phpBB Group
|