Xymon Mailing List Archive search

Any way to do http tests with HEAD request?

list Japheth Cleaver
Mon, 13 Apr 2015 19:30:47 -0700
Message-Id: <user-10315ac262d8@xymon.invalid>

Thinking about it, this might be something that's not too difficult to add
into xymonnet either. A HEAD is basically just a GET from the poller's
perspective, and any evaluation on body contents (or lack thereof) is
semantically identical to the configuration options available now.

An open question is what the best way to indicate that this is a
"HEAD-only" test would be.

It could be something applied to the entire host line (like browser=),
made into a separate column (similar to httpstatus= or post=, except
without the... POST), or another per-URL protocol specifier similar to how
the TLS/SSL configuration is handled.

(I could see use cases for all three, although I think the middle option
might be the most manageable.)


For now, however, this is something that would need to be handled via an
external script.


Regards,

-jc


On Mon, April 13, 2015 1:45 pm, Andrew Rakowski wrote:
Thanks for the reply Jeremy.  I thought about making a "httphead" test in
the protocols.cfg file, and using the "curl" utility to do what BigBrother
used to do, but I don't see how to pass the URL to the test.

Is there some implicit passing of test URL to these protocols.cfg defined
tests (like the string from the hosts.cfg file is stuck at the end of the
invoked command taken from protocols.cfg?)  I don't see any examples in
the file, and it looks like everything just sends canned strings.

In this case, I'd want to run the "curl" command like this:

     /usr/bin/curl -g -s -S -m 45 -I -k --connect-timeout 15

with the URL taken from the hosts.cfg line, which looks like this:

     0.0.0.0         xyz-web2 # noconn --timeout=15
https://xyz.somewhere.com/xyz/portal/user/anon/js_peid/123456789/panel/Main/template/content

so that webpage could be tested by the curl utility, which is configured
to send only a "HEAD" request to the web server (the '-I' option.)  That
curl command is what was being used in BigBrother.

Cheers,

-Andrew


On Thu, 9 Apr 2015, Jeremy Laidman wrote:
On 10 April 2015 at 11:19, Andrew Rakowski <user-00c59fc5f1d5@xymon.invalid> wrote:
      I didn't understand why nobody was complaining previously, until I
saw that BigBro
      was set up to use the "curl" command with the "-I" option (aka the
"--head" option)
      to send a "HEAD" request to the server.  The BigBro web test used
this setting:


This was one of the problems with BigBro - it forked to external
programs to do the probes which
doesn't scale, whereas xymonnet does it all internally.

Alas, xymonnet sends either a POST or a GET request, and this cannot be
modified by
configuration.

I can see two options for you.  One is to do your own curl/wget call
with a HEAD request, in a
script.  The other option is to define your own "http" protocol
definition in protocols.cfg and
use that.  You would probably need to name it something other than
"http" otherwise xymonnet
will use its internal protocol code rather than what's defined in
protocols.cfg.

J