monit

サーバ監視用にmonitを導入しました。
自分で構築した別のWebサーバを監視しています。
アラートが発生した場合には、メールを送信するようにしました。

# yum install monit
Loaded plugins: fastestmirror
base                                                     | 3.6 kB     00:00
epel/x86_64/metalink                                     | 5.4 kB     00:00
epel                                                     | 4.4 kB     00:00
extras                                                   | 3.4 kB     00:00
rpmforge                                                 | 1.9 kB     00:00
updates                                                  | 3.4 kB     00:00
(1/2): epel/x86_64/primary_db                              | 3.8 MB   00:01
(2/2): updates/7/x86_64/primary_db                         | 6.0 MB   00:01
(1/2): epel/x86_64/updateinfo                              | 264 kB   00:00
(2/2): epel/x86_64/pkgtags                                 | 1.3 MB   00:00
Determining fastest mirrors
* base: ftp.iij.ad.jp
* epel: ftp.iij.ad.jp
* extras: ftp.iij.ad.jp
* rpmforge: ftp.kddilabs.jp
* updates: ftp.iij.ad.jp
Resolving Dependencies
--> Running transaction check
---> Package monit.x86_64 0:5.6-1.el7 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

================================================================================
Package          Arch              Version               Repository       Size
================================================================================
Installing:
monit            x86_64            5.6-1.el7             epel            265 k

Transaction Summary
================================================================================
Install  1 Package

Total download size: 265 k
Installed size: 660 k
Is this ok [y/d/N]: y
Downloading packages:
monit-5.6-1.el7.x86_64.rpm                                 | 265 kB   00:00
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
Installing : monit-5.6-1.el7.x86_64                                       1/1
Verifying  : monit-5.6-1.el7.x86_64                                       1/1

Installed:
monit.x86_64 0:5.6-1.el7

Complete!
# systemctl start monit
# systemctl enable monit
ln -s '/usr/lib/systemd/system/monit.service' '/etc/systemd/system/multi-user.target.wants/monit.service'
vi /etc/monitrc
set mailserver localhost
set alert sysadm@foo.bar
# vi /etc/monit.d/check-foo.bar
check host foo with address www.foo.bar
if failed url http://www.foo.bar
then alert
# systemctl start monit
タイトルとURLをコピーしました