CentOS 에 Nagios 설치하기

관제 솔루션/Nagios 2015. 10. 20. 17:46
336x280(권장), 300x250(권장), 250x250, 200x200 크기의 광고 코드만 넣을 수 있습니다.

Nagios 설치하기

1. apache php library 설치

$ sudo apt-get update
$ sudo apt-get install apache2
$ sudo apt-get install libapache2-mod-php5 
$ sudo apt-get install build-essential
$ sudo apt-get install libgd2-xpm-dev 


2. Nagios
에 사용할 계정 생성
  1) root
권한 획득

$ sudo -s


  2) nagios
사용자 생성

# useradd -m -s /bin/bash nagios
# passwd nagios
Enter new UNIX password:
Retype new UNIX password:
passwd: passwd updated successfully


  3) nagcmd
그룹 생성 및 그룹 내에 nagios, apache 사용자 추가

# groupadd nagcmd
# usermod -a -G nagcmd nagios
# usermod -a -G nagcmd www-data 


3. Nagios
Nagios plugin 설치(링크 주소는 최신으로 갱신해서 사용. 현재 3.3.1이 최신)
  1)  
프로그램 다운로드

# mkdir ~/download
# cd ~/download
# wget http://sourceforge.net/projects/nagios/files/nagios-3.x/nagios-3.3.1/nagios-3.3.1.tar.gz 
# wget http://sourceforge.net/projects/nagiosplug/files/nagiosplug/1.4.15/nagios-plugins-1.4.15.tar.gz 


  2)
컴파일 및 설치

# tar xzf nagios-3.3.1.tar.gz
# cd nagios
nagios#  ./configure --with-command-group=nagcmd
nagios# sed -i 's:for file in includes/rss/\*;:for file in includes/rss/\*.\*;:g' ./html/Makefile

 

(또는)  - sed -i 's:for file in includes/rss/*;:for file in includes/rss/*.*;:g' ./html/Makefile


nagios# sed -i 's:for file in includes/rss/extlib/\*;:for file in  

includes/rss/extlib/\*.\*;:g' ./html/Makefile

 

(또는)  - sed -i 's:for file in includes/rss/extlib/\*;:for file in  

includes/rss/extlib/\*.\*;:g' ./html/Makefile


nagios# make all 
nagios# make install
nagios# make install-init 
nagios# make install-config 
nagios# make install-commandmode 

 

 

 


  3)
사용자 정보 수정(contact.cfg, 로그인 사용자 및 메시지 받을 사용자 정보를 수정하는 부분)

# vi /usr/local/nagios/etc/objects/contacts.cfg


  4) Web Interface
설정

nagios# make install-webconf


  5) nagios
웹 페이지 로그인을 위한 계정 설정

nagios# htpasswd -c /usr/local/nagios/etc/htpasswd.users nagiosadmin

New password: 

Re-type new password: 

Adding password for user nagiosadmin

nagios# 


  6) apache
재시작

# service apache2 restart


  ※
만약 아래와 같은 오류가 발생하면

 * Restarting web server apache2

apache2: Could not reliably determine the server's fully qualified domain name, using xxx.xxx.xxx.xxx for ServerName

 ... waiting apache2: Could not reliably determine the server's fully qualified domain name, using xxx.xxx.xxx.xxx for ServerName

   ...done.

 /etc/apache2/apache2.conf 파일을 열어 아래 내용을 추가

ServerName localhost


4. Nagios plug-in
설치
  1)
다운받은 플러그인 파일 압축 해제 및 컴파일

# tar xzf nagios-plugins-1.4.15.tar.gz
# cd nagios-plugins-1.4.15/
nagios-plugins-1.4.15# ./configure --with-nagios-user=nagios --with-nagios-group=nagios
nagios-plugins-1.4.15# make
nagios-plugins-1.4.15# make all


5. Nagios
실행
  1) Nagios
자동실행 설정

# ln -s /etc/init.d/nagios /etc/rcS.d/S99nagios


  2) Nagios config
파일 적용

# /usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg

  ※ 오류가 발생할 경우 nagios.cfg 파일 내용이 잘못된 것

  3) Nagios
서비스 시작

# service nagios start


6. Nagios
웹페이지 접속

http:// IP주소 /nagios

로 접속. ID 및 비밀번호는 위에서 설정한 대로 입력 (3-5 참고

 

'관제 솔루션 > Nagios' 카테고리의 다른 글

Nagios macro(매크로) 정의  (0) 2015.10.20