需要一些建议来监控 Linux 中托管的 WordPress 站点错误消息(开源工具和免费) 类似这样的错误消息:
我设置了 monit 来监控有关数据库、网络服务器、redis 和 php-fpm 的进程服务,有时由于 WordPress 插件/文件错误而发生上述错误,而不是因为服务 - 无论如何,我尝试使用以下规则监控该网站,但不知何故我无法使其工作
check host example with address example.com
if failed (url https://example.com and content == 'Error establishing a Redis connection')
then alert
# below also not working
check host example with address example.com
if failed
url example.com
port 80/443
proto http/https
content = ""
#tried with content = ""
我相信内容的检查主机规则也需要添加 url(请 cmiiw),不知何故,我不知道测试规则是否由于此错误而失败,因为我收到的警报通知是
http/https 协议测试失败 希望您能就此向我提出建议,并随时为我上述目的的其他方法/工具建议不同的方法
谢谢!
Monit 不监听输出流。
您可以向应用程序发送请求并检查响应/内容,请参阅 https://mmonit.com/monit/documentation/monit.html#HTTP
如果收到意外回复,请发送警报。
if failed port 80 protocol http and request "ok" with content = "awaited text" then alert
如果收到预期回复,请发送警报。
if succeeded port 80 protocol http and request "error" with content = "error text" then alert
根据您的样本提出的建议。
check host example with address example.com
if succeeded port 80 protocol http and request "something" with content == "Error establishing a Redis connection" then alert
如果您收到请求的预期错误文本,则会发送警报。