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

how to set keepalive check for regular expression

rbatchu
Level 1
Level 1

Hi

We are using css110501 CSS.

Right now the keepalives on services are set using hash values.

But i want to change this keepalives to implement keepalives with regular expression checking.

Any Ideas?

1 Accepted Solution

Accepted Solutions

The CSS supports it's own native scripting language that can be used to write keepalives among other things.

Here is an example of a script that I wrote to check a page for some specific text:

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

! Filename: ap-kal-statpage

! Parameters: None - must be coded in script

!

! Description:

!

! This script will attempt to connect to a host and

! "GET" an html page. The script checks the contents

! of the page for a particular string. If the string

! is found, the script passes.

!

! Failure Upon:

! 1. The correct arguments are not supplied.

! 2. The CSS is unable to connect to the host.

! 3. The string is not found in the page.

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

no echo

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

echo "Usage: ap-kal-portlist \'Hostname Port Page String ...\'"

exit script 1

endbranch

set host "${ARGS}[1]"

set port "${ARGS}[2]"

set page "${ARGS}[3]"

set string "${ARGS}[4]"

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

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

socket send ${SOCKET} "GET ${page} HTTP/1.0\n\n"

set EXIT_MSG "String was not found."

socket waitfor ${SOCKET} "${string}" 200

socket disconnect ${SOCKET}

echo "String ${string} was found."

no set EXIT_MSG

exit script 0

View solution in original post

4 Replies 4

d.parks
Level 1
Level 1

You would need a scripted keepalive using socket commands for this.

say here is my current service

service ag

ip address 192.168.3.30

keepalive type http

keepalive method get

keepalive port 80

keepalive uri "/ag"

active

I have less idea about scripts.

suppose if u want to configure this keepalive using

a script how to do that?

The CSS supports it's own native scripting language that can be used to write keepalives among other things.

Here is an example of a script that I wrote to check a page for some specific text:

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

! Filename: ap-kal-statpage

! Parameters: None - must be coded in script

!

! Description:

!

! This script will attempt to connect to a host and

! "GET" an html page. The script checks the contents

! of the page for a particular string. If the string

! is found, the script passes.

!

! Failure Upon:

! 1. The correct arguments are not supplied.

! 2. The CSS is unable to connect to the host.

! 3. The string is not found in the page.

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

no echo

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

echo "Usage: ap-kal-portlist \'Hostname Port Page String ...\'"

exit script 1

endbranch

set host "${ARGS}[1]"

set port "${ARGS}[2]"

set page "${ARGS}[3]"

set string "${ARGS}[4]"

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

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

socket send ${SOCKET} "GET ${page} HTTP/1.0\n\n"

set EXIT_MSG "String was not found."

socket waitfor ${SOCKET} "${string}" 200

socket disconnect ${SOCKET}

echo "String ${string} was found."

no set EXIT_MSG

exit script 0

Thanks, This script worked very well.

Review Cisco Networking for a $25 gift card