· KLDP.org · KLDP.net · KLDP Wiki · KLDP BBS ·
System Monitoring With Nagios How To

1.1. Nagios System Software Environment

  • nagios
  • nagios-plugin
  • nagiosweb
  • apache
  • php
  • mysql, php-mysql
  • net-snmp, net-snmp-utils, net-snmp-libs
  • net-snmp-perl, perl-Net-SNMP
  • perl
  • perl-usd-snmp
  • freedts

1.2. Contact Info

nagios 설치 매뉴얼로 만든 것인데 올려봅니다.

틀린점있으시면 메일 주세요 :) 심승준 ( ftfuture at hitel.net)

1.3. INSTALL

1.3.1. OS Setting..


  • fedora core5 linux 설치
  • gcc, g++ 설치
  • apache, php, mysql 설치
  • net-snmp, net-snmp-utils, net-snmp-libs 설치
  • net-snmp-perl, perl-Net-SNMP(yum upgrade 이후 설치가능) 설치
  • perl 설치
  • perl-ucd-snmp 설치
  • gd 설치
  • php-mysql 설치
' * 팁 : yum install '패키지이름' 으로 설치한다. ' * 설치후 yum upgrade 로 시스템을 업데이트 한다.


1.3.2. nagios install

  • nagios.org 에서 nagios를 다운로드 받는다. (wget http://jaist.dl.sourceforge.net/sourceforge/nagios/nagios-2.3.1.tar.gz)
  • 압축을 푼후 nagios 디렉토리로 이동
  • shell에서 ./configure --with-nagios-group=apache 실행
  • 한글 패치 - Conatact name, Service Name등에 한글쓰면 에러가 나는데.. 이것을 패치한다.
    base/util.c 를 연다. int contains_illegal_object_chars(char *name){
    ...
    register unsigned int ch; (unsigned 를 추가한다.)
  • make all
  • make install
  • make install-config
  • make install-init
  • make install-commandmode
  • "nagios root directory"/etc/sample-config/httpd.conf 파일을 "apache cfg directory"/conf.d/nagios.conf 로 symbolic link 설정 (sample-config가 없을경우 소스 디렉토리에서 복사한다.)
  • htpasswd -c /usr/local/nagios/etc/htpasswd.users nagiosadmin (새로생성, 추가시에는 -C옵션을 뺀다.)
  • 주의 : iptables가 설정되어있으면 끈다.
  • 주의 : selinux 주의

1.3.3. nagios-plugin install

1.3.4. external nagios-plugin install

1.3.5. nagiosweb install

  • www : http://sourceforge.net/projects/nagiosweb/
  • nagiosweb2-1.3.tar.gz을 다운받는다.
  • nagiosweb 폴더로 이동
  • 웹폴더인 nagiosweb 폴더를 웹루트로 복사(예 : /var/www/html)
  • mysql에 nagiosweb 데이터베이스 생성(예: mysqladmin -u root -p create nagiosweb)
  • mysql에 nagios 사용자 생성, nagioweb DB에 대한 권한 부여 #> mysql -u root -p grant all on nagiosweb.* to nagios@localhost identified by 'password'; flush privileges;
  • nagiosweb.sql의 내용을 nagiosweb DB에 입력(예: mysql -u nagios -p nagiosweb < nagiosweb.sql)
  • dbconfig.php 수정.. 웹폴더에 있음(예: /var/www/html/nagiosweb/dbconfig.php) $db = mysql_connect("localhost", "사용자명", "패스워드 "); <----- 사용자명과 패스워드 수정
  • nagios 기본폴더(예: /usr/local/nagios/share/side.html) share/side.html 수정.. README 파일 참조

  Configuration table 아래에 추가한다.
  <tr>
    <td width=13><img src="images/greendot.gif" width="13" height="14" name="config-dot1"></td>
    <td nowrap><a href="/nagiosweb/hostlist.php" target="main" onMouseOver="switchdot('config-dot1',1)" onMouseOut="switchdot('config-dot1',0)" class="NavBarItem">Hosts</
a></td>
  </tr>
  <tr>
    <td width=13><img src="images/greendot.gif" width="13" height="14" name="config-dot2"></td>
    <td nowrap><a href="/nagiosweb/hostgrouplist.php" target="main" onMouseOver="switchdot('config-dot2',1)" onMouseOut="switchdot('config-dot2',0)" class="NavBarItem">Ho
st
      Groups</a></td>
  </tr>
  <tr>
    <td width=13><img src="images/greendot.gif" width="13" height="14" name="config-dot3"></td>
    <td nowrap><a href="/nagiosweb/servicelist.php" target="main" onMouseOver="switchdot('config-dot3',1)" onMouseOut="switchdot('config-dot3',0)" class="NavBarItem">Serv
ices</a></td>
  </tr>
  <tr>
    <td width=13><img src="images/greendot.gif" width="13" height="14" name="config-dot10"></td>
    <td nowrap><a href="/nagiosweb/servicegrouplist.php" target="main" onMouseOver="switchdot('config-dot10',1)" onMouseOut="switchdot('config-dot10',0)" class="NavBarIte
m">Service Groups</a></td>
  </tr>
  <tr>
    <td width=13><img src="images/greendot.gif" width="13" height="14" name="config-dot4"></td>
    <td nowrap><a href="/nagiosweb/contactlist.php" target="main" onMouseOver="switchdot('config-dot4',1)" onMouseOut="switchdot('config-dot4',0)" class="NavBarItem">Cont
acts</a></td>
  </tr>
  <tr>
    <td width=13><img src="images/greendot.gif" width="13" height="14" name="config-dot5"></td>
    <td nowrap><a href="/nagiosweb/contactgrouplist.php" target="main" onMouseOver="switchdot('config-dot5',1)" onMouseOut="switchdot('config-dot5',0)" class="NavBarItem"
>Contact
      Groups</a></td>
  </tr>
  <tr>
    <td width=13><img src="images/greendot.gif" width="13" height="14" name="config-dot6"></td>
    <td nowrap><a href="/nagiosweb/timeperiodlist.php" target="main" onMouseOver="switchdot('config-dot6',1)" onMouseOut="switchdot('config-dot6',0)" class="NavBarItem">T
ime Periods</a></td>
  </tr>
  <tr>
    <td width=13><img src="images/greendot.gif" width="13" height="14" name="config-dot7"></td>
    <td nowrap><a href="/nagiosweb/checkcommandlist.php" target="main" onMouseOver="switchdot('config-dot7',1)" onMouseOut="switchdot('config-dot7',0)" class="NavBarItem"
>Check Commands</a></td>
  </tr>
  <tr>
    <td width=13><img src="images/greendot.gif" width="13" height="14" name="config-dot8"></td>
    <td nowrap><a href="/nagiosweb/notifylist.php" target="main" onMouseOver="switchdot('config-dot8',1)" onMouseOut="switchdot('config-dot8',0)" class="NavBarItem">Notif
y Commands</a></td>
  </tr>
  <tr>
    <td width=13><img src="images/greendot.gif" width="13" height="14" name="config-dot9"></td>
    <td nowrap><a href="/nagiosweb/runscript.php" target="main" onMouseOver="switchdot('config-dot9',1)" onMouseOut="switchdot('config-dot9',0)" class="NavBarItem">Write
Config</a></td>
  </tr> 

  • 참고 : php.ini 에 register_globals 옵션을 On 시킨다.
  • 참고 : service group 지정문제는 nagios-*.sql 상위 버젼도 적용시키면 해결된다.

1.3.6. perl & perl-usd-install

1.3.7. 참고:freedts install(python으로 mssql디비에 접근하실때 설치)

참고: sms 전송시 mssql db를 사용하는 경우에 한해 설정한다.

다른 방법일 경우 다르게 설정

export SYBASE=/usr/local/freetds 환경변수 설정

가. FreeTDS 설치

  1. ftp://ftp.ibiblio.org/pub/Linux/ALPHA/freetds/stable/freetds-stable.tgz 다운로드
  2. ./configure --prefix=/usr/local/freetds && make && make install
  3. freetds.conf DSN을 적절히 수정
  4. /etc/ld.so.conf에 /usr/local/freetds/lib 추가 그리고 ldconfig

나. Sybase Module for python 설치

  1. http://www.object-craft.com.au/projects/sybase/
  2. python setup.py build_ext -D HAVE_FREETDS -U WANT_BULKCOPY install
    (redhat의 경우 python-devel 패키지가 설치되어 있어야 한다) \

1.3.8. linux snmp configuration

  • snmpd 설치
  • /etc/snmp/snmpd.conf 수정
  • 기본설정 수정 (syslocation, syscontact, sysservice ..) 매뉴얼 참조
  • Access Control Setup 항목을 수정한다.(중요!)
# rwuser: a SNMPv3 read-write user
#   arguments:  user [noauth|auth|priv] [restriction_oid]

rwuser  snmpuser noauth

#
# Unknown directives read in from other files by snmpconf
#
com2sec local   localhost       private
com2sec local1  127.0.0.1       public
com2sec mynetwork 192.168.2.21  public
com2sec mynetwork 192.168.2.23  public

# 커뮤니티네임과 시큐리티네임을 정한다.
# First, map the community name "public" into a "security name"
#       sec.name        source  community
com2sec notConfigGroup default  public

# Second, map the security name into a group name;
#       groupName       securityModel   securityName
group   notConfigGroup  v1      public
group   notConfigGroup  v2c     public
  • snmpd 를 시작한다.

1.3.9. windows snmp configuration

  • snmp service 를 설치하고 시작한다.
  • 속성창을 연다.
snmp_security.png
[PNG image (12.15 KB)]
  • 커뮤니티 이름과 snmp에 접근할수 있는 ip를 입력한다.

1.4. Configuration

  • Hosts : 모니터링할 서버에 대한 정보를 관리한다.
  • Host Groups : 모니터링 할 서버를 그룹별로 관리한다.
  • Services : 모니터링할 서버에 감시할 서비스를 관리한다.
  • Service Groups : 감시할 서비스를 그룹별로 관리한다.
  • Contacts : 관리자들의 이메일, SMS등 연결정보를 관리한다.
  • Contact Groups : contact 데이터를 그룹별로 관리한다.
  • Time Periods : 감시할 시간대를 관리한다.
  • Check Commands : 서비스를 감시하는 명령들을 관리한다.
  • Notify Commands : 관리자들에게 이벤트를 통보하는 명령들을 관리한다.
  • Write Config : 설정을 mysql DB에 저장, 복원 혹은 nagios configuration 파일에 쓴다.

1.5. Structure

nagios_monitoring_structure.png
[PNG image (135.61 KB)]

1.6. 사용법 설명


ID
Password
Join
A good memory does not equal pale ink.


sponsored by andamiro
sponsored by cdnetworks
sponsored by HP

Valid XHTML 1.0! Valid CSS! powered by MoniWiki
last modified 2007-01-19 15:47:38
Processing time 0.0032 sec