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

Combining KAL Functions on a service

jgutermuth
Level 1
Level 1

Hello, Group. I am attempting to apply a custom KAL script on a service, which will do the following:

1. Do a TCP connection to host A on port 8080.

2. Do a TCP connection to host B on port 8080.

3. Ping host C.

If any of the above fail, the service should be taken down. I have been attempting to combine the built-in TCP connect and Ping list scripts, but with no success. Any advice or sample scripts out there?

Thanks!

2 Replies 2

Gilles Dufour
Cisco Employee
Cisco Employee

I think you should provide us your script and let us know what is not working.

Did you capture a trace ?

Is the CSS doing the tcp connections correctly ?

Or is the script not even running ?

Thanks,

Gilles.

Gilles, Thanks for the reply. Here is the script I have come up with:

set HOSTA "${ARGS}[1]"

set HOSTB "${ARGS}[2]"

set HOSTC "${ARGS}[3]"

socket connect host ${ARGS}[1] port 8080 tcp

set CONTINUE_ON_ERROR "1"

set SOCKET-STAT "${STATUS}"

set CONTINUE_ON_ERROR "0"

socket disconnect ${SOCKET} graceful

socket connect host ${ARGS}[2] port 8080 tcp

set CONTINUE_ON_ERROR "1"

set SOCKET-STAT "${STATUS}"

set CONTINUE_ON_ERROR "0"

socket disconnect ${SOCKET} graceful

ping ${ARGS}[3] | grep -u Success

if STATUS "NEQ" "0"

show variable UGREP | grep 100

if STATUS "==" "0"

set EXIT_MSG "Ping: Failure to ping ${ARGS}[3]"

exit script 1

It appears to be working, but I am unsure I have entered the script exit commands correctly - to fail on fault.

John

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: