|
From: | Marcus Mülbüsch |
Subject: | Re: Not using method "HEAD" for connection testing |
Date: | Mon, 1 Aug 2016 15:11:51 +0200 |
User-agent: | Mozilla/5.0 (Windows NT 6.1; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.2.0 |
Am 28.07.2016 um 14:49 schrieb Martin Pala: Hello Martin
the send/expect statement is not allowed in the http protocol context (it is part of "generic" protocol test only), but monit didn't throw a syntax error in such case (fixed: https://bitbucket.org/tildeslash/monit/commits/27210ed610ba/).
Ah. I didn't know that. Thank you.
Regarding the HEAD vs. GET method ... the http protocol test uses the HEAD method unless the content test or content checksum is set as part the http protocol - the the GET is used automatically, as the content is required for these tests.
That makes a lot of sense. And it would solve my problems nicely. So I just have to expect some content (even if nothing) and monit then switches to "GET" and thus my test succeeds.
So I use the following statement to for http-replicator and it works:
if failed port 8080 protocol http with content = '' then alert
Nice. Thank you. (I think a line or two in the manual would be appropriate ;) )
> We can implement a new option for the http protocol, which will allow > to override the http method (such as GET/POST), even if no content is > required automatically.I don't think this is actually necessary, given that you can test for empty content as above ;)
However:
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==] with content != 'type="alarm"' then alert
does not work. I get an 401:
monit[10931]: 'pbx' failed protocol test [HTTP] at [11.22.33.44]:443/LOG0/FAULT/mod_cmd.xml?cmd=xml-alarms&xsl=alarm_log.xsl [TCP/IP SSL] -- HTTP error: Server returned status 401
However, I doubt that this is the wrongdoing of monit, since an apache server works well. I will get in touch with innovaphone and get back to you, if I still need help.
Again, thank you. Marcus
On 28 Jul 2016, at 13:07, Marcus Mülbüsch <address@hidden> wrote: 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/) withif failed port 8080 protocol http then alerthttp-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: closeI 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 alertIs 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 alertHowever, 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 -- To unsubscribe: https://lists.nongnu.org/mailman/listinfo/monit-general-- To unsubscribe: https://lists.nongnu.org/mailman/listinfo/monit-general
-- Marcus Mülbüsch Systemadministration fon: +49 (0)208 9898 98-49 fax: +49 (0)208 9898 98-949 _______________________________________ AS-Infodienste GmbH Timmerhellstr. 39 45478 Mülheim mail: address@hidden web: www.as-infodienste.de fb: www.facebook.com/ASInfodienste Kontakt zum Telefonsupport für Servicerufnummern: +49 (0)208 9898 98-11 Telefonsekretariat: +49 (0)208 9898 98-12 SMS-Dienstleistungen: +49 (0)208 9898 98-13 Telefonkonferenzen: +49 (0)208 9898 98-17 Unternehmenszentrale: fon: +49 (0)208 9898 98-00 fax: +49 (0)208 9898 98-900 _______________________________________ Unternehmensangaben: Die AS-Infodienste GmbH ist im Handelsregister des AG Duisburg unter HRB 16061 registriert. Geschäftsführer: Andreas Schlacht USt.-ID: DE 813295188 St.-Nr.: 120/5742/0589 ________________________________________ Wir nutzen klimafreundlichen Ökostrom von NATURSTROM. Damit leisten wir einen Beitrag zum Umweltschutz.
[Prev in Thread] | Current Thread | [Next in Thread] |