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. If you'd prefer to explore, try our test area to get started. And see here for current known issues.

New Member

how to set keepalive check for regular expression

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
Bronze

Re: how to set keepalive check for regular expression

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

4 REPLIES
Bronze

Re: how to set keepalive check for regular expression

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

New Member

Re: how to set keepalive check for regular expression

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?

Bronze

Re: how to set keepalive check for regular expression

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

New Member

Re: how to set keepalive check for regular expression

Thanks, This script worked very well.

179
Views
0
Helpful
4
Replies