Daniel,

> We have an application with a web front end and occasionally the application 
> will die but the web server is still running and responding to http probes. 
> When the underlying application dies the web interface will display the 
> message "Service Unavailable".  I know how to check for the phrase "Service 
> Unavailable" using the http probe, but the the host will show as down until 
> the phrase is displayed.  How can I check via an http probe (or any other 
> probe) for the phrase "Service Unavailable" without it showing down all the 
> time?

I modified the standard HTTP probe to swap the exit conditions: if the string 
*is* found, it goes into Warning. If the string's not present, it stays green.

Use File-> Import -> Probe... and select the attached file. It's called Servers 
- Standard/HTTP/HTTP (Don't Match). 

Please get back to me if you have further questions. Thanks.

Rich Brown                    [email protected]
Dartware, LLC                 http://www.intermapper.com
66-7 Benning Street           Telephone: 603-643-9600
West Lebanon, NH 03784-3407   Fax: 603-643-2289

<!-- 
        HTTP (com.dartware.tcp.http-nomatch)
        Copyright © 2000-2003 Dartware, LLC. All rights reserved.
        
        The site is OK as long as the specified string is *not* present.
        26 Sep 2011 Cloned standard HTTP probe to create new "nomatch" probe 
-reb
-->

<header>
        type                    =       "tcp-script"
        package                 =       "com.dartware"
        probe_name              =       "tcp.http-nomatch"
        human_name              =       "HTTP (Don't Match)"
        version                 =       "2.4"
        address_type    =       "IP"
        port_number             =       "80"
        
        display_name    =       "Servers-Standard/HTTP & HTTPS/HTTP (Don't 
Match)"
        url_hint                =       "http://${ADDRESS}:${PORT}/";
</header>

<description>

\GB\HTTP Probe - Search for a string that should not match\P\

The protocol used to transfer web pages on the World Wide Web, defined in 
\U2=http://www.ietf.org/rfc/rfc2068.txt\RFC 2068\P0\ and 
\U2=http://www.ietf.org/rfc/rfc1945.txt\RFC 1945\P0\. The default TCP port 
number for HTTP connections is port 80.

This TCP probe lets you download a specific web page and scan it for a specific 
string of HTML. If the string \i\is\p\ present, then the device goes to a 
warning state.

\i\Host Name\p\ is the domain name of the web server (e.g. "www.dartware.com"). 
This can be derived from the host name part of the URL that you want to test. 
You must enter a valid "Host Name" to test web servers which implement virtual 
hosts. Only add an IP address or domain name; do not add "http://";.

\i\URL Path\p\ is the full path of the desired file on the web server (e.g. 
"/index.html"). The first character must be a '/'.

\i\String to detect\p\ is a string to detect in the data returned by the HTTP 
server.  If the string is present, the device goes to a Warning severity.

\i\User ID\p\ is the user name typed into the web browser's password dialog. 
The default is to leave this blank. You should set this parameter if you want 
to test a web page that requires authentication.

\i\Password\p\ is the password for the web browser's dialog. The default is to 
leave this blank. You should set this parameter if you want to test a web page 
that requires authentication.

</description>

<parameters>

"Host Name"                     =               ""
"URL Path"                      =               "/"
"String to detect"      =               "<HTML"
"User ID"                       =               ""
"Password*"                     =               ""

</parameters>

<script>

CONN #60 (connect timeout in secs)
WAIT #30 @IDLE (idle timeout in secs)
DISC @DISCONNECT (disconnect handler)

STOR "fullURL" "http://";
CHCK "${Host Name}" else goto #+3
SCAT "fullURL" "${Host Name}"
GOTO #+2
SCAT "fullURL" "${_REMOTEADDRESS}"
SCAT "fullURL" ":${_REMOTEPORT}${URL Path}"

SEND "GET ${URL Path} HTTP/1.0\r\n"
CHCK "${Host Name}" else goto #+2
SEND "Host: ${Host Name}\r\n"
SEND "User-Agent: InterMapper/${_VERSION}\r\n"
CHCK "${User ID}${Password*}" else goto #+2
SEND "Authorization: Basic ${_BASE64:${User ID}:${Password*}}\r\n"
SEND "\r\n"
MTCH "HTTP/"i else goto @UNEXPECTED_GREETING
MTCH "200" else goto @BAD_GET_RESPONSE
EXPT "^$"r
LINE OFF
DISC if disconnected goto @NO_MATCH   (added line in 2.1.1b1)
EXPT "${String to detect}"i else goto @NO_MATCH
DONE WARN "[HTTP] WARN \"${String to detect}\" has been found in ${fullURL}"

@IDLE:
DONE DOWN "[HTTP] No data for ${_IDLETIMEOUT} seconds.  Was expecting 
\"${_STRINGTOMATCH}\". (${fullURL})"

@UNEXPECTED_GREETING:
DONE DOWN "[HTTP] Unexpected greeting from port ${_REMOTEPORT}. (${fullURL})"

@NO_MATCH:
DONE OKAY "[HTTP] OKAY \"${String to detect}\" not found in ${fullURL}"

@BAD_GET_RESPONSE:
MTCH "201" ELSE #+2
DONE WARN "[HTTP] 201 Created (${fullURL})"
MTCH "202" ELSE #+2
DONE WARN "[HTTP] 202 Accepted (${fullURL})"
MTCH "204" ELSE #+2
DONE WARN "[HTTP] 204 No Content (${fullURL})"
MTCH "301" ELSE #+2
DONE WARN "[HTTP] 301 Moved Permanently (${fullURL})"
MTCH "302" ELSE #+2
DONE WARN "[HTTP] 302 Moved Temporarily (${fullURL})"
MTCH "304" ELSE #+2
DONE WARN "[HTTP] 304 Not Modified (${fullURL})"
MTCH "400" ELSE #+2
DONE WARN "[HTTP] 400 Bad Request (${fullURL})"
MTCH "401" ELSE #+2
DONE WARN "[HTTP] 401 Unauthorized (${fullURL})"
MTCH "403" ELSE #+2
DONE WARN "[HTTP] 403 Forbidden (${fullURL})"
MTCH "404" ELSE #+2
DONE WARN "[HTTP] 404 Not Found (${fullURL})"
MTCH "500" ELSE #+2
DONE ALRM "[HTTP] 500 Internal Server Error (${fullURL})"
MTCH "501" ELSE #+2
DONE ALRM "[HTTP] 501 Not Implemented (${fullURL})"
MTCH "502" ELSE #+2
DONE ALRM "[HTTP] 502 Bad Gateway (${fullURL})"
MTCH "503" ELSE #+2
DONE ALRM "[HTTP] 503 Service Unavailable (${fullURL})"
DONE ALRM "[HTTP] Unknown Error Code ${_LINE:4} (${fullURL})"

@DISCONNECT:
DONE DOWN "[HTTP] Disconnected from port ${_REMOTEPORT} after ${_SECSCONNECTED} 
seconds. (${fullURL})"

</script>

<script-output>

\B5\HTTP Information\0P\    \U2=http://${devicename}:${_remoteport}\Go to the 
device's web page\P0\
  \4\Time to establish connection:\0\ ${_connect} msecs
  \4\Time spent connected to host:\0\ ${_active} msecs

</script-output>

Reply via email to