1

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

Jake N
  • 243
  • 2
  • 3
  • 9

1 Answers1

3

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 your varnishd command line -- or better, figure out why the init script isn't working and fix it.

Shane Madden
  • 112,982
  • 12
  • 174
  • 248
  • that has worked perfectly. Now on to the overarching issue. Any ideas on why Varnish's init may not work for me? – Jake N Oct 13 '13 at 09:42
  • @jakenoble Good question. On the RHEL init script I had some problems with it suppressing errors by sending output to `/dev/null` - take a look for something like that in your init script and comment it out, then see if you get any better output? – Shane Madden Oct 13 '13 at 18:11