Chapter 8
Using the CSS Scripting Language
DNS Keepalive
OL-5647-02
! Send the GET request for the web page, along with the authorization
! This builds a header block like so:
!
! GET /index.html HTTP/1.0\r\n
! Authorization: Basic bGFiOmxhYnRlc3Qx\r\n\r\n
set EXIT_MSG "Send: Failed"
socket send ${SOCKET} "GET ${WebPage} HTTP/1.0\n"
socket send ${SOCKET} "Authorization: Basic "
socket send ${SOCKET} "${UserPass}" base64
socket send ${SOCKET} "\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
!no echo
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
! Filename: ap-kal-dns
! Parameters: Server DomainName
!
! Description:
!
This script will resolve a domain name from a specific DNS
!
server.
This builds a UDP packet based on RFC-1035
!
! Failure Upon:
!
1. Not resolving the hosts's IP from the domain name
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
if ${ARGS}[#] "NEQ" "1"
echo "Usage: ap-kal-finger \'Hostname\'"
exit script 1
endbranch
set HostName "${ARGS}[1]
! Connect to the remote host
set EXIT_MSG "Connection failed"
socket connect host ${HostName} port 53 udp
Cisco Content Services Switch Administration Guide
Script Keepalive Examples
8-59