Answers:
根据文档,Monit可以生成许多警报:
Event: | Failure state: | Success state:
---------------------------------------------------------------------
action | "Action done" | "Action done"
checksum | "Checksum failed" | "Checksum succeeded"
bytein | "Download bytes exceeded" | "Download bytes ok"
byteout | "Upload bytes exceeded" | "Upload bytes ok"
connection | "Connection failed" | "Connection succeeded"
content | "Content failed", | "Content succeeded"
data | "Data access error" | "Data access succeeded"
exec | "Execution failed" | "Execution succeeded"
fsflags | "Filesystem flags failed" | "Filesystem flags succeeded"
gid | "GID failed" | "GID succeeded"
icmp | "Ping failed" | "Ping succeeded"
instance | "Monit instance changed" | "Monit instance changed not"
invalid | "Invalid type" | "Type succeeded"
link | "Link down" | "Link up"
nonexist | "Does not exist" | "Exists"
packetin | "Download packets exceeded" | "Download packets ok"
packetout | "Upload packets exceeded" | "Upload packets ok"
permission | "Permission failed" | "Permission succeeded"
pid | "PID failed" | "PID succeeded"
ppid | "PPID failed" | "PPID succeeded"
resource | "Resource limit matched" | "Resource limit succeeded"
saturation | "Saturation exceeded" | "Saturation ok"
size | "Size failed" | "Size succeeded"
speed | "Speed failed" | "Speed ok"
status | "Status failed" | "Status succeeded"
timeout | "Timeout" | "Timeout recovery"
timestamp | "Timestamp failed" | "Timestamp succeeded"
uid | "UID failed" | "UID succeeded"
uptime | "Uptime failed" | "Uptime succeeded"
我们可以通过设置来解决此问题(更改地址以保护无辜者):
SET ALERT important-messages@projectlocker.com ON { invalid, nonexist, timeout, resource, size, timestamp}
SET ALERT less-important-messages@projectlocker.com ON {action, permission, pid, ppid, instance, status}
这样可以成功地将邮件路由到我们关注的地址。您可以全局或本地设置它们,但是我们的警报只是全局的。
http://mmonit.com/monit/documentation/monit.html上“ SERVICE TESTS”(服务测试)下的子标题 与上述类型相当整齐。
对于服务器的每个计划的进程或功能,您应该能够用简单的英语提出对您而言重要的事情,并使该愿望与SERVICE TESTS中提到的一项测试相匹配。例如,如果我正在运行Apache,我知道我在乎:
对于轮询的自定义守护程序,我可能会担心日志文件是否会定期更新状态消息(时间戳)。
我正在使用Monit版本5.2.5,并且使用以下命令已停止通过Monit警报
set alert example@gmail.com not {instance}