서버 관리 · 6 min read · Nov 20, 2025

Debian 11에 Monit 설치 및 구성하는 방법

Monit은 Linux 시스템에서 Apache, Nginx, Rsyslog, FTP 및 SSH와 같은 서버 프로세스 및 서비스를 모니터링하는 무료 오픈 소스 모니터링 도구입니다. Monit은 다양한 서비스를 모니터링하기 위한 웹 기반 인터페이스와 명령줄 클라이언트를 제공합니다. 실행 중이지 않은 프로세스를 자동으로 시작할 수 있는 기능이 있습니다. 또한 원격 머신의 TCP 포트, 서버 프로토콜 및 핑을 모니터링할 수 있습니다.

이 튜토리얼에서는 Debian 11에 Monit 모니터링 도구를 설치하고 사용하는 방법을 설명합니다.

전제 조건

  • Debian 11을 실행하는 서버.
  • 서버에 구성된 루트 비밀번호.

Debian 11에 Monit 설치하기

기본적으로 Monit 패키지는 Debian 11 기본 저장소에 있습니다. 다음 명령어를 실행하여 설치할 수 있습니다:

apt-get install monit -y

설치가 완료되면 다음 명령어를 사용하여 Monit 서비스를 시작하고 시스템 재부팅 시 자동으로 시작되도록 설정할 수 있습니다:

systemctl start monit  
systemctl enable monit

다음 명령어를 사용하여 Monit의 상태를 확인할 수도 있습니다:

systemctl status monit

다음과 같은 출력이 표시됩니다:

? monit.service - LSB: service and resource monitoring daemon
     Loaded: loaded (/etc/init.d/monit; generated)
     Active: active (running) since Sat 2022-01-01 07:38:44 UTC; 10s ago
       Docs: man:systemd-sysv-generator(8)
    Process: 1005 ExecStart=/etc/init.d/monit start (code=exited, status=0/SUCCESS)
      Tasks: 1 (limit: 2341)
     Memory: 1.7M
        CPU: 20ms
     CGroup: /system.slice/monit.service
             ??1010 /usr/bin/monit -c /etc/monit/monitrc

Jan 01 07:38:44 debian11 systemd[1]: Starting LSB: service and resource monitoring daemon...
Jan 01 07:38:44 debian11 monit[1005]: Starting daemon monitor: monit.
Jan 01 07:38:44 debian11 systemd[1]: Started LSB: service and resource monitoring daemon.

작업이 완료되면 다음 단계로 진행할 수 있습니다.

Monit 웹 UI 활성화하기

Monit은 다양한 서비스를 관리하고 모니터링하기 위한 웹 UI도 제공합니다. 기본적으로 비활성화되어 있으므로 활성화하고 관리자 비밀번호를 설정해야 합니다. Monit 구성 파일을 편집하여 이를 수행할 수 있습니다:

nano /etc/monit/monitrc

다음 줄의 주석을 제거하고 변경합니다:

set httpd port 2812 and
allow admin:monitpassword

파일을 저장하고 닫은 후 변경 사항을 적용하기 위해 Monit 서비스를 재시작합니다:

systemctl restart monit

기본적으로 Monit은 포트 2812에서 수신 대기합니다. 다음 명령어를 사용하여 확인할 수 있습니다:

ss -antpl | grep :2812

다음과 같은 출력이 표시됩니다:

LISTEN 0      1024         0.0.0.0:2812      0.0.0.0:*    users:(("monit",pid=1322,fd=6))                        
LISTEN 0      1024            [::]:2812         [::]:*    users:(("monit",pid=1322,fd=7))                        

Nginx에 대한 Monit 구성하기

Monit은 다양한 서비스를 모니터링할 수 있습니다. 먼저 다음 명령어를 사용하여 운영 체제의 상태를 확인합니다:

monit status

다음과 같은 출력이 표시됩니다:

Monit 5.27.2 uptime: 0m

System 'debian11'
  status                       OK
  monitoring status            Monitored
  monitoring mode              active
  on reboot                    start
  load average                 [0.14] [0.06] [0.02]
  cpu                          0.0%usr 0.0%sys 0.0%nice 0.0%iowait 0.0%hardirq 0.0%softirq 0.0%steal 0.0%guest 0.0%guestnice 
  memory usage                 192.2 MB [9.7%]
  swap usage                   0 B [0.0%]
  uptime                       2m
  boot time                    Sat, 01 Jan 2022 07:37:55
  filedescriptors              512 [0.0% of 9223372036854775807 limit]
  data collected               Sat, 01 Jan 2022 07:39:34

기본적으로 Monit은 Nginx 서비스 구성 파일을 제공하지만 기본적으로 비활성화되어 있습니다. 따라서 모니터링하려면 활성화해야 합니다. 다음 명령어를 실행하여 활성화할 수 있습니다:

ln -s /etc/monit/conf-available/nginx /etc/monit/conf-enabled/

다음으로 변경 사항을 적용하기 위해 Monit 서비스를 재시작합니다:

systemctl restart monit

ProFTPD에 대한 Monit 구성하기

Monit은 ProFTPD에 대한 서비스 구성 파일을 제공하지 않습니다. 따라서 ProFTPD 서비스 구성 파일을 생성해야 합니다. 다음 명령어를 사용하여 생성할 수 있습니다:

nano /etc/monit/conf-available/proftpd

다음 줄을 추가합니다:

check process proftpd with pidfile /var/run/proftpd.pid
   start program = "/etc/init.d/proftpd start"
   stop  program = "/etc/init.d/proftpd stop"
if failed port 21 protocol ftp then restart

파일을 저장하고 닫은 후 다음 명령어를 사용하여 ProFTPD 서비스 구성 파일을 활성화합니다:

ln -s /etc/monit/conf-available/proftpd /etc/monit/conf-enabled

다음으로 다음 명령어를 사용하여 구성 파일의 구문 오류를 확인합니다:

monit -t

모든 것이 정상이라면 다음과 같은 출력이 표시됩니다:

Control file syntax OK

마지막으로 변경 사항을 적용하기 위해 Monit을 재시작합니다.

systemctl restart monit

Monit 웹 UI에 접근하기

이제 웹 브라우저를 열고 URL http://your-server-ip:2812를 사용하여 Monit 웹 인터페이스에 접근합니다. Monit 로그인 페이지로 리디렉션됩니다:

관리자 사용자 이름과 비밀번호를 입력하고 로그인 버튼을 클릭합니다. 다음 화면에서 Monit 대시보드를 볼 수 있습니다:

debian11을 클릭하여 운영 체제의 상태를 확인합니다. 다음 화면이 표시됩니다:

Nginx를 클릭하여 Nginx 서비스의 상태를 확인합니다. 다음 화면이 표시됩니다:

명령줄을 통한 서비스 모니터링

명령줄 인터페이스를 사용하여 모든 서비스의 상태를 모니터링할 수도 있습니다.

모든 서비스의 요약을 얻으려면 다음 명령어를 실행합니다:

monit summary

다음과 같은 출력이 표시됩니다:

Monit 5.27.2 uptime: 0m
???????????????????????????????????????????????????????????????????????????????
? Service Name                    ? Status                     ? Type          ?
???????????????????????????????????????????????????????????????????????????????
? debian11                        ? OK                         ? System        ?
???????????????????????????????????????????????????????????????????????????????
? proftpd                         ? OK                         ? Process       ?
???????????????????????????????????????????????????????????????????????????????
? nginx                           ? OK                         ? Process       ?
???????????????????????????????????????????????????????????????????????????????
? nginx_bin                       ? OK                         ? File          ?
???????????????????????????????????????????????????????????????????????????????
? nginx_rc                        ? OK                         ? File          ?
???????????????????????????????????????????????????????????????????????????????

모든 서비스의 상태를 확인하려면 다음 명령어를 실행합니다:

monit status

다음과 같은 출력이 표시됩니다:

Monit 5.27.2 uptime: 0m

Process 'proftpd'
  status                       OK
  monitoring status            Monitored
  monitoring mode              active
  on reboot                    start
  pid                          2596
  parent pid                   1
  uid                          0
  effective uid                107
  gid                          65534
  uptime                       16m
  threads                      1
  children                     0
  cpu                          -
  cpu total                    -
  memory                       0.1% [2.9 MB]
  memory total                 0.1% [2.9 MB]
  security attribute           unconfined
  filedescriptors              5 [0.5% of 1024 limit]
  total filedescriptors        5
  read bytes                   0 B/s [32 B total]
  disk read bytes              0 B/s [0 B total]
  disk read operations         0.0 reads/s [34 reads total]
  write bytes                  0 B/s [178 B total]
  disk write bytes             0 B/s [4 kB total]
  disk write operations        0.0 writes/s [3 writes total]
  port response time           2.495 ms to localhost:21 type TCP/IP protocol FTP
  data collected               Sat, 01 Jan 2022 08:00:43

Process 'nginx'
  status                       OK
  monitoring status            Monitored
  monitoring mode              active
  on reboot                    start
  pid                          2078
  parent pid                   1
  uid                          0
  effective uid                0
  gid                          0
  uptime                       20m
  threads                      1
  children                     1
  cpu                          -
  cpu total                    -
  memory                       0.6% [11.5 MB]
  memory total                 0.8% [16.6 MB]
  security attribute           unconfined
  filedescriptors              9 [0.9% of 1024 limit]
  total filedescriptors        19
  read bytes                   0 B/s [62.0 kB total]
  disk read bytes              0 B/s [3.4 MB total]
  disk read operations         0.0 reads/s [73 reads total]
  write bytes                  0 B/s [81 B total]
  disk write bytes             0 B/s [4 kB total]
  disk write operations        0.0 writes/s [2 writes total]
  data collected               Sat, 01 Jan 2022 08:00:43

File 'nginx_bin'
  status                       OK
  monitoring status            Monitored
  monitoring mode              active
  on reboot                    start
  permission                   755
  uid                          0
  gid                          0
  size                         1.1 MB
  access timestamp             Sat, 01 Jan 2022 07:39:44
  change timestamp             Sat, 01 Jan 2022 07:39:47
  modify timestamp             Sat, 29 May 2021 14:21:37
  checksum                     12a1c0be9962768c055158782d1d564a (MD5)
  data collected               Sat, 01 Jan 2022 08:00:43

File 'nginx_rc'
  status                       OK
  monitoring status            Monitored
  monitoring mode              active
  on reboot                    start
  permission                   755
  uid                          0
  gid                          0
  size                         4.5 kB
  access timestamp             Sat, 01 Jan 2022 07:39:44
  change timestamp             Sat, 01 Jan 2022 07:39:47
  modify timestamp             Sat, 29 May 2021 14:21:37
  checksum                     290f6f12a12bc8e882bc5af46c1bfe7c (MD5)
  data collected               Sat, 01 Jan 2022 08:00:43

System 'debian11'
  status                       OK
  monitoring status            Monitored
  monitoring mode              active
  on reboot                    start
  load average                 [0.00] [0.00] [0.00]
  cpu                          0.0%usr 0.0%sys 0.0%nice 0.0%iowait 0.0%hardirq 0.0%softirq 0.0%steal 0.0%guest 0.0%guestnice 
  memory usage                 199.5 MB [10.1%]
  swap usage                   0 B [0.0%]
  uptime                       23m
  boot time                    Sat, 01 Jan 2022 07:37:55
  filedescriptors              640 [0.0% of 9223372036854775807 limit]
  data collected               Sat, 01 Jan 2022 08:00:43

ProFTPD 서비스의 상태를 확인하려면 다음 명령어를 실행합니다:

monit status proftpd

다음과 같은 출력이 표시됩니다:

Monit 5.27.2 uptime: 0m

Process 'proftpd'
  status                       OK
  monitoring status            Monitored
  monitoring mode              active
  on reboot                    start
  pid                          2596
  parent pid                   1
  uid                          0
  effective uid                107
  gid                          65534
  uptime                       16m
  threads                      1
  children                     0
  cpu                          -
  cpu total                    -
  memory                       0.1% [2.9 MB]
  memory total                 0.1% [2.9 MB]
  security attribute           unconfined
  filedescriptors              5 [0.5% of 1024 limit]
  total filedescriptors        5
  read bytes                   0 B/s [32 B total]
  disk read bytes              0 B/s [0 B total]
  disk read operations         0.0 reads/s [34 reads total]
  write bytes                  0 B/s [178 B total]
  disk write bytes             0 B/s [4 kB total]
  disk write operations        0.0 writes/s [3 writes total]
  port response time           2.495 ms to localhost:21 type TCP/IP protocol FTP
  data collected               Sat, 01 Jan 2022 08:00:43

결론

축하합니다! Debian 11에 Monit을 성공적으로 설치했습니다. 이제 원격 호스트를 추가하고 웹 브라우저에서 모니터링을 시작할 수 있습니다. 질문이 있으면 언제든지 문의해 주세요.

Share: X/Twitter LinkedIn

새 게시물을 받은 편지함에서 받기

스팸은 없습니다. 언제든지 구독 해지 가능합니다.