본문 바로가기
Linux/Nagios

Nagios Server 설치

by 준섭이 2023. 12. 23.
728x90

### Nagios Server 설치

## 관련 패키지 설치
yum install -y httpd php gcc glibc glibc-common gd gd-devel openssl openssl-devel xinetd perl unzip
# CentOS8 에서 설치 시, php-fpm으로 설치 해야 한다.

## Nagios Server Download
cd /usr/local/src
wget https://assets.nagios.com/downloads/nagioscore/releases/nagios-4.4.12.tar.gz # 최신버전으로!! 

## Plugin Download
wget --no-check-certificate https://nagios-plugins.org/download/nagios-plugins-2.4.6.tar.gz

## NRPE Download
wget --no-check-certificate https://github.com/NagiosEnterprises/nrpe/archive/nrpe-4.1.0.tar.gz

## Services nrpe 등록
vi /etc/services
nrpe		5666/tcp		#NRPE

## Nagios Server 설치
useradd nagios
groupadd nagcmd
usermod -a -G nagcmd nagios
## usermod -G nagcmd apache+
chown nagios:nagcmd /usr/local/nagios/var/rw/
chown nagios:nagcmd /usr/local/nagios/var/rw/nagios.cmd
## 이 부분은 나중에 코멘트 업데이트 할 때 권한 부여 설정

tar zxvf nagios-4.4.12.tar.gz
cd nagios-4.4.12
./configure --with-command-group=nagcmd

make all
make install
make install-init
make install-config
make install-commandmode
make install-webconf

cp -R contrib/eventhandlers/ /usr/local/nagios/libexec/
chown -R nagios:nagios /usr/local/nagios/libexec/eventhandlers
/usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg

## nagios Server 시작
systemctl start httpd
systemctl start nagios

## Web Access를 위한 기본사용자 생성
htpasswd -c /usr/local/nagios/etc/htpasswd.users nagiosadmin

## Nagios Plugin 설치
cd /usr/local/src
tar zxvf nagios-plugins-2.4.6.tar.gz
cd nagios-plugins-2.4.6
./configure --with-nagios-user=nagios --with-nagios-group=nagios
make
make install

## NRPE 설치
tar zxvf nrpe-4.1.0.tar.gz
cd nrpe-nrpe-4.1.0
./configure --enable-command-args
make all
make install
make install-config
make install-init
systemctl enable nrpe.service

## command.cfg 수정 (nrpe)
vi /usr/local/nagios/etc/object/command.cfg
# nrpe
define command {
	command_name	check_nrpe
	command_line	$USER1$/check_nrpe -H $HOSTADDRESS$ -c $ARG1$ -t 20
    }
    
## nrpe 서비스 시작
systemctl start nrpe

## 웹서비스 확인
http://serverip/nagios

'Linux > Nagios' 카테고리의 다른 글

Nagios check memory  (0) 2023.12.23
Nagios check cpu 확인  (0) 2023.12.23
모니터링 대상 서버 nagios agent 설치 및 nrpe 설치  (0) 2023.12.23
nagios plugin, nrpe yum 설치  (0) 2023.12.23