monit-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [monit-dev] Add a hostheader option to monit's http check.


From: Jan-Henrik Haukeland
Subject: Re: [monit-dev] Add a hostheader option to monit's http check.
Date: Thu, 01 Oct 2009 03:55:44 +0200

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. =)





reply via email to

[Prev in Thread] Current Thread [Next in Thread]