02-10-2004 02:21 AM
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
----
Solved! Go to Solution.
02-10-2004 03:56 AM
Roble,
You can accomplish this with a script keepalive. An example of this is located here:
~Zach
02-10-2004 06:33 AM
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
02-10-2004 03:56 AM
Roble,
You can accomplish this with a script keepalive. An example of this is located here:
~Zach
02-10-2004 05:28 AM
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
02-10-2004 06:33 AM
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
02-11-2004 02:21 AM
That is exactly what i needed and it works like a charm.
Thanks, that solved my problem.
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: