cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
489
Views
0
Helpful
4
Replies

Multiple Keepalives for a Service? (CSS11506)

Roble Mumin
Level 3
Level 3

Is it possible to configure multiple keepalives for a single service?

The Webserver offer a complex Webapplication running multiple services on one machine. If one of this services is down the whole content offered by this webserver is not working. So i would like to configure that if any of these services is down the according Webserver is rated as dead.

I had something in mind like the following, unfortunatly you can only set one keepalive type.

----

service foo_bar

keepalive type http

uri "/index.html"

keepalive type tcp

keepalive port 21

keepalive type tcp

keepalive port 4711

----

2 Accepted Solutions

Accepted Solutions

seilsz
Level 4
Level 4

Here's one I coded up awhile back that might do the job. You can specify as many ports as you want by passing arguments.

!no echo

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

! Filename: ap-kal-portlist

! Parameters: Hostname Port1 Port2 Port3, etc.

!

! Description:

!

! This script will attempt to connect to a given host

! using multiple user-defined TCP ports. If only one

! tcp poll is desired, "keepalive type tcp" should be

! used.

!

! Failure Upon:

! 1. Proper parameters are not supplied

! 2. Any of the TCP socket connections fail.

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

no echo

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

echo "Usage: ap-kal-portlist \'Hostname Port1 Port2 ...\'"

if ${ARGS}[#] "==" "2"

echo "If only one TCP port is needed, use keepalive type tcp."

endbranch

exit script 1

endbranch

set Host "${ARGS}[1]"

var-shift ARGS

while ${ARGS}[#] "GT" "0"

set Port "${ARGS}[1]"

var-shift ARGS

set EXIT_MSG "Host ${Host} not responding on TCP port ${Port}."

socket connect host ${Host} port ${Port} tcp

socket disconnect ${SOCKET}

echo "Host ${Host} responding on TCP port ${Port}"

no set EXIT_MSG

endbranch

exit script 0

View solution in original post

4 Replies 4

seilsz
Level 4
Level 4

Roble,

You can accomplish this with a script keepalive. An example of this is located here:

http://www.cisco.com/en/US/products/hw/contnetw/ps792/products_administration_guide_chapter09186a00801eea3e.html#1039831

~Zach

Thanks for the quick answer.

So i have to define a script which query's all needed services and then define the custom script as keepalive for the service. Time to freshen up my coding skills then...

Let's see if i can build one from the existing scripts available.

Roble

Here's one I coded up awhile back that might do the job. You can specify as many ports as you want by passing arguments.

!no echo

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

! Filename: ap-kal-portlist

! Parameters: Hostname Port1 Port2 Port3, etc.

!

! Description:

!

! This script will attempt to connect to a given host

! using multiple user-defined TCP ports. If only one

! tcp poll is desired, "keepalive type tcp" should be

! used.

!

! Failure Upon:

! 1. Proper parameters are not supplied

! 2. Any of the TCP socket connections fail.

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

no echo

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

echo "Usage: ap-kal-portlist \'Hostname Port1 Port2 ...\'"

if ${ARGS}[#] "==" "2"

echo "If only one TCP port is needed, use keepalive type tcp."

endbranch

exit script 1

endbranch

set Host "${ARGS}[1]"

var-shift ARGS

while ${ARGS}[#] "GT" "0"

set Port "${ARGS}[1]"

var-shift ARGS

set EXIT_MSG "Host ${Host} not responding on TCP port ${Port}."

socket connect host ${Host} port ${Port} tcp

socket disconnect ${SOCKET}

echo "Host ${Host} responding on TCP port ${Port}"

no set EXIT_MSG

endbranch

exit script 0

That is exactly what i needed and it works like a charm.

Thanks, that solved my problem.