I am trying to restart the squid service when it becomes unresponsive by simulating squidclient in a protocol check.
In verbose mode squidclient prints the HTTP request before the response.
$ /usr/local/squid/bin/squidclient -v mgr:info Request: GET cache_object://localhost/info HTTP/1.0 Host: localhost User-Agent: squidclient/3.5.20 Accept: */* Connection: close . HTTP/1.1 200 OK [response truncated]
The control file squid.monitrc looks like this:
check process squid pidfile /usr/local/squid/var/run/squid.pid start program = "/etc/init.d/squid start" timeout 240 seconds stop program = "/etc/init.d/squid stop" timeout 240 seconds if failed port 3128 protocol http http headers [ Host: localhost, User-Agent: squidclient/squidclient/3.5.20, Accept: */*, Connection: close ] request "cache_object://localhost/info" then restart
if failed clause of the
check process statement should produce the same request and restart squid if it doesn't respond normally.
Instead it produces a syntax error:
$ sudo monit validate /etc/monit/conf.d/squid.monitrc:15: syntax error '"cache_object://localhost/info"'
I am testing with monit 5.16 on Ubuntu 16.04. I know monit 5.16 is not in the version list, but it is the latest version packaged by Ubuntu. I don't see anything that would address this in the change log.