Chapter 8 Using the CSS Scripting Language
Script Keepalive Examples
8-62
Cisco Content Services Switch Administration Guide
OL-5647-02
if ${ARGS}[#] “NEQ” “3”
echo “Usage: ap-kal-httptag \'Hostname WebPage HostTag\'”
exit script 1
endbranch
! Defines:
set HostName “${ARGS}[1]”
set WebPage “${ARGS}[2]”
set HostTag “${ARGS}[3]”
! Connect to the remote Host
set EXIT_MSG “Connection Failure”
socket connect host ${HostName} port 80 tcp
! Send the GET request for the web page
set EXIT_MSG “Send: Failed”
socket send ${SOCKET} “GET ${WebPage} HTTP/1.0\nHost: ${HostTag}\n\n”
! Wait for a good status code
set EXIT_MSG “Waitfor: Failed”
socket waitfor ${SOCKET} “200 OK”
no set EXIT_MSG
socket disconnect ${SOCKET}
exit script 0
Mailhost Keepalive
!no echo
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
! Filename: ap-kal-mailhost
! Parameters: HostName UserName Password
!
! Description:
! This script will check the status on a mailhost. The mailhost
! should be running a POP3 and SMTP service. We will attempt
! to keepalive both services, and if one goes down we will report
! an error.
!
! Failure Upon:
! 1. Not establishing a connection with the host running an SMTP
service.
! 2. Not establishing a connection with the host running a POP3
service.
! 3. Failure to get a good status code after saying 'hello' to SMTP.
! 4. Failure to login using POP3.
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!