Heh - dude, that wasn't supposed to be the *whole* script... :)<br><br>If that one was useful, here's something that may be a bit better. I added a timeout for curl, otherwise it'll wait for a long time if the server doesn't respond. Also, this format produces a message formatted just like Xymon's internal http test, including the time taken to grab the headers. You could extract the "Seconds" line to determine if the response is a bit slow. With a bit more magic in Xymon's configs, you could even graph it...<br>
<br>Ralph Mitchell<br><br>============= cut here ============<br>#!/bin/sh<br><br>TESTHOST=<a href="http://www.google.com">www.google.com</a><br>TESTURL=http://$TESTHOST/<br><br>TIMEOUT=30<br><br># Grab *just* the headers, simulating Xymon's builtin http check<br>
MESSAGE=`curl -x <a href="http://ourproxy.ourdomain.com:8080">http://ourproxy.ourdomain.com:8080</a> \<br> --proxy-anyauth -U hobbituser:hobbitpassword \<br> -m $TIMEOUT \<br> -w 'Seconds: %{time_total}\n' \<br>
-s -S -L -I $TESTURL | $GREP -v Set-Cookie`<br><br>if [ "$?" -eq "0" ]; then<br> COLOR=green<br>else<br> COLOR=red<br>fi<br><br># convert dots to commas in the hostname<br>MACHINE=`echo $TESTHOST | $SED -e 's/\./\,/g'<br>
<br>$BB $BBDISP "status $MACHINE.home $COLOR `date`<br><br>$MESSAGE"<br>============= cut here ============<br><br><br><br><div class="gmail_quote">On Sun, Nov 23, 2008 at 9:04 PM, Everett, Vernon <span dir="ltr"><<a href="mailto:Vernon.Everett@woodside.com.au">Vernon.Everett@woodside.com.au</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<div>
<div dir="ltr" align="left"><span><font color="#0000ff" size="2" face="Arial">Hi Ralph</font></span></div>
<div dir="ltr" align="left"><span><font color="#0000ff" size="2" face="Arial"></font></span> </div>
<div dir="ltr" align="left"><span><font color="#0000ff" size="2" face="Arial">This script works a treat.</font></span></div>
<div dir="ltr" align="left"><span></span><span><font color="#0000ff" size="2" face="Arial"></font></span> </div>
<div dir="ltr" align="left"><span><font color="#0000ff" size="2" face="Arial">Thanks</font></span></div>
<div dir="ltr" align="left"><span><font color="#0000ff" size="2" face="Arial"> Vernon</font></span></div><br>
<div dir="ltr" align="left" lang="en-us">
<hr>
<font size="2" face="Tahoma"><b>From:</b> Ralph Mitchell
[mailto:<a href="mailto:ralphmitchell@gmail.com" target="_blank">ralphmitchell@gmail.com</a>] <br><b>Sent:</b> Saturday, 22 November 2008
12:23 AM<br><b>To:</b> <a href="mailto:hobbit@hswn.dk" target="_blank">hobbit@hswn.dk</a><br><b>Subject:</b> Re: [hobbit] Testing
external web through a proxy<br></font><br></div><div><div></div><div class="Wj3C7c">
<div></div>Looks like your proxy requires authentication via Kerberos or NTLM or
GSS-Negotiate. Dunno if Xymon can do those. Luckily the curl tool
(httpp://<a href="http://curl.haxx.se" target="_blank">curl.haxx.se</a>) *can* do those...
I haven't had to use them, but it should not be too hard to bang out an ext
script to do the check. Something along these
lines:<br><br> #!/bin/sh<br>
curl -x <a href="http://ourproxy.ourdomain.com:8080" target="_blank">http://ourproxy.ourdomain.com:8080</a>
\<br>
--proxy-anyauth -U hobbituser:hobbitpassword
\<br> -s -S -L -o
/dev/null <a href="http://www.google.com/" target="_blank">http://www.google.com/</a><br>
if [ "$?" -eq "0" ]; then<br>
COLOR=green<br> MESSAGE="Pinged Google
OK"<br> else<br>
COLOR=RED<br> MESSAGE="Failed to reach
Google"<br> fi<br> $BB $BBDISP
"status www,google,com.home $COLOR `date`<br>$MESSAGE"<br><br>Obviously that can
be expanded quite a lot... :) Drop it somewhere on your Xymon server
(maybe in server/ext) and set up a block in server/etc/hobbitlaunch.cfg to fire
it off as often as you want. You may need to give the full path for curl,
which is probably /usr/bin/curl.<br><br>Ralph Mitchell<br><br><br>
<div class="gmail_quote">On Fri, Nov 21, 2008 at 1:30 AM, Everett, Vernon <span dir="ltr"><<a href="mailto:Vernon.Everett@woodside.com.au" target="_blank">Vernon.Everett@woodside.com.au</a>></span>
wrote:<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<div><font size="2" face="Arial, sans-serif">
<div>Hi all</div>
<div> </div>
<div>I am trying to test our interent connectivity by checking Google through
our proxy.</div>
<div>(Once I get this right, I want to start testing some of our external web
pages in the same manner)</div>
<div> </div>
<div>I have configured this in bb-hosts</div>
<div><a href="http://0.0.0.0" target="_blank">0.0.0.0</a> <a href="http://www.google.com" target="_blank"><font color="#0000ff"><u>www.google.com</u></font></a>
# noconn <a href="http://hobbituser:hobbitpassword@ourproxy.ourdomain.com:8080/http://www.google.com" target="_blank"><font color="#0000ff"><u>http://hobbituser:hobbitpassword@ourproxy.ourdomain.com:8080/http://www.google.com</u></font></a></div>
<div> </div>
<div>And I get this.</div>
<div><font face="Courier New, monospace"><a href="http://hobbit/hobbit/gifs/yellow.gif" target="_blank"><font color="#0000ff"><u>yellow</u></font></a> <a href="http://www.google.com.au/" target="_blank"><font color="#0000ff"><u>http://www.google.com.au/</u></font></a>
- Proxy Authentication Required<br><br>HTTP/1.1 407 Proxy Authentication
Required ( The ISA Server requires authorization to fulfill the request.
Access to the Web Proxy filter is denied. )<br>Via: 1.1 <font face="Courier New, monospace">PXYHOSTNAME<br></font>Proxy-Authenticate:
Negotiate<br>Proxy-Authenticate: Kerberos<br>Proxy-Authenticate:
NTLM<br>Connection: Keep-Alive<br>Proxy-Connection: Keep-Alive<br>Pragma:
no-cache<br>Cache-Control: no-cache<br>Content-Type:
text/html<br>Content-Length: 4118
<br><br>Seconds: 0.02</font></div>
<div><font face="Courier New, monospace"></font> </div>
<div>Any assistance appreciated.</div>
<div> </div>
<div>Regards</div>
<div> Vernon</div>
<div> </div></font><pre>NOTICE: This email and any attachments are confidential.
They may contain legally privileged information or
copyright material. You must not read, copy, use or
disclose them without authorisation. If you are not an
intended recipient, please contact us at once by return
email and then delete both messages and all attachments.
</pre></div></blockquote></div><br><pre>NOTICE: This email and any attachments are confidential.
They may contain legally privileged information or
copyright material. You must not read, copy, use or
disclose them without authorisation. If you are not an
intended recipient, please contact us at once by return
email and then delete both messages and all attachments.
</pre></div></div></div>
</blockquote></div><br>