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

CSS: How to keep a failed service suspended

pdostal
Level 1
Level 1

I need to configure a CSS service to stay in a down/suspended status when it fails (even when the actual server/service becomes available) - manual failback. Any suggestions? Thanks.

1 Accepted Solution

Accepted Solutions

Yes, here is a working script I just tested for you ;-). Actually, what the script does is a connection attempt to the server. If the server fails to respond, the script enters CLI commands that suspend the service. Is it what you need ?

Here is the script :

--------------------

!----------------------------------------------------

! Description...: This test script shows how to

! automatically suspend a service

! if the keepalive fails on TCP port.

!

! Parameters : - Service IP address

! - TCP Port of the service

! - Service name

!

! Last version : 06 OCT 2004

!

! Author : Yves Haemmerli, IBM (Switzrland)

!

!-------------------------------------------------

!

! no echo

!-------------------------------------------------

! Constants declaration

!-------------------------------------------------

!

set CONTINUE_ON_ERROR "1"

!-------------------------------------------------

! Messages for manual playing

!-------------------------------------------------

!

!

set ConnectOK "script: Connection Successful"

set ConnectKO "script: Connection Failed"

!

!

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

if STATUS "NEQ" "0"

echo "${ConnectKO}"

configure

service TEST

suspend

exit

exit script 1

endbranch

socket disconnect ${SOCKET} graceful

echo "${ConnectOK}"

exit script 0

!

Here is the CSS service configuration :

---------------------------------------

service TEST

ip address 192.168.1.100

protocol tcp

port 80

keepalive frequency 15

keepalive type script automatic-suspend "192.168.1.100 80 TEST"

active

I hope this will help you

Yves Haemmerli

View solution in original post

4 Replies 4

yves.haemmerli
Level 1
Level 1

One option would be to use the scripting language of the CSS to write a keepalive script that would suspend the service if the keepalive fails. The drawback is that you cannot use the maxfailure parameter because the script would suspend the service just after the first service failure to respond to the keepalive.

Yves Haemmerli

I wrote a few CSS keepalive scripts, but I don't know how could I suspend a service within a script. Would you please share your expertise? Thanks!

Yes, here is a working script I just tested for you ;-). Actually, what the script does is a connection attempt to the server. If the server fails to respond, the script enters CLI commands that suspend the service. Is it what you need ?

Here is the script :

--------------------

!----------------------------------------------------

! Description...: This test script shows how to

! automatically suspend a service

! if the keepalive fails on TCP port.

!

! Parameters : - Service IP address

! - TCP Port of the service

! - Service name

!

! Last version : 06 OCT 2004

!

! Author : Yves Haemmerli, IBM (Switzrland)

!

!-------------------------------------------------

!

! no echo

!-------------------------------------------------

! Constants declaration

!-------------------------------------------------

!

set CONTINUE_ON_ERROR "1"

!-------------------------------------------------

! Messages for manual playing

!-------------------------------------------------

!

!

set ConnectOK "script: Connection Successful"

set ConnectKO "script: Connection Failed"

!

!

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

if STATUS "NEQ" "0"

echo "${ConnectKO}"

configure

service TEST

suspend

exit

exit script 1

endbranch

socket disconnect ${SOCKET} graceful

echo "${ConnectOK}"

exit script 0

!

Here is the CSS service configuration :

---------------------------------------

service TEST

ip address 192.168.1.100

protocol tcp

port 80

keepalive frequency 15

keepalive type script automatic-suspend "192.168.1.100 80 TEST"

active

I hope this will help you

Yves Haemmerli

Thanks! I didn't know that you could actually execute a config command within a script. Thanks again.

Review Cisco Networking for a $25 gift card