monitで監視、アラート通知
参考
インストール
- 依存パッケージがほぼない。
sudo apt-get install -y monit
設定
include /etc/monit/conf.d/*
- /etc/monit/monitrc は編集しない。最終行で上記があるので外出しする。
/etc/monit/conf.d/check_hosts.conf
#------------
# メール設定
#------------
# 指定しないとメールが飛ばなかった
set mailserver localhost
# アラート通知先
set alert [email protected]
#--------------
# httpサーバ設定
#--------------
# monitのステータスをwebで見れる。localhostのみ許可
set httpd port 2812 and
use address localhost
allow localhost
#--------------
# 監視対象
#--------------
# http://server1.hoge.jp/ が停止・復旧したらメール通知
check host server1 with address server1.hoge.jp
if failed url http://server1.hoge.jp/
then alert
# server2.hoge.jp:22 が停止・復旧したらメール通知
check host server2 with address server2.hoge.jp
if failed port 22
then alert
サービス起動
syntaxチェック
sudo monit -t
monit再起動
sudo systemctl restart monit
監視間隔
set daemon 120
- 2分おきに監視(初期値)
Author And Source
この問題について(monitで監視、アラート通知), 我々は、より多くの情報をここで見つけました https://qiita.com/tukiyo3/items/ce200aeec1c3543828c6著者帰属:元の著者の情報は、元のURLに含まれています。著作権は原作者に属する。
Content is automatically searched and collected through network algorithms . If there is a violation . Please contact us . We will adjust (correct author information ,or delete content ) as soon as possible .