Guest

Cisco CSS 11500 Series Content Services Switches

Sample Keepalive Script to Detect any 500 Series Error

Cisco - Sample Keepalive Script to Detect any 500 Series Error

Document ID: 47382

Updated: Jan 31, 2006

   Print

Introduction

This script fails if the service returns any 500 series error for the tested Web page. This document also addresses implementation of scripted keepalives. This method of scripting is most closely related to functionality, which is present in Remote Access Server (RAS) dialup clients, terminal programs, and general scripting utilities. This feature utilizes WebNS's rich scripting language.

Complete with a simple socket Application Program Interface (API) (connect/disconnect/send/receive), a scripted keepalive gives the user the ability to tailor their own protocol, or write their own sequence of steps to provide a reliable ALIVE or DOWN state of a service. Without the scripted keepalive functionality, you are currently limited to FTP, HTTP, Internet Control Message Protocol. (ICMP), and TCP. With scripted keepalives, however, you can remain on top of the current protocols when your own scripts are written. For example, you can develop a script specifically toned to connect to a point of presence three (POP3) server without the requirement of WebNS to build a keepalive type POP3. This feature allows customers to create their own custom keepalives to suit their specific requirements. Although this is a component of the Content Services Switch (CSS), custom scripts are not supported by the Cisco Technical Assistance Center (Cisco TAC).

The scripted keepalives in this document are not officially supported by TAC, but have been tested, and are available for use at your own discretion.

Prerequisites

Requirements

Familiarity with WebNS rich scripting language.

Components Used

The information in this document is based on these software and hardware versions:

  • WebNS versions 3.x and higher

  • CSS 11x00 Series

The information in this document was created from the devices in a specific lab environment. All of the devices used in this document started with a cleared (default) configuration. If your network is live, make sure that you understand the potential impact of any command.

Sample Script

The script as shown here can be used to detect any 500 series error:



!--- No echo.
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 
! 
!--- ap-kal-http-response 
!--- Script exits dying if the service returns any 500 series 
!--- error for the tested Web page.(If FromResp is 500 and ToResp is 599).                                              
!--- Note: This script can be used for any range of response codes.
! 
!--- Last Tested:  KGS 12/17/01 
! 
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 
! 

if ${ARGS}[#] "NEQ" "4" 
  echo "Usage: ap-kal-http-response \'Service WebPage FromResp ToResp\'" 
  exit script 1 
endbranch 

if ${ARGS}[3] "GT" "${ARGS}[4]" 
  echo "ap-kal-http-response:  FromResp \'${ARGS}[3]\' must be less than or equal to 
     ToResp \'${ARGS}[4]\'." 
  exit script 1 
endbranch 


!--- Query the service for the page.

llama 
icp probe service ${ARGS}[1] "${ARGS}[2]" | grep -u "Response" 
set ResponseCode "${UGREP}[3]" 
exit 


!--- If the response is a 50x, send a signal to the service to die. 

if ${ResponseCode} "GTEQ" "${ARGS}[3]" 
  if ${ResponseCode} "LTEQ" "${ARGS}[4]" 
    set EXIT_MSG "Service ${ARGS}[1] returned the error code [${ResponseCode}]." 
    exit script 1 
  endbranch 
endbranch 
exit script 0

Related Information

Updated: Jan 31, 2006
Document ID: 47382