Monit: How to optimally monitor an URL
I do not want to monitor the nginx process here, but the ports/URLs. Can I use any other check instead of check process?
you can use the host check, this is an example from the monit site:
check host mmonit.com with address mmonit.com
if failed
port 80 protocol http
with http headers [Host: mmonit.com, Cache-Control: no-cache, Cookie: csrftoken=nj1bI3CnMCaiNv4beqo8ZaCfAQQvpgLH]
and request /monit/ with content = "Monit [0-9.]+"
then alert
To do different actions after 1 fail, 2 fails, and 4 fails, I need three if failed conditions, resulting in three server requests. Is there any way to run one request per cycle and perform different activities after a different number of fails?
EXEC can be used to execute an arbitrary program and send an alert. If you choose this action you must state the program to be executed and if the program require arguments you must enclose the program and its arguments in a quoted string. You may optionally specify the uid and gid the executed program should switch to upon start. For instance:
exec "/usr/local/tomcat/bin/startup.sh"
as uid nobody and gid nobody