모니터링 도구 · 5 min read · Nov 08, 2025
우분투 22.04에 Nagios 모니터링 도구 설치하는 방법

Nagios는 리눅스 및 윈도우 서버와 네트워크 및 인프라를 모니터링하는 데 사용되는 강력한 무료 오픈 소스 모니터링 도구입니다. Nagios를 사용하면 CPU 사용량, 디스크 사용량 및 HTTP, SSH, FTP, SMTP 등 여러 서비스를 모니터링할 수 있습니다. 중앙 위치에서 모든 서버를 모니터링하는 데 도움이 되는 간단하고 사용자 친화적인 웹 인터페이스를 제공합니다. 여러 API를 통해 타사 애플리케이션과 쉽게 통합할 수 있습니다. Nagios는 지정한 호스트와 서비스를 지속적으로 모니터링하고 문제가 발생할 때 경고합니다.
이 튜토리얼에서는 우분투 22.04 서버에 Nagios Core를 설치하는 방법을 보여줍니다.
전제 조건
- 우분투 22.04를 실행하는 서버.
- 서버에 루트 비밀번호가 설정되어 있어야 합니다.
필요한 종속성 설치
시작하기 전에 시스템 패키지를 업데이트하고 서버에 필요한 다른 종속성을 설치해야 합니다:
apt-get update -y
apt-get install wget unzip vim curl openssl build-essential libgd-dev libssl-dev libapache2-mod-php php-gd php apache2 -y모든 패키지가 설치되면 다음 단계로 진행할 수 있습니다.
소스에서 Nagios Core 설치
기본적으로 최신 Nagios Core 버전은 22.04 기본 저장소에서 사용할 수 없습니다. 따라서 소스에서 Nagios를 컴파일하는 것이 좋습니다.
먼저, 다음 명령어로 Git 저장소에서 최신 버전의 Nagios Core를 다운로드합니다:
wget https://assets.nagios.com/downloads/nagioscore/releases/nagios-4.4.7.tar.gz다운로드가 완료되면 다음 명령어로 다운로드한 파일을 추출합니다:
tar -xvzf nagios-4.4.7.tar.gz다음으로, 추출된 디렉토리로 이동하고 다음 명령어로 Nagios Core를 구성합니다:
cd nagios-4.4.7
./configure --with-httpd-conf=/etc/apache2/sites-enabled다음과 같은 출력이 표시되어야 합니다:
* Configuration summary for nagios 4.4.7 2022-04-14 *:
General Options:
-------------------------
Nagios executable: nagios
Nagios user/group: nagios,nagios
Command user/group: nagios,nagios
Event Broker: yes
Install ${prefix}: /usr/local/nagios
Install ${includedir}: /usr/local/nagios/include/nagios
Lock file: /run/nagios.lock
Check result directory: /usr/local/nagios/var/spool/checkresults
Init directory: /lib/systemd/system
Apache conf.d directory: /etc/apache2/sites-enabled
Mail program: /bin/mail
Host OS: linux-gnu
IOBroker Method: epoll
Web Interface Options:
------------------------
HTML URL: http://localhost/nagios/
CGI URL: http://localhost/nagios/cgi-bin/
Traceroute (used by WAP):
Review the options above for accuracy. If they look okay,
type 'make all' to compile the main program and CGIs.
다음으로, 다음 명령어를 실행하여 Nagios를 컴파일합니다:
make all다음으로, 필요한 사용자와 그룹을 생성하고 다음 명령어로 Nagios 사용자를 www-data 그룹에 추가합니다:
make install-groups-users
usermod -a -G nagios www-data다음으로, 다음 명령어를 사용하여 Nagios Core를 설치합니다:
make install다음과 같은 출력이 표시되어야 합니다:
* Main program, CGIs and HTML files installed *
You can continue with installing Nagios as follows (type 'make'
without any arguments for a list of all possible options):
make install-init
- This installs the init script in /lib/systemd/system
make install-commandmode
- This installs and configures permissions on the
directory for holding the external command file
make install-config
- This installs sample config files in /usr/local/nagios/etc
make[1]: Leaving directory '/root/nagios-4.4.7'
Nagios Core가 설치되면 Nagios 서비스를 관리하기 위한 systemd 서비스 파일을 생성해야 합니다. 다음 명령어로 systemd init 스크립트를 생성할 수 있습니다:
make install-daemoninit다음으로, 다음 명령어로 Nagios 설치 디렉토리에 적절한 권한을 설정합니다:
make install-commandmode다음으로, 다음 명령어로 샘플 Nagios 구성 파일을 생성합니다:
make install-config다음으로, 다음 명령어로 Nagios 웹 인터페이스를 설치합니다:
make install-webconf
a2enmod rewrite cgi다음으로, 변경 사항을 적용하기 위해 Apache 서비스를 재시작합니다:
systemctl restart apache2다음으로, Nagios 웹 인터페이스의 테마를 설치합니다.
make install-exfoliationNagios 관리자 사용자 생성
다음으로, Nagios 웹 인터페이스에 액세스할 관리자 사용자를 생성해야 합니다. 다음 명령어로 생성할 수 있습니다:
htpasswd -c /usr/local/nagios/etc/htpasswd.users nagiosadmin원하는 비밀번호를 설정합니다:
New password:
Re-type new password:
Adding password for user nagiosadmin
Nagios 플러그인 설치
다음으로, 시스템 서비스를 모니터링하기 위해 Nagios 플러그인을 다운로드해야 합니다. 다음 명령어로 Git 저장소에서 다운로드할 수 있습니다:
wget https://github.com/nagios-plugins/nagios-plugins/releases/download/release-2.4.0/nagios-plugins-2.4.0.tar.gz다운로드가 완료되면 다음 명령어로 다운로드한 파일을 추출합니다:
tar -xvzf nagios-plugins-2.4.0.tar.gz다음으로, 추출된 디렉토리로 이동하고 다음 명령어로 구성합니다:
cd nagios-plugins-2.4.0
./configure --with-nagios-user=nagios --with-nagios-group=nagios다음으로, 다음 명령어로 설치합니다:
make
make install다음으로, 다음 명령어로 Nagios 구성 파일 샘플을 확인합니다:
/usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg모든 것이 정상이라면 다음과 같은 출력이 표시되어야 합니다:
Running pre-flight check on configuration data...
Checking objects...
Checked 8 services.
Checked 1 hosts.
Checked 1 host groups.
Checked 0 service groups.
Checked 1 contacts.
Checked 1 contact groups.
Checked 24 commands.
Checked 5 time periods.
Checked 0 host escalations.
Checked 0 service escalations.
Checking for circular paths...
Checked 1 hosts
Checked 0 service dependencies
Checked 0 host dependencies
Checked 5 timeperiods
Checking global event handlers...
Checking obsessive compulsive processor commands...
Checking misc settings...
Total Warnings: 0
Total Errors: 0
Things look okay - No serious problems were detected during the pre-flight check
Nagios 서비스 시작
이제 Nagios 서비스를 시작하고 시스템 재부팅 시 자동으로 시작되도록 설정합니다:
systemctl start nagios
systemctl enable nagios다음 명령어로 Nagios 서비스의 상태를 확인할 수 있습니다:
systemctl status nagios다음과 같은 출력이 표시되어야 합니다:
? nagios.service - Nagios Core 4.4.7
Loaded: loaded (/lib/systemd/system/nagios.service; enabled; vendor preset: enabled)
Active: active (running) since Wed 2022-05-04 17:18:52 UTC; 1s ago
Docs: https://www.nagios.org/documentation
Process: 15854 ExecStartPre=/usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg (code=exited, status=0/SUCCESS)
Process: 15855 ExecStart=/usr/local/nagios/bin/nagios -d /usr/local/nagios/etc/nagios.cfg (code=exited, status=0/SUCCESS)
Main PID: 15856 (nagios)
Tasks: 6 (limit: 2241)
Memory: 5.2M
CPU: 355ms
CGroup: /system.slice/nagios.service
??15856 /usr/local/nagios/bin/nagios -d /usr/local/nagios/etc/nagios.cfg
??15857 /usr/local/nagios/bin/nagios --worker /usr/local/nagios/var/rw/nagios.qh
??15858 /usr/local/nagios/bin/nagios --worker /usr/local/nagios/var/rw/nagios.qh
??15859 /usr/local/nagios/bin/nagios --worker /usr/local/nagios/var/rw/nagios.qh
??15860 /usr/local/nagios/bin/nagios --worker /usr/local/nagios/var/rw/nagios.qh
??15861 /usr/local/nagios/bin/nagios -d /usr/local/nagios/etc/nagios.cfg
June 12 06:10:52 jellyfish nagios[15856]: qh: core query handler registered
June 12 06:10:52 jellyfish nagios[15856]: qh: echo service query handler registered
June 12 06:10:52 jellyfish nagios[15856]: qh: help for the query handler registered
June 12 06:10:52 jellyfish nagios[15856]: wproc: Successfully registered manager as @wproc with query handler
June 12 06:10:52 jellyfish nagios[15856]: wproc: Registry request: name=Core Worker 15858;pid=15858
June 12 06:10:52 jellyfish nagios[15856]: wproc: Registry request: name=Core Worker 15857;pid=15857
June 12 06:10:52 jellyfish nagios[15856]: wproc: Registry request: name=Core Worker 15860;pid=15860
June 12 06:10:52 jellyfish nagios[15856]: wproc: Registry request: name=Core Worker 15859;pid=15859
June 12 06:10:53 jellyfish nagios[15856]: Successfully launched command file worker with pid 15861
June 12 06:10:53 jellyfish nagios[15856]: HOST ALERT: localhost;DOWN;SOFT;1;(No output on stdout)
Nagios 웹 인터페이스에 액세스
이제 웹 브라우저를 열고 URL http://your-server-ip/nagios를 입력합니다. Nagios 로그인 화면으로 리디렉션됩니다:

Nagios 관리자 사용자 이름과 비밀번호를 입력하고 OK 버튼을 클릭합니다. 다음 화면에서 Nagios 기본 대시보드를 볼 수 있어야 합니다:

결론
축하합니다! 우분투 22.04 서버에 최신 버전의 Nagios Core를 성공적으로 설치했습니다. 이제 인프라에 Nagios를 구현하고 모니터링 호스트를 추가하여 웹 브라우저를 통해 모니터링을 시작할 수 있습니다. 질문이 있으면 언제든지 문의해 주세요.
새 게시물을 받은 편지함에서 받기
스팸은 없습니다. 언제든지 구독 해지 가능합니다.