Munin 패키지를 이용한 모니터링 서버 구축

Munin 패키지를 이용한 모니터링 서버 구축
Munin 패키지를 이용한 간단한 Linux 모니터링 서버 구축


http://munin-monitoring.org/

모니터링 서버 IP : 192.168.0.10
클라이언트 IP : 192.168.0.101

====================================================================

1. munin 서버 설정

1.1. epel repository 추가
  - munin 패키지는 CentOS 기본 패키지에는 포함되어 있지 않기 때문에, epel-release repository 를 추가하여 설치를 진행 한다. 

[root@localhost ~]# yum -y install epel-release


1.2. munin, munin-node 패키지 설치
   - munin 패키지는 모니터링 웹페이지가 운영에 필요한 패키지이기 때문에, 모니터링 서버에 apache와 같이 설치가 되어야 한다. 
     munin-node 패키지는 모니터링 대상 서버에 설치가 되는 clinet 프로그램이다. 
   - 모니터링 서버에서 localhost도 같이 모니터링 하기 위해 munin 프로그램 외에 munin-node 패키지도 같이 설치한다. (rrdtool을 비롯한 의존성 패키지들이 같이 설치된다.)

[root@localhost ~]yum -y install munin munin-node

[root@localhost ~]chkconfig --list | grep munin
munin-node      0:off   1:off   2:on    3:on    4:on    5:on    6:off


1.3. /etc/munin/munin.conf 수정
   - htmldir 을 원하는 홈페이지 디렉토리로 변경한다.
   - 파일 중간 부분의 localhost 설정 아래 부분에 동일한 방법으로 모니터링할 서버의 아이피를 추가 한다.

[root@localhost ~]vi /etc/munin/munin.conf

    ~ ~

dbdir   /var/lib/munin
htmldir /home/munin
#htmldir        /var/www/munin
logdir  /var/log/munin
rundir  /var/run/munin

    ~ ~

[localhost]                         <------ localhost를 모니터링 하기 위한 설정
    address 127.0.0.1
    use_node_name yes

[www]                              <------ client를 모니터링 하기 위한 설정
    address 192.168.0.101
    use_node_name yes


1.4. /etc/munin/munin-node.conf 파일 확인 
   - munin-node.conf 파일은 모니터링대상인 client 서버에서 설정을 하는 부분이다.
     서버가 자신을 모니터링 하려면, munin-node 패키지를 설치해야 하고 자신을 모니터링 하지 않을 거라면 munin 패키지만 설치 하면 된다. 
     munin-node.conf 파일 하단에 localhost에서의 접근 허용이 설정 되어 있다. munin 서버의 ip도 추가해 준다.
   - 수정 후, munin-node 데몬을 restart 한다.
       
[root@localhost ~]vi /etc/munin/munin-node.conf

    ~ ~

allow ^127\.0\.0\.1$
allow ^192\.168\.0\.10$      <------- munin 서버에서 접근이 가능하도록 허용

[root@localhost ~]/etc/init.d/munin-node restart
Stopping Munin Node agents:                                [  OK  ]
Starting Munin Node:                                       [  OK  ]


1.5. apache 가상호스트 설정

   - munin.conf 에서 설정한 htmldir을 DocumentRoot로 설정하여 가상호스트를 추가한다.
   - htmldir의 소유권을 munin으로 변경하고 apache 데몬을 restart 한다.
   - htmldir은 인증을 거쳐서 로그인 하도록 apache 사용자인증 설정을 한다.

<VirtualHost *:80>
    ServerAdmin [email protected]
    DocumentRoot "/home/munin"
    ServerName monitor.add4s.com
    ErrorLog "/home/munin/logs/monitor-error.log"
    CustomLog "/home/munin/logs/monitor-access.log" common
</VirtualHost>

[root@localhost ~]chown munin.munin /home/munin


====================================================================

2. munin-node 설정 

2.1. 모니터링 대상 클라이언트에는 munin-node 패키지만 설치하면 된다.
[root@localhost ~]yum install munin-node


2.2. /etc/munin/munin-node.conf 파일수정
   - munin-node.conf 파일 하단에 접근을 허용할 munin server의 ip를 추가한 후 munin-node 데몬을 리스타트 한다. 
   - 부팅시 munin-node 데몬이 자동으로 실행되도록 활성화 한다. 

[root@localhost ~]vi /etc/munin/munin-node.conf

    ~ ~

allow ^127\.0\.0\.1$
allow ^192\.168\.0\.10$          <--------- munin 서버에서 접근이 가능하도록 허용


[root@localhost ~]/etc/init.d/munin-node start
Starting Munin Node:                                       [  OK  ]

[root@localhost ~]chkconfig --list | grep munin
munin-node      0:off   1:off   2:off   3:off   4:off   5:off   6:off
[root@localhost ~]chkconfig munin-node on
[root@localhost ~]chkconfig --list | grep munin
munin-node      0:off   1:off   2:on    3:on    4:on    5:on    6:off


2.3. 5분에 한번씩 cron으로 데이터를 수집 하기 때문에, 5분이 경과한 후 가상호스트 설정한 URL로 접속 테스트

====================================================================

ex) 

3개의 댓글이 있습니다.

5년 이상 전

요즘 급 무료 모니터링 솔루션에 관심을 갖고 있었는데, 소중한 정보 감사합니다.

Reply

댓글 남기기

댓글을 남기기 위해서는 로그인이 필요합니다.

로그인 회원가입

1st 5stars

5년 이상 전

web 서버와 연동해서 모니터링 하는 툴이라서 설정해 줘야 할게 많아 보이네요.
ubuntu에서 apt install munin하니 패키지는 그냥 쭉~ 설치해 주긴하는데...
아파치 설치하고, 기타 등등의 설정을 해 줘야 해서~ ^^
일단 사용해 보는 걸 중단을 했네요~ ㅎㅎㅎ
다음에 시간될때 다시 해 봐야 겠습니다.
참고할께요~ ^^*

Reply

댓글 남기기

댓글을 남기기 위해서는 로그인이 필요합니다.

로그인 회원가입

5년 이상 전

언젠간 한번 따라해보겠습니다...

Reply

댓글 남기기

댓글을 남기기 위해서는 로그인이 필요합니다.

로그인 회원가입

댓글 남기기

댓글을 남기기 위해서는 로그인이 필요합니다.

로그인 회원가입