cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
308
Views
0
Helpful
2
Replies

Please help --- script for http and port

hongwei272
Level 1
Level 1

Hi,

I am trying to make a script to do health check against a web page on port other than 80.

When I run my script:

script play ap-kal-http-port "10.60.27.27 30200 /ebss-aml-web/HealthCheck"

I got:

Error in script playback line:38

>>>socket waitfor ${SOCKET} "200 OK" 2000

Here is my script:

!no echo

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

! Filename: ap-kal-http-port

! Parameters: HostName HealthWebPage

!

! Description:

! This script will keepalive a WWW server on port other than 80

!

! Failure Upon:

! 1. Not establishing a connection with the host.

! 2. Not being able to receive the cookie

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

if ${ARGS}[#] "NEQ" "3"

echo "Usage: ap-kal-ebssdb \'Hostname PortNumber HealthWebPage\'"

exit script 1

endbranch

! Defines:

set HostName "${ARGS}[1]"

set PortNumber "${ARGS}[2]"

set HealthWebPage "${ARGS}[3]"

! Connect to the remote host (use default timeout)

set EXIT_MSG "Connection Failed"

socket connect host ${HostName} port ${PortNumber} tcp 2000

! send our request to the host

set EXIT_MSG "Send: Failure"

socket send ${SOCKET} "GET ${HealthWebPage} HTTP/1.0\n\n"

! Wait for the health message to come in

set EXIT_MSG "Waitfor: Failure"

socket waitfor ${SOCKET} " 200 " 2000

! Done

no set EXIT_MSG

socket disconnect ${SOCKET}

exit script 0

Appreciate your help.

Richard

2 Replies 2

Gilles Dufour
Cisco Employee
Cisco Employee

Richard

did you sniff the traffic to verify that the server actually respond with a HTTP 200 OK ?

Gilles.

will do

Thanks.

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: