Hi Brady, this looks like a fine patch. The thing is, this is kind of
implemented already. If the purpose is to add a Host header to the
request sent to test a virtual host, Monit will use the name of the
host in the if-failed statement and use this as the Host-header. For
instance, if you use:
if failed host www.tildeslash.com port 80 then alert
Monit will set a host-header using the hostname, www.tildeslash.com.
So if you want to test all virtual hosts used by the server one can
simply add a new if-test:
check process httpd with pidfile "/var/run/httpd.pid"
start..
stop..
if failed host www.tildeslash.com port 80 then alert
if failed host www.mmonit port 80 then alert
if failed host www.somethingelse.foo port 80 then alert
Jan-Henrik
On 1. okt. 2009, at 02.58, Brady wrote:
Hello,
Hopefully this is the right approach for patch submission. This
patch adds support for a Host: header in the http process check
module. This allows the checking of an apache instance that serves
virtual hosts but throws
a 404 or other such error on the default host.
I did a cursory test on this using the config:
check process test with pidfile "/tmp/test.pid"
start program = "/bin/bash -c 'echo $$ > /tmp/test.pid ; /usr/bin/
nc -k -l 6000 | tee /tmp/test.txt'"
stop program = "/bin/false"
if failed host localhost port 6000 protocol http and request '/
testing' hostheader 'example.com' with timeout 20 seconds for 2
cycles then restart
This produced the request:
GET /testing HTTP/1.1
Host: example.com
Accept: */*
Connection: close
User-Agent: monit/5.1
Please let me know if you have any comments, questions, or if I have
done this completely wrong. =)
_______________________________________________
monit-dev mailing list
monit-dev@nongnu.org
http://lists.nongnu.org/mailman/listinfo/monit-dev