Example 1 # 監視間隔 set daemon 60 # log format set logfile syslog facility log_daemon # メールサーバの指定 (SMTP で接続 ) set mailserver mailserver.server.domain, # primary mailserver 10.8.15.100 # secondary mailserver # アラートメールのフォーマット set mail-format { from: monit@shanon.co.jp subject: $HOST : $SERVICE - $EVENT message: Monit ACTION : $ACTION SERVICE : $SERVICE at $DATE on $HOST. DESCRIPTION : $DESCRIPTION } # アラート送信先 set alert alert@alert.adder set alert alert-mobile@alert.adder not on { INSTANCE } # コンフィグの include include /etc/monit.d/*.conf
11.
Example 2 #1min のロードアベレージが 5 回中 3 回5を超えていたらアラート送信 check system localhost.localdomain if loadavg (1min) > 5 for 3 times within 5 cycles then alert # http://localhost:8080/services/name へリクエストし、レスポンス内容に OK が3回連続で入ってなかったら # /path/to/program を apache 権限で実行して [email_address] にメール送信 check host any_services_name address localhost if failed url http://localhost:8080/services/name and content = 'OK' 3 times within 3 cycle then exec "/path/to/program" as uid apache and gid apache alert alert@alert.mobile.addr ÷