need some advice to monitoring wordpress site error messages hosted in linux (open source tools & free) error messages like these:
- "Error establishing database connection"
- "Error establishing a Redis connection"
- "This site can't be reached"
- "Briefly unavailable for scheduled maintenance".
- "Page Not Found"
- "There has been a critical error on your website"
I had setup monit to monitoring process service regarding DB, webserver, redis, and php-fpm sometimes above error occurred due the wordpress plugins / files error not because services - is there anyway i tried to monitoring the site with below rules but somehow i can't make it work
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 = ""
I believe the check host rule for content need to add url as well (please cmiiw) and somehow i dont know if the test rule failed due this error as an alert notif i got is
failed protocol http/https test hope you can advice me about this & feel free to suggest different approach for other ways / tools for my purpose above
Thank you!
Monit does not listen on an output stream, but you can monitor the wordpress/web server log file.
Or you can send requests to an application and check the response/content, see https://mmonit.com/monit/documentation/monit.html#HTTP
Send an alert if you get an unexpected response, for http and https also.
Send an alert if you get an expected response.
A suggestion based on your sample.
An alert will send, if you receive the expected error text for the request.
Based on your sample the following host check will send an alert all the time one of the expected messages are in the response.
Each test try to connect to port 80 and 443 with the proper protocol, send a request and check the content of the response. If the response match to the content an alert will send.
And based on a Wordpress example the status is handled also.
The status send by the broken link sample is 404.