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

Welcome to Cisco Support Community. We would love to have your feedback.

For an introduction to the new site, click here. And see here for current known issues.

New Member

Combining KAL Functions on a service

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

Re: Combining KAL Functions on a service

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.

New Member

Re: Combining KAL Functions on a service

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

164
Views
0
Helpful
2
Replies