Gerrit,

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

check host myhost with address example.com <http://example.com/>
    if failed port 443
        send "GET /directory_name HTTP/1.1\r\nHost: example.com 
<http://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 
<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 
> <http://user:address@hidden/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 
> <http://192.168.160.111/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
> 
--
To unsubscribe:
https://lists.nongnu.org/mailman/listinfo/monit-general

Reply via email to