리눅스

Total 331
Today 0
profile_image
윤진한
08-02-13 23:59 0개 11회
설치문서
NMS(망관리시스템) : 1단계 Nagios 2.9 설치
ㅇ 파일 다운로드
    http://www.nagios.org/download/ 
    - nagios-version.tar.gz  (nagios-2.9.tar.gz)
    - nagios-plugins-version.tar.gz  (nagios-plugins-1.4.8.tar.gz)

ㅇ 웹서비스 관련 프로그램 설치
    yum install httpd php mysql mysql-server php-mysql system-config-httpd
    yum upgrade

ㅇ 압축풀기
    tar xzf nagios-2.9.tar.gz
    압축풀고 이동 -> cd nagios-2.9

ㅇ 유저, 그룹 등록
    adduser nagios

ㅇ 인스톨 디렉토리 생성
    mkdir /usr/local/nagios
    chown nagios.nagios /usr/local/nagios

ㅇ 웹서버 사용자 설정
    grep "^User" /etc/httpd/conf/httpd.conf

ㅇ 명령어 파일 그룹 추가
    /usr/sbin/groupadd nagcmd
   
    /usr/sbin/usermod -G nagcmd apache
    /usr/sbin/usermod -G nagcmd nagios

ㅇ 환경스크립트 실행 (압축푼 디렉토리에서 실행)
    ./configure --prefix=prefix --with-cgiurl=cgiurl --with-htmurl=htmurl --with-nagios-user=someuser--with-nagios-group=somegroup--with-command-group-cmdgroup
    기본경로
       prefix=/usr/local/nagios
       with-cgiurl=/nagios/cgi-bin
       with-htmlurl=/nagios
       with-nagios-user=nagios
       with-nagios-group=nagios
    위의 기본경로를 사용할 것이라면 별도로 지정하지 않고 ./configure만 실행해도된다.
ㅇ 컴파일
    make all
    make install (프로그램 설치)
    make install-init (/etc/rc.d/init.d/ 에 nagios 시작파일 복사)
    make install-commandmode (external command file 에 대한 퍼미션 조정)
    make install-config (prefix/etc 에 샘플파일 복사)

ㅇ 디렉토리 구조와 파일 위치
    cd /usr/local/nagios
       서브디렉토리                       용    도
          bin/                      Nagios core Program
          etc/                      메인, 자원, 오브젝트, CGI의 각 설정 파일 배치 장소
          sbin/                    CGI 실행파일
          share/                  HTML 파일 (Web interface 와 on-line document)
          var/                      로그 파일을 위한 디렉토리

ㅇ 환경파일 설정
    cd /usr/local/nagios/etc
         cp cgi.cfg-sample cgi.cfg
         cp commands.cfg-sample commands.cfg
         cp localhost.cfg-sample localhost.cfg
         cp nagios.cfg-sample nagios.cfg
         cp resource.cfg-sample resource.cfg

ㅇ 웹 인터페이스 설정
    vi /etc/httpd/conf/httpd.conf   # 파일에 nagios 실행을 위한 환경설정을 추가한다.
                                               # alias와 인증관련 설정을 하면 된다.
    ScriptAlias /nagios/cgi-bin/ /usr/local/nagios/sbin/
    <Directory "/usr/local/nagios/sbin/">
        Options ExecCGI
        AllowOverride AuthConfig
        Order allow,deny
        Allow from all
    </Directory>
    Alias /nagios/ /usr/local/nagios/share/
    <Directory "/usr/local/nagios/share">
        Options FollowSymLinks
        AllowOverride AuthConfig
        Order allow,deny
        Allow from all
    </Directory>
ㅇ 웹 접속 환경 설정
    htpasswd -c /usr/local/nagios/etc/htpasswd.users nagiosadmin
    암호 입력
   
    /etc/rc.d/init.d/httpd restart


ㅇ 플러그인 인스톨
    nagios-plugin 다운로드 후 디렉토리 이동
    ./configure
    make
    make install
    make install-root
  (루트 계정에서 실행)

ㅇ Nagios 시작
    chkconfig --add nagios
    chkconfig nagios on
    /usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg
    이 과정에서 에러가 안나야된다.

    cd /usr/local/nagios/etc
    chgrp -R nagios /usr/local/nagios
    chown -R nagios /usr/local/nagios

    service nagios start

# 문제해결
ㅇ 웹 로그인 설정
    http://localhost/nagios/ 
    메인 화면은 뜨는데, 버튼을 클릭 했을 때 "Internal Server Error" 이런 에러가 뜬다면
    chcon -R -t httpd_sys_content_t /usr/local/nagios

ㅇ CGI 설정 (CGI 에러가 발생할 경우)
    vi /usr/local/nagios/etc/cgi.cfg

         use_authentication=1 to use_authentication=0 으로 변경

# 기타설정
ㅇ 개인 설정
    vi /usr/local/nagios/etc/localhost.cfg
     define contact{
                          contact_name               nagiosadmin            
                          use                             generic-contact        
                          alias                           Nagios Admin           
                          email                           xxx@xxx.xxx
                          }
     파란색으로 되어 있는 메일 계정을 본인의 것으로 수정한다.

댓글목록

등록된 댓글이 없습니다.