Add "Check URL" monitor to System and Server Status

I am trying to implement the similar check described on http://www.computerminds.co.uk/articles/monitoring-varnish using only Virtualmin's "System and Server Status" feature without installing Monit.

Adding the following lines to "default.vcl" file works perfectly well:

sub vcl_recv {
  # Change this URL to something that will NEVER be a real URL for the hosted
  # site, it will be effectively inaccessible.
  if (req.url == "/monit-check-url-qwertyuiop") {
    error 200 "Varnish up";
  }
}

and checking it with:

curl -s --head 127.0.0.1:80/check-url-qwertyuiop | head -n 1

gives:

HTTP/1.1 200 Varnish up

Would be very nice if Virtualmin could also check URLs and execute restart command depending of the URL check - if it returns "HTTP/1.1 200" then do nothing, but if returns "HTTP/1.1 301" then restart command, in this case Varnish deamon.

Thanks for consideration!

Status: 
Closed (fixed)

Comments

This is already possible - the System and Server Status module has a "Remote HTTP Service" monitor type, and you can enter a command to run if the URL fetch fails.

Edit: Tests proved everything works as desired, thank you very much!

Automatically closed -- issue fixed for 2 weeks with no activity.

Automatically closed -- issue fixed for 2 weeks with no activity.