Cisco Support Community
cancel
Showing results for 
Search instead for 
Did you mean: 
New Member

Please help --- script for http and port

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
Cisco Employee

Re: Please help --- script for http and port

Richard

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

Gilles.

New Member

Re: Please help --- script for http and port

will do

Thanks.

113
Views
0
Helpful
2
Replies
CreatePlease to create content