cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
2474
Views
0
Helpful
4
Replies

ACE and the app_offline.htm ASP File

melcara
Level 1
Level 1

We are using the app_offline.htm file to take servers down for maintainence.  I know we can manually take the RSERVER out of service, but the actuall objective is to keep the server up, and let the ASP page return the message to user. 

So the app_offline.htm file causes IIS to shut down the website and only return the content of the app_offline.htm.

Here is a blog post I found about the app_offline.htm file.

http://weblogs.asp.net/scottgu/archive/2005/10/06/426755.aspx

Is there some way the ACE can handle this error better?

4 Replies 4

Marko Leopold
Level 1
Level 1

Hello Cody!

The hint is "backup server". You can look for it in the documentation to find out about it. If you cant find out how to configure it by yourself we can help you with it.

Cheers,

Marko

I think the backup server featur almost will do what I am looking for.  in talking with one of my Cisco SE's, I expanded on what we are looking for and I wrote psuedo code to describe the probe we would like to make.

Here is what I gave to my SE.

-- SUMMARY STATEMENT

The customer is using ASP.NET for the web application.  One of the features within ASP.NET is called "APP OFFLINE".  This feature allows the administrator to take the ASP application offline by simply putting a file called "app_offline.htm" in the root directory of the web application.  In short, the "APP OFFLINE" does not take the web service down, only the ASP application.  This results in basic HTML files can still respond correctly, while any ASP requests are redirected to "app_offline.htm" page and an HTTP 503 code is returned.  The administrator can then put a message to user indicating the app in down for maintenance.  So the custom probe that needs to be created would first check a page called "PING.ASPX" and would expect a 200-202 or 300-304, all is well.  If the response code is a 503 or a timeout, then send a probe to "app_offline.htm" and expect a 200-202, 300-304, or 503.  If the response to the 2nd probe fails, then send a probe to "PING.HTM", if that probe returns a  200-202, 300-304, then all is well, but if not, then and only then should the ACE remove the RSERVER from the ServerFarm. 

--  PSEUDO CODE

Send http get /PING.ASPX

If ( response equals  200-202, 300-304) { SITE IS UP }

else if (response equals 503 OR response timeout) {

      Send http get /APP_OFFLINE.HTM

      If ( response equals  200-202, 300-304) { SITE IS UP }

      else if (response equals 503 OR response timeout) {

           Send http get /PING.HTM

           If ( response equals  200-202, 300-304) { SITE IS UP }

           Else { SITE IS DOWN }

      }

}

melcara
Level 1
Level 1

so here is a copy of the TCL Script I wrote, now I need to add HTTP functionality to it...

any ideas...

#!name = HTTP_PROBE_SCRIPT

##################################################################################################

#

# Description :

#    This script checks 3 user defined URLS.

#    Should any one of the 3 reture a http code 200-203, or 300-303

#    the ACE will put the RSERVER into an operational STATE

#   

# Pamapaters :

#           The first URL to check

#           The second URL to check

#           The third URL to check

#           file type expected e.g text

#          [debug]          optional debug flag

#

# Example config :

#   probe httpProbe script

#         script HTTP_PROBE_SCRIPT ping1.htm ping2.htm ping3.htm html 0

#

# Version 0.01B

#

# Copyright (c) 2012 by CUST NAME

#####################################################################

#-------------------------------------------

# debug procedure

# set the EXIT_MSG environment varaible to help debug

# also print the debug message when debug flag is on

#-------------------------------------------

proc set_exit_msg { msg } {

    global debug ip port EXIT_MSG

    set EXIT_MSG $msg

    if { [ info exists ip ] && [ info exists port ] } {

set EXIT_MSG "[ info script ]:$ip:$port: $EXIT_MSG "

    } 

    if { [ info exists debug ] && $debug } {

puts $EXIT_MSG

    }

}

proc http_probe { ip port Header FileType debug } {

    if { $debug == "" } {

set debug 0

    }

    set rc [catch {set sock [ socket $ip $port ]} ]

    fconfigure $sock -buffering none -eofchar {}

    if {$rc == 0} \

    {

        set_exit_msg "SOCKET OPEN"

fconfigure $sock -buffering none -eofchar {}

#  send http requeset to server

set_exit_msg "sending request : $Header"

puts -nonewline $sock "$Header\n\n"

flush $sock

#  read string back from server

set_exit_msg "receiving response"

set lines [ read $sock ]

#  close connection

set_exit_msg "closing socket"

close $sock

return $lines

    } else {

        set_exit_msg "probe fail : can't find status code"

exit 30002

    }

    # This is the last line in the proc http_probe

}

#-------------------------------------------

# main

#-------------------------------------------

# parse cmd line args and initialize variables

set_exit_msg "initializing varaible"

if { $argc <  4 } {

    set_exit_msg "[ info script ] parameters : "

    exit 30002

}

###  Vars change to test script locally

set ip $scriptprobe_env(realIP)

set port $scriptprobe_env(realPort)

# if port is zero the use well known http port 80

if { $port == 0} {

    set port 80

}

#set requestHeader [ lindex $argv 0 ]

set url1 [ lindex $argv 0 ]

set url2 [ lindex $argv 1 ]

set url3 [ lindex $argv 2 ]

set expectFileType [ lindex $argv 3 ]

set debug [ lindex $argv 4 ]

set test_num 1

set url $url1

set requestHeader "GET /$url1 HTTP/1.0"

puts "starting to run program\n"

puts "$requestHeader \n"

set url1_lines [http_probe $ip $port $requestHeader $expectFileType $debug ]

#  parsing http  response to decide if probe success or failed

#  all the following condition casing probe faile. should return exit 30002

#

puts "test$test_num\n - TESTING $url"

incr test_num 1

if { ![ regexp -nocase "^HTTP/1\.\[0-9\] (\[0-9\]\[0-9\]\[0-9\])" $url1_lines match url1_statuscode ] } {

    puts "probe fail : can't find status code"

    exit 30002

} elseif { ![ regexp {(20[0-3])|(30[0-3])} $url1_statuscode ]} {

    puts "test$test_num - $url $url1_statuscode\n"

    incr test_num 1  

    set_exit_msg "$url probe fail : status code is $url1_statuscode"   

    set url "$url2"

    set requestHeader "GET /$url HTTP/1.0"

    set url_lines [http_probe $ip $port $requestHeader $expectFileType $debug ]

    if { ![ regexp -nocase "^HTTP/1\.\[0-9\] (\[0-9\]\[0-9\]\[0-9\])" $url_lines match url_statuscode ] } {

set_exit_msg "probe fail : can't find status code"

exit 30002

    } elseif { ![ regexp {(20[0-3])|(30[0-3])} $url_statuscode ]} {

incr test_num 1

# "url fail - try next URL

set_exit_msg "$url probe fail : status code is $url_statuscode"

unset url_statuscode

unset url_lines

# START 2ND DETAIL PROBE

set url "$url3"

set requestHeader "GET /$url HTTP/1.0"

set url_lines [http_probe $ip $port $requestHeader $expectFileType $debug ]

if { ![ regexp -nocase "^HTTP/1\.\[0-9\] (\[0-9\]\[0-9\]\[0-9\])" $url_lines match url_statuscode ] } {

    set_exit_msg "probe fail : can't find status code"

    exit 30002

} elseif { ![ regexp {(20[0-3])|(30[0-3])} $url_statuscode ]} {

    # "test$test_num - $url $url_statuscode\n"

    set_exit_msg "$url fail - THIS IS THE END"

    exit 30002

} else {

    set_exit_msg "test$test_num - $url $url_statuscode\n"

    incr test_num 1

    #  Everything went fine. probe exit with success exit_code 30001

    puts "probe to $url passed\n"

    exit 30001   

}

# End of double nested test

    } else {

incr test_num 1

#  Everything went fine. probe exit with success exit_code 30001

set_exit_msg "probe to $url passed\n"

exit 30001   

    }

} else {

    #  Everything went fine. probe exit with success exit_code 30001

    puts "probe to $url passed\n"

    exit 30001   

}

melcara
Level 1
Level 1

So the final task I did was set this probe on the HTTP serverfarm and also add a basic HTTPS probe.  All works great...

Getting Started

Find answers to your questions by entering keywords or phrases in the Search bar above. New here? Use these resources to familiarize yourself with the community: