Writing Health Scripts - Cisco catalyst 6500 series Configuration Note

Content switching module
Hide thumbs Also See for catalyst 6500 series:
Table of Contents

Advertisement

Chapter 10
Configuring CSM Scripts
All UDP commands are thread safe (allowing you to share data between several programs) like the rest
of the CSM TCL commands.

Writing Health Scripts

After you configure each interval of time, an internal CSM scheduler schedules the health scripts. Write
the script as if you intend to perform only one probe. You must declare the result of the probe using the
exit command.
A health script typically performs these actions:
This example shows how to probe an HTTP server using a health script:
Router(config)# !name = HTTP_TEST
# get the IP address of the real server from a predefined global array csm_env
set ip $csm_env(realIP)
set port 80
set url "GET /index.html HTTP/1.0\n\n"
# Open a socket to the server. This creates a TCP connection to the real server
set sock [socket $ip $port]
fconfigure $sock -buffering none -eofchar {}
# Send the get request as defined
puts -nonewline $sock $url;
# Wait for the response from the server and read that in variable line
set line [ read $sock ]
# Parse the response
if { [ regexp "HTTP/1.. (\[0-9\]+) " $line match status
puts "real $ip server response : $status"
}
# Close the socket. Application must close the socket once the
# is over. This allows other applications and tcl scripts to make
# a good use of socket resource. Health monitoring is allowed to open
# only 200 sockets simultaneously.
close $sock
# decide the exit code to return to control module.
# If the status code is OK then script MUST do exit 5000
# to signal successful completion of a script probe.
# In this example any other status code means failure.
# User must do exit 5001 when a probe has failed.
if { $status == 200 } {
} else {
}
OL-4612-01
Opens a socket to an IP address.
Sends one or more requests.
Reads the responses.
Analyzes the responses.
Closes the socket.
Exits the script by using exit 5000 (success) or exit 5001 for failure.
exit 5000
exit 5001
Catalyst 6500 Series Content Switching Module Configuration Note
Configuring TCL Scripts
] } {
10-5

Advertisement

Table of Contents
loading

This manual is also suitable for:

Catalyst 6000 series

Table of Contents