I am using the following config for monit
set daemon 30
check process varnish with pidfile /var/run/varnishd.pid
if failed host www.hatchedbyyolk.com port 80 protocol http
and request "/monit-check-url"
then exec "/root/scripts/varnish_restart.sh"
set httpd port 2812 and
use address localhost
allow localhost
monit starts just fine, but monit status
shows the following
Process 'varnish'
status Does not exist
monitoring status monitored
data collected Sun Oct 13 00:37:03 2013
For some unknown reason the start and stop commands have no effect on varnish so I use this script which is in /root/scripts/varnish_restart.sh
#! /bin/sh
killall varnishd
varnishd -f /etc/varnish/default.vcl -s malloc,1G -a 0.0.0.0:80
Needless to say something is wrong and Varnish does not restart itself.
What does "Does not exist" mean in this context for the status?
Have I missed something?
EDIT
I have just checked too that the PID in the /var/run/varnish.pid file does not match any PID I can see in top
Best Answer
The PID file won't match the running process since you aren't using the init script - it's not being written to on the service's start.
For the PID file to be updated, you should add
-P /var/run/varnish.pid
to yourvarnishd
command line -- or better, figure out why the init script isn't working and fix it.