監視ツール · 4 min read · Nov 20, 2025
Debian 11にMonitをインストールして設定する方法

Monitは、Apache、Nginx、Rsyslog、FTP、SSHなどのサーバープロセスやサービスをLinuxシステム上で監視するための無料でオープンソースの監視ツールです。Monitは、異なるサービスを監視するためのWebベースのインターフェースとコマンドラインクライアントを提供します。実行されていない場合にプロセスを自動的に開始する機能があります。また、リモートマシンのTCPポート、サーバープロトコル、pingを監視することもできます。
このチュートリアルでは、Debian 11にMonit監視ツールをインストールして使用する方法を説明します。
前提条件
- Debian 11を実行しているサーバー。
- サーバーに設定されたrootパスワード。
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 Web UIを有効にする
Monitは、異なるサービスを管理および監視するためのWeb 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 monitProFTPD用に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 monitMonit Web UIにアクセスする
今、Webブラウザを開き、URL http://your-server-ip:2812を使用してMonit Webインターフェースにアクセスします。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を正常にインストールしました。これで、リモートホストを追加してWebブラウザから監視を開始できます。質問があればお気軽にお尋ねください。
新しい投稿を受信箱で受け取る
スパムはありません。いつでも購読を解除できます。