Skip to content

Instantly share code, notes, and snippets.

@eksiscloud
Last active October 21, 2019 01:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save eksiscloud/76aa756a4a2456815e5b053ccacdf1df to your computer and use it in GitHub Desktop.
Save eksiscloud/76aa756a4a2456815e5b053ccacdf1df to your computer and use it in GitHub Desktop.
Monit conf for a host/domain/site
### example.tld
check host example.tld with address www.example.tld
# ICMP check
if failed icmp type echo
for 2 times within 2 cycles
then alert
# HTTP check
if failed port 80 protocol http
with http headers [Host: www.example.tld, Cache-Control: no-cache]
and request / with content = "www.example.tld"
then alert
# HTTPS check
if failed port 443 type tcpSSL protocol http
with http headers [Host: www.example.tld, Cache-Control: no-cache]
and request / with content = "www.example.tld"
then alert
@eksiscloud
Copy link
Author

/etc/monit/conf.d/

@eksiscloud
Copy link
Author

eksiscloud commented Oct 21, 2019

host = just an unique name, not a real host
address = real URL

Varnish:
touch /var/www/example.tld/public_html/pong
nano /var/www/example.tld/public_html/pong
add what ever you have as content; here: www.example.tld
nano /etc/varnish/default.vcl
add:
if (req.url ~ "/pong") {
return (pass);
}
systemctl reload varnish
nano /etc/monit/conf.d/sites
change:
and request /pong with content = "www.example.tld"
systemctl restart monit

And now you can monitor downtime with Varnish.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment