monit-general
[Top][All Lists]
Advanced

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

Re: check URL with basic auth


From: Tino Hendricks
Subject: Re: check URL with basic auth
Date: Wed, 26 Aug 2015 15:39:21 +0200

Gerrit,

I for myself only check the availability of the _login_procedure_, like

check host myhost with address example.com
    if failed port 443
send "GET /directory_name HTTP/1.1\r\nHost: example.com:443\r\n\r\n"
expect "HTTP/[0-9\.]{3} 401 .*Authorization.*"
timeout 20 seconds for 2 times within 3 cycles then alert

Works like a charm but YMMV!

Or I’d go for a script and check the output as described here:
https://mmonit.com/monit/documentation/monit.html#PROGRAM-STATUS-TESTING

Best,

Tino

Hi all,

I need to check the availability of a web page that requires basic auth.
The best thing I could come up with so far looks like this:

---
if failed url http://user:address@hidden:80/doc/Main_Display.html
then alert
---


This would probably work, but in my case both the username and the
password are empty (yes, I know that's stupid, but I cannot change it).
However, when using

---
if failed url http://:@192.168.160.111:80/doc/Main_Display.html then alert
---

monit complains about the syntax:

---
fe1 # monit -t
/etc/monit.d/host.conf:3: syntax error ':'
---

Please note that curl with --user set to ":" fetches this page just fine,
so I could go for an external script. However, it looks like this is merely
some kind of parsing issue. Is there a way to make the URL work inside
monit? My monit version is 5.12.2 (if that matters).


cu
  Gerrit


reply via email to

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