最後更新: 2024-04-22
目錄
- Re-sent Alert ( with reminder on)
- Multiple email recipients
- mail-format
- 設定某 Service 不出 Alert 某 E-Mail
- Event Filter
- Event Queue
Re-sent Alert ( with reminder on )
* Monit by default sends just one notification
i.e.
# Notified each tenth cycle
# Global set alert [email protected] not on { instance } with reminder on 10 cycles
OR
# Per Service
CHECK HOST
alert foo@bar with reminder on 10 cycles
IF ...
...
...
THEN alert
Multiple email recipients
settings
alert [email protected] alert [email protected]
mail-format
set mail-format { from: [email protected] reply-to: [email protected] subject: $SERVICE $EVENT at $DATE message: Dear Sir Monit $ACTION $SERVICE at $DATE on $HOST: $DESCRIPTION. Yours sincerely, monit }
設定某 Service 不出 Alert 某 E-Mail
i.e.
set alert foo@bar
check process p1 with pidfile /var/run/p1.pid
noalert foo@bar
Event Filter
Settings
[1]
set alert foo@bar only on { Event1, Event2, ... }
[2]
set alert foo@bar but not on { Event1, Event2 ... }
Event:
- instance # email content: "Monit instance changed"
- nonexist # email content: "Does not exist""
- ...
Event Queue
If no mail server is available, Monit can queue events in the local file-system for retry until the mail server recovers.
The event queue is persistent across Monit restarts
By default, the queue is disabled and if the alert handler fails, Monit will simply drop the alert message.
# 當沒有 "set alert [email protected]" 時就沒有 E-Mail Alert
# slots = queue size = store up to number event messages
SET EVENTQUEUE BASEDIR <path> [SLOTS <number>]