서버 모니터링 · 5 min read · Oct 19, 2025
CentOS에 Nagios Core 설치하는 방법
Nagios는 시스템 및 네트워크 모니터링을 위한 오픈 소스 소프트웨어입니다. Nagios는 호스트와 그 서비스의 활동을 모니터링하고 서버에서 문제가 발생할 경우 경고/알림을 제공합니다. Nagios는 리눅스 운영 체제에서 실행될 수 있으며, 우리는 CentOS 8 서버를 사용할 것입니다.
이 튜토리얼에서는 CentOS 8 시스템에 Nagios Core를 설치하는 방법을 보여줍니다. EPEL 저장소에서 Nagios Core 4.4.5를 설치한 후 CentOS 8 호스트 모니터를 Nagios 서버에 추가할 것입니다.
전제 조건
- CentOS 8 서버 2대 - Nagios 서버 - 호스트 이름: hakase-nagios, IP: 10.5.5.20
- CentOS 클라이언트 - 호스트 이름: client01, IP: 10.5.5.21
- 루트 권한
우리가 할 일:
- EPEL 저장소 설치
- Nagios Core 4.4.5 설치
- Nagios 플러그인 및 NRPE 플러그인 설치
- Nagios 서버에 모니터할 호스트 추가
- 호스트 모니터를 위한 구성 추가
- 테스트
1단계 - EPEL 저장소 설치
먼저, CentOS 8 시스템에 EPEL(Enterprise Linux용 추가 패키지) 저장소를 추가합니다. EPEL 저장소에서 Nagios 패키지를 설치할 것입니다.
아래의 dnf 명령어를 사용하여 EPEL 저장소를 설치합니다.
sudo dnf install epel-release설치가 완료되면 시스템에서 사용 가능한 모든 저장소를 확인합니다.
sudo dnf repolist이제 EPEL 저장소가 CentOS 8 시스템에 추가되었습니다.

2단계 - Nagios Core 설치 및 구성
이 단계에서는 CentOS 8 시스템에 Nagios 서버 4.4.5의 최신 안정 버전을 설치하고 구성합니다. EPEL 저장소에서 제공하는 nagios 패키지를 사용할 것입니다.
‘nagios’라는 이름의 모든 사용 가능한 패키지를 확인합니다.
dnf search nagios그런 다음 ‘nagios’ 패키지 세부 정보를 확인합니다.
dnf info nagios아래와 같은 nagios 패키지에 대한 세부 정보를 얻을 수 있습니다.

- Nagios Core 4.4.5 설치 및 구성
이제 아래의 dnf 명령어를 사용하여 ‘nagios’를 설치합니다.
sudo dnf install nagios설치가 완료되면 ‘/etc/nagios’ 디렉토리로 이동하여 구성 파일 ‘nagios.cfg’를 편집합니다.
cd /etc/nagios/
vim nagios.cfg다음 줄의 주석을 제거합니다.
cfg_dir=/etc/nagios/servers저장하고 닫습니다.
이제 모든 호스트 모니터 구성 파일을 저장할 새로운 디렉토리를 생성합니다.
mkdir -p /etc/nagios/servers그런 다음 연락처 구성 파일 ‘objects/contacts.cfg’를 편집합니다.
vim objects/contacts.cfg이메일 주소를 자신의 것으로 변경합니다.
email [email protected]저장하고 닫습니다.
이제 Nagios 서버를 구성했습니다.
- Nagios 인증 설정
인증을 위해 Nagios는 Apache2 웹 서버에서 제공하는 기본 httpd 인증을 사용합니다.
이제 아래의 htpasswd 명령어를 사용하여 사용자 ‘nagiosadmin’에 대한 새로운 Apache 기본 인증을 생성합니다.
htpasswd /etc/nagios/passwd nagiosadmin강력한 비밀번호를 입력하고 반복 입력하면 Nagios 서버에 대한 기본 인증이 생성됩니다.
다음으로 ‘/var/www/html’ 디렉토리로 이동하여 index.html 파일을 생성합니다.
cd /var/www/html
echo "This is index.html for Apache" > index.html
그런 다음 httpd 서비스를 시작하고 시스템 부팅에 추가합니다.
systemctl enable --now httpd
systemctl status httpd이제 Nagios 서버에 대한 새로운 사용자 ‘nagiosadmin’을 생성했습니다.

- 방화벽 설정
새로운 서비스 http와 https를 firewalld 서비스 목록에 추가합니다.
firewall-cmd --add-service=http --permanent
firewall-cmd --add-service=https --permanentfirewalld를 다시 로드합니다.
firewall-cmd --reload이제 http 및 https 서비스가 firewalld에 추가되었습니다. 결과적으로 Nagios 서버에 웹 브라우저에서 접근할 수 있습니다.

3단계 - NRPE 플러그인 및 Nagios 플러그인 설치
NRPE(Nagios Remote Plugin Executor)는 원격 시스템이 원격 모니터링 시스템에서 ‘Nagios 플러그인’ 스크립트를 실행할 수 있도록 하는 Nagios 에이전트입니다.
아래의 명령어를 사용하여 Nagios 플러그인 및 NRPE 플러그인을 설치합니다.
sudo dnf install nagios-plugins nrpe nagios-plugins-nrpe모든 설치가 완료되면 ssh 서비스, 디스크 공간, 사용자 로그인 등 기본 서버 모니터링을 위한 일부 Nagios 플러그인을 설치합니다.
사용 가능한 모든 Nagios 플러그인을 얻으려면 아래의 명령어를 실행합니다.
dnf search nagios-plugins이제 아래의 bash 루프 명령어를 사용하여 Nagios 플러그인을 설치할 수 있습니다.
for i in users uptime ssh ping procs load http swap disk; do dnf install nagios-plugins-$i -y; done모든 설치가 완료되면 ‘/etc/nagios’ 디렉토리로 이동하여 구성 파일 ‘objects/commands.cfg’를 편집합니다.
cd /etc/nagios/
vim objects/commands.cfg다음 구성을 마지막 줄에 붙여넣습니다.
define command{
command_name check_nrpe
command_line $USER1$/check_nrpe -H $HOSTADDRESS$ -c $ARG1$
}저장하고 닫습니다.
이제 Nagios 서비스를 시작하고 시스템 부팅에 추가합니다.
systemctl enable --now nagios그 후 Nagios 서비스의 상태를 확인합니다.
systemctl status nagiosNagios 서비스가 실행 중임을 확인할 수 있습니다.

이제 웹 브라우저를 열고 아래의 Nagios 서버 URL을 입력합니다.
사용자 ‘nagiosadmin’과 비밀번호로 로그인합니다.

로그인하면 아래와 같은 Nagios 대시보드를 볼 수 있습니다.

결과적으로 CentOS 8 시스템에 Nagios 서버 4.4.5를 설치했습니다.
4단계 - Nagios 서버에 모니터할 호스트 추가
이 단계에서는 CentOS 8 시스템을 Nagios 서버에 추가합니다. IP 주소 ‘10.5.5.21’를 가진 CentOS 8 서버 ‘client01’을 Nagios 서버에 추가할 것입니다.
Nagios 서버에 호스트를 추가하려면 NRPE 및 Nagios 플러그인을 서버에 설치해야 합니다.
‘client01’ 시스템에서 아래의 명령어를 사용하여 NRPE 서버를 설치합니다.
sudo dnf install nrpe그 후 아래의 bash 루프 명령어를 사용하여 일부 Nagios 플러그인을 설치합니다.
for i in users uptime ssh ping procs load http swap disk; do dnf install nagios-plugins-$i -y; done모든 설치가 완료되면 ‘/etc/nagios’ 디렉토리로 이동하여 nrpe 구성 파일 ‘nrpe.conf’를 편집합니다.
cd /etc/nagios/
vim nrpe.conf‘server_address’ 줄의 주석을 제거하고 ‘client01’ IP 주소 ‘10.5.5.21’로 값을 변경합니다.
server_address = 10.5.5.71‘allowed_hosts’ 줄에 Nagios 서버 IP 주소 ‘10.5.5.20’을 추가합니다.
allowed_hosts=127.0.0.1,::1,10.5.5.70기본 모니터링을 위한 일부 Nagios 명령을 아래와 같이 정의합니다.
command[check_root]=/usr/lib64/nagios/plugins/check_disk -w 20% -c 10% -p /
command[check_ping]=/usr/lib64/nagios/plugins/check_ping -H 10.5.5.71 -w 100.0,20% -c 500.0,60% -p 5
command[check_ssh]=/usr/lib64/nagios/plugins/check_ssh -4 10.5.5.71
command[check_http]=/usr/lib64/nagios/plugins/check_http -I 10.5.5.71저장하고 닫습니다.
이제 NRPE 서비스를 시작하고 시스템 부팅에 추가합니다.
systemctl enable --now nrpe
NRPE 서비스의 상태를 확인합니다.
systemctl status nrpeNRPE 서비스가 실행 중임을 확인할 수 있습니다.

다음으로 NRPE 포트를 firewalld에 추가하고 firewalld 구성을 다시 로드합니다.
firewall-cmd --add-port=5666/tcp --permanent
firewall-cmd --reload이제 호스트 모니터 ‘client01’에 대한 NRPE 구성을 완료했습니다.

이제 Nagios 서버 터미널로 돌아가서 아래의 nagios nrpe 명령어를 사용하여 ‘client01’ 호스트를 확인합니다.
/usr/lib64/nagios/plugins/check_nrpe -H 10.5.5.21
/usr/lib64/nagios/plugins/check_nrpe -H 10.5.5.21 -c check_ping결과적으로 ‘client01’ 호스트에서 NRPE 버전과 ping 명령이 성공적으로 실행되었습니다.

5단계 - 호스트 모니터를 위한 구성 추가
Nagios 서버로 돌아가서 ‘/etc/nagios/server’ 디렉토리로 이동하여 새로운 구성 ‘client01.cfg’를 생성합니다.
cd /etc/nagios/servers/
vim client01.cfg다음 구성을 붙여넣습니다.
define host {
use linux-server
host_name client01
alias CentOS Host
address 10.5.5.12
register 1
}
define service {
host_name client01
service_description PING
check_command check_nrpe!check_ping
max_check_attempts 2
check_interval 2
retry_interval 2
check_period 24x7
check_freshness 1
contact_groups admins
notification_interval 2
notification_period 24x7
notifications_enabled 1
register 1
}
define service {
host_name client01
service_description Check Users
check_command check_nrpe!check_users
max_check_attempts 2
check_interval 2
retry_interval 2
check_period 24x7
check_freshness 1
contact_groups admins
notification_interval 2
notification_period 24x7
notifications_enabled 1
register 1
}
define service {
host_name client01
service_description Check SSH
check_command check_nrpe!check_ssh
max_check_attempts 2
check_interval 2
retry_interval 2
check_period 24x7
check_freshness 1
contact_groups admins
notification_interval 2
notification_period 24x7
notifications_enabled 1
register 1
}
define service {
host_name client01
service_description Check Root / Disk
check_command check_nrpe!check_root
max_check_attempts 2
check_interval 2
retry_interval 2
check_period 24x7
check_freshness 1
contact_groups admins
notification_interval 2
notification_period 24x7
notifications_enabled 1
register 1
}
define service {
host_name client01
service_description Check HTTP
check_command check_nrpe!check_http
max_check_attempts 2
check_interval 2
retry_interval 2
check_period 24x7
check_freshness 1
contact_groups admins
notification_interval 2
notification_period 24x7
notifications_enabled 1
register 1
}저장하고 닫습니다.
이제 Nagios 서비스를 재시작합니다.
sudo systemctl restart nagios이제 Nagios 서버에 ‘client01’ 호스트에 대한 구성을 추가했습니다.

6단계 - 테스트
웹 브라우저를 열고 Nagios 대시보드에 로그인합니다.
‘Hosts’ 메뉴를 클릭하면 호스트 목록에서 ‘client01’을 확인할 수 있습니다.

이제 호스트 ‘client01’의 이름을 클릭하면 ‘client01’ 서버에 대한 서비스 모니터링 세부 정보를 확인할 수 있습니다.

결과적으로 CentOS 8 시스템에 Nagios 4.4.5를 설치하고 모니터할 호스트 ‘client01’을 Nagios 서버에 추가했습니다.
참고
새 게시물을 받은 편지함에서 받기
스팸은 없습니다. 언제든지 구독 해지 가능합니다.