monit-general
[Top][All Lists]
Advanced

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

Not using method "HEAD" for connection testing


From: Marcus Mülbüsch
Subject: Not using method "HEAD" for connection testing
Date: Thu, 28 Jul 2016 13:07:53 +0200
User-agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.2.0

Hello list,

when monit does connection testing it uses the method "HEAD", which is fine for it causes less traffic.

However, some services don't send http-headers, so this method will fail.

For example, when checking http-replicator (https://sourceforge.net/projects/http-replicator/) with

if failed
        port 8080
        protocol http
then alert

http-relicator responds with a 503 and monit raises an alarm. Here is its logfile:

  HEAD / HTTP/1.1
  connection: close
  host: localhost:8080
  accept: */*
  user-agent: Monit/5.17.1

27 Jul 2016 16:54:51 DEBUG: HttpClient 1 received header:

  HTTP/1.1 503 Service Unavailable
  date: Wed, 27 Jul 2016 14:54:51 GMT
  connection: close

I changed the method by sending a "GET", so http-replicator responds with something (if running) and monit alerts only on true failures:

# !!! use 'send "GET"...' else monit uses method "HEAD" which http-replicator 
does not respond well to!
if failed
        port 8080
        protocol http
        send "GET / HTTP/1.1"
then alert

   Is there a better way to achieve this?

I now have the problem that I want to monitor the alarm-log of my innovaphone telephone system which is readable via authenticated https and responds with an xml file. So to access the alarm-log I use a monit configuration of:

check host pbx with address 11.22.33.44
if failed
        port 443
        protocol https
        request "/LOG0/FAULT/mod_cmd.xml?cmd=xml-alarms"
        use http headers [Authorization: Basic blabla==]
        send "GET / HTTP/1.1"
        with content != 'type="alarm"'
then alert

   However, that doesn't work as expected.

If I drop the "send" line, the telephony system responds with a 404 (there's no header in the xml).

   If I use the send line it seems as monit does not evaluate the content?

   I artificially created an alarm and the system now responds with

https://11.22.33.44/LOG0/FAULT/mod_cmd.xml?cmd=xml-alarms

<alarms>
        <fault type="alarm" severity="1" active="true" code="0x00010002" date="1469703580" 
time="28.07.2016-12:59:40" xsl="fault_phone.xsl" handle="744">
                <text>Registration down (timeout)</text>
                <source>PHONE/SIG/REG2</source>
                <remote addr="1.2.3.4" name="IP241-ab-cd-ef"/>
        </fault>
</alarms>

However, monit (given the above configuration) does not raise an alarm? Am I doing something wrong, or is monit at fault here?

Marcus





reply via email to

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