Contents

This script pings the serverAddress. If the address does not respond,
the script exits and flags the service as dying/down. If the server is up but
all the ports are down, the server is marked as dying/down. Each of the virtual
ports of the server are tested. If any fail, a message is logged, but the
service is not marked as down. This document also addresses the 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 the
WebNS 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 in
order to provide a reliable ALIVE or
DOWN state of a service. Without the scripted
keepalive functionality, you are currently limited to FTP, HTTP, ICMP, and TCP.
However, with scripted keepalives you can remain on top of the current
protocols when you write your own scripts. For example, you can develop a
script specifically toned to connect to a POP3 server without requiring WebNS
to build a keepalive type POP3. This feature allows customers to create their
own custom keepalives in order to suit their specific requirements. Although
this is a component of the Content Services Switch (CSS), custom scripts are
not supported by Cisco Technical Support.

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

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.

!--- No echo.
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!--- Filename: ap-kal-virtual
!--- Parameters: serverAddress serverPort1 [serverPort2...]
!
!--- Description:
!--- This script pings the serverAddress. If the address
!--- does not respond, the script exits and flags the
!--- service as dying/down.
!--- If the server is up but all the ports are down, the
!--- server is marked as dying/down.
!--- Each of the server's virtual ports are tested. If any
!--- fail, a message is logged, but the service is not
!--- marked as down.
!
!--- 1.0 - 03/20/02 KGS: Initial version (Tested)
!--- 1.1 - 03/27/02 KGS: Added check for out of sockets condition
!--- Added die on all ports down (tested).
!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!--- Make sure there are enough arguments.
if ${ARGS}[#] "LT" "2"
echo "Usage: ap-kal-virtual \'servAddress1 servPort1 [servPort2 servPort3...]\'"
exit script 1
endbranch
!--- Defines.
set NO_SOCKETS "785"
set NO_CONNECT "774"
!--- Set up variables.
set serverAddress "${ARGS}[1]"
var-shift ARGS
set portList "${ARGS}"
!--- Test the server.
set EXIT_MSG "Ping failure of ${serverAddress}"
ping ${serverAddress}
no set EXIT_MSG
set anyPortUp "0"
while ${portList}[#] "GT" "0"
!--- Test the ports that the virtual servers are on.
set CONTINUE_ON_ERROR "1"
socket connect host ${serverAddress} port ${portList}[1] tcp
set Result "${STATUS}"
socket disconnect ${SOCKET}
set CONTINUE_ON_ERROR "0"
!--- If out of sockets, warn the operator.
if Result "==" "${NO_SOCKETS}"
cliLogMessage subsystem netman "KAL Scripts: Out of sockets. Try increasing KAL
frequency." level warning-4
endbranch
!--- If a port does not open, log it.
if Result "==" "${NO_CONNECT}"
cliLogMessage subsystem netman "Virtual server on ${serverAddress}:${portList}[1]
did not respond." level critical-2
endbranch
!--- Check to make sure at least one port is up.
if Result "==" "0"
set anyPortUp "1"
endbranch
var-shift portList
endbranch
!--- If no ports are up, the service should die.
if anyPortUp "==" "0"
set EXIT_MSG "Virtual server on ${serverAddress} was up, but no ports were alive."
exit script 1
endbranch
exit script 0