Table Of Contents
Configuring Service, Global, and Script Keepalives
CSS Keepalive Overview
Configuring Service Keepalives
Configuring Global Keepalives
Creating and Naming a Global Keepalive
Configuring a Global Keepalive IP Address
Configuring a Global Keepalive Description
Activating the Global Keepalive
Suspending a Global Keepalive
Associating a Service with a Global Keepalive
Configuring Service and Global Keepalive Attributes
Configuring a Keepalive Frequency
Configuring a Keepalive Retry Period
Configuring the Maximum Number of Failures for a Keepalive
Configuring a Keepalive Type
Configuring a TCP Keepalive with Graceful Socket Close (FIN)
Configuring a Keepalive Port Number
Configuring the HTTP Keepalive Method
Configuring a Keepalive HTTP Response Code
Configuring a Keepalive URI
Configuring a Keepalive Hash Value
Showing Keepalive Configurations
Using Script Keepalives with Services
Script Keepalive Considerations
Configuring Script Keepalives
Viewing a Script Keepalive in a Service
Script Keepalive Status Codes
Script Keepalives and Upgrading WebNS Software
Configuring Service, Global, and Script Keepalives
When you configure a service on the CSS, the CSS determines the state of the service by sending keepalive messages. By default, the CSS assigns each service with an ICMP keepalive with a frequency and retry period of 5 seconds, and a maximum failure rate of 3 times. To change the default keepalive settings for a service, you can configure individual keepalive attributes for the service or create a keepalive in keepalive mode and apply the service to it.
This chapter describes how to configure service, global, and script keepalives. Information in this chapter applies to all CSS models except where noted.
This chapter contains the following major sections to configure CSS keepalives:
•
CSS Keepalive Overview
•
Configuring Service Keepalives
•
Configuring Global Keepalives
•
Configuring Service and Global Keepalive Attributes
•
Showing Keepalive Configurations
•
Using Script Keepalives with Services
CSS Keepalive Overview
The CSS supports a total of 2048 keepalives. These keepalives include:
•
ICMP, HTTP-GET, HTTP-HEAD, TCP, FTP, SSL, and script keepalives configured and assigned to a service through the (config-service) keepalive type command. By default, a service has an ICMP keepalive. Each time you assign one of these keepalives to a service through this command, the CSS counts it as one keepalive. For information on configuring service keepalives, see the "Configuring Service Keepalives" section.
•
Global keepalives configured in keepalive configuration mode. You can apply multiple services to a global keepalive reducing the amount of configuration required for each service. The CSS counts a global keepalive as one keepalive regardless of the number of services assigned to it.
Global keepalives supersede the individual keepalive parameters configured in service mode. For information on configuring global keepalives, see the "Configuring Global Keepalives" section later in this chapter.
The CSS divides the keepalive types into two categories, Class A and Class B keepalives. The CSS supports a maximum of 2048 Class A keepalives. The CSS supports a maximum of 512 Class B keepalives.
Caution 
Do not configure more than 2048 total keepalives, including a total of 512 Class B keepalives. Any services assigned to keepalives over the supported total number will not be eligible for content rule selection.
Table 4-1 lists the keepalive types in each class, the maximum number of each type, and the maximum number of each keepalive type that can execute concurrently.
Table 4-1 Keepalive Class, Types, and Limitations
Class
|
Type
|
CSS Maximum
|
Concurrent Maximum
|
A
(The CSS limits 2048 keepalives per Class A.)
|
ICMP
|
2048
|
2048
|
HTTP-HEAD non-persistent1
|
2048
|
2048
|
SSL (Hello)
|
2048
|
2048
|
TCP
|
2048
|
2048
|
B
(The CSS limits 512 keepalives per Class B.)
|
FTP
|
256
|
32
|
HTTP (GET persistent or non-persistent, or HEAD persistent)1
|
256
|
32
|
Script
|
256
|
16
|
When you configure a keepalive for a service (or associate a service with a global keepalive), the CSS periodically sends a message to the service based on the keepalive frequency to determine the state of the service. See the "Configuring a Keepalive Frequency" section. The CSS considers the service to be alive when a service responds to the keepalive message.
The CSS transitions the service to the dying state when the service fails to respond to a keepalive message. The CSS tests whether the failed service is functional by sending a keepalive message at time intervals based on the retry period. See the "Configuring a Keepalive Retry Period" section.
The CSS transitions the service to the down state if the service fails to respond a maximum number of retries to the keepalive message. See the "Configuring the Maximum Number of Failures for a Keepalive" section. Then the CSS removes the service from the load-balancing algorithm. The CSS continues to test whether the service is functional at time intervals based on the retry period.
Thus, using the default values of a 5-second keepalive frequency interval, a 5-second retry period interval, and maximum of three failures, a service can transition from the alive state to the dead state in 15 seconds; a 5-second interval between a keepalive response and the initial keepalive failure based on the keepalive frequency, and two failures, each occurring at 5-second intervals based on the retry period.
However, if the keepalives are Class B type keepalives, the time for a service to transition from an alive state to the dead state may take longer. This transition delay occurs because the CSS executes smaller numbers of Class B keepalives at the same time. For example, if you configure 256 HTTP-GET keepalives using the default values for frequency, retry period, and maximum failure, and all services fail, the time for all of the services to transition from the alive state to the dead state is 120 seconds; 32 services transitioning in 15 seconds followed by another 32 services until all 256 services have transitioned.
Configuring Service Keepalives
A service keepalive is the keepalive configured for a specific service. As you configure a service, you can configure its keepalive attributes. To configure keepalive attributes for a service, access Service configuration mode for the service and use the keepalive command. For information, see the "Configuring Service and Global Keepalive Attributes" section.
If you want to apply a CSS service to a global keepalive, see the "Configuring Global Keepalives" section.
After you configure a service including its keepalive attributes, you can activate the service. Activating a service puts it into the resource pool for load-balancing content requests and starts the keepalive function. For example, to activate service serv1, enter:
(config-service[serv1])# active
Configuring Global Keepalives
A global keepalive allows you to configure keepalive attributes and apply multiple services to the keepalive. As long as one service is alive, the global keepalive service is alive. By having a single keepalive configuration for more than one service, you can reduce the amount of time to configure each service. Also the keepalive counts as one keepalive no matter how many services you apply to it.
Table 4-2 provides a quick overview of the basic steps required to configure a global keepalive. Each step includes the CLI command required to complete the task. For a complete description of each feature and all the options associated with the CLI commands, see the sections following Table 4-2.
Table 4-2 Global Keepalive Configuration Quick Start
Task and Command Example
|
1. Enter global configuration mode by typing config.
|
2. Create a global keepalive and enter the keepalive configuration mode. See the "Creating and Naming a Global Keepalive" section.
(config)# keepalive keepimages
(config-keepalive[keepimages])#
|
3. Specify the IP address where the keepalive messages are sent. See the "Configuring a Global Keepalive IP Address" section.
(config-keepalive[keepimages])# ip address 192.168.7.6
|
4. Specify the type of keepalive message assigned to a keepalive. See the "Configuring a Keepalive Type" section.
(config-keepalive[keepimages])# type http
|
5. Specify the HTTP keepalive method assigned to the global keepalive. See the "Configuring the HTTP Keepalive Method" section.
(config-keepalive[keepimages])# method get
|
6. Specify the content information for an HTTP global keepalive. See the "Configuring a Keepalive URI" section.
(config-keepalive[keepimages])# uri "/index.html"
|
7. Activate the global keepalive.
(config-keepalive[keepimages])# active
|
8. Associate a service with a global keepalive.
(config-service[imageserver1])# keepalive type named keepimages
|
9. (Recommended) Use the show keepalive command to verify the global keepalive configuration. See the "Showing Keepalive Configurations" section.
(config-keepalive[keepimages])# show keepalive
|
10. (Optional) Use the show service command to verify the basic keepalive configuration on the service.
(config-service[imageserver1])# show service
|
The following running-configuration example shows the results of entering the commands in Table 4-2 as shown in bold and any related commands.
!************************** SERVICE **************************
keepalive type named keepimages
!************************* KEEPALIVE *************************
The following sections provides information on:
•
Creating and Naming a Global Keepalive
•
Configuring a Global Keepalive IP Address
•
Configuring a Global Keepalive Description
•
Activating the Global Keepalive
•
Suspending a Global Keepalive
•
Associating a Service with a Global Keepalive
For information on configuring the keepalive attributes, see the "Configuring Service and Global Keepalive Attributes" section.
Creating and Naming a Global Keepalive
To create and name a global keepalive, use the keepalive command to access keepalive mode. You can access keepalive mode from circuit, global, interface, and IP configuration modes. The prompt changes to (config-keepalive [name]). You can also use this command from keepalive mode to access another keepalive.
Enter the name of the new keepalive you want to create or the name of an existing keepalive. Enter an unquoted text string with no spaces and a length of 1 to 31 characters. To see a list of existing keepalive names, use the keepalive ? command.
For example, to create the global keepalive keepimages, enter:
(config)# keepalive keepimages
When you access this mode, the prompt changes to (config-keepalive [keepimages]).
(config-keepalive[keepimages])#
To remove an existing keepalive, enter:
(config)# no keepalive keepimages
Configuring a Global Keepalive IP Address
The CSS sends global keepalives to a service that monitors the state of services assigned to it. Use the ip address command to specify the IP address where the keepalive messages are sent. Enter the IP address in dotted-decimal notation.
For example, to enter an IP address for keepalive keepimages, enter:
(config-keepalive[keepimages])# ip address 192.168.7.6
Configuring a Global Keepalive Description
Optionally, you can provide a description for the global keepalive. To specify the description, use the description command. Enter the description as a quoted text string with a maximum of 64 characters, including spaces.
For example, to enter a description for the global keepalive keepimages, enter:
(config-keepalive[keepimages])# description "This keepalive is for the
image servers"
To delete a description, enter:
(config-keepalive[keepimages])# no description
Activating the Global Keepalive
Activating a keepalive enables the CSS to start sending keepalive messages to the IP address. Use the active command to activate the global keepalive.
For example, to activate the global keepalive keepimages, enter:
(config-keepalive[keepimages])# active
Suspending a Global Keepalive
To deactivate the keepalive, use the suspend command.
For example, enter:
(config-keepalive[keepimages])# suspend
Associating a Service with a Global Keepalive
To associate a service with a global keepalive, use the keepalive type named command. The service maintains the global keepalive attributes when you add the service to content rules.
For example, to associate imageserver1 with global keepalive keepimages, enter:
(config-service[imageserver1])# keepalive type named keepimages
Configuring Service and Global Keepalive Attributes
The following sections describe the attributes you can configure for keepalives:
•
Configuring a Keepalive Frequency
•
Configuring a Keepalive Retry Period
•
Configuring the Maximum Number of Failures for a Keepalive
•
Configuring a Keepalive Type
•
Configuring a TCP Keepalive with Graceful Socket Close (FIN)
•
Configuring a Keepalive Port Number
•
Configuring the HTTP Keepalive Method
•
Configuring a Keepalive HTTP Response Code
•
Configuring a Keepalive URI
•
Configuring a Keepalive Hash Value
Configuring a Keepalive Frequency
The keepalive frequency specifies the interval in seconds between keepalives messages sent to a service. Specify a frequency from 2 to 255 seconds. The default is 5 seconds.
Note
When configuring the CSS for FTP keepalives, do not configure the keepalive frequency or the keepalive retryperiod to a value less than 15 seconds. Note that the CSS does not prevent you from configuring smaller values. Also, the default value for the keepalive frequency or the keepalive retryperiod is five seconds. You must use the frequency and retryperiod commands to override the defaults.
Note
The timeout value for a keepalive is related to the configured keepalive frequency.
For versions 7.20.1.04 and greater, the timeout is 2 seconds less than the keepalive frequency with a minimum of 1 second. From version 5.20 up to version 7.20.1.04, the timeout is one second less than the keepalive frequency.
•
To configure the keepalive frequency for a specific service, use the service mode keepalive frequency command. For example, to configure a frequency of 15 seconds, enter:
(config-service[serv1])# keepalive frequency 15
To reset the frequency to its default value of 5, enter:
(config-service[serv1])# no keepalive frequency
•
To configure the frequency for a global keepalive, use the keepalive mode frequency command to specify the time between keepalive messages sent to the IP address.
For example, to set the frequency time to 10 seconds, enter:
(config-keepalive[keepimages])# frequency 10
To reset the frequency to its default value of 5, enter:
(config-keepalive[keepimages])# no frequency
Configuring a Keepalive Retry Period
When a service has failed to respond to a given keepalive message (the service has transitioned to the dying state), the retry period specifies how frequently the CSS tests the service to see if it is functional. Enter the retry period as an integer from 2 to 255 seconds. The default is 5 seconds.
Note
When configuring the CSS for FTP keepalives, do not configure the keepalive frequency or the keepalive retryperiod to a value less than 15 seconds. Note that the CSS does not prevent you from configuring smaller values. Also, the default value for the keepalive frequency or the keepalive retryperiod is five seconds. You must use the frequency and retryperiod commands to override the defaults.
•
To configure the keepalive retry period for a service, use the service mode keepalive retryperiod command. For example, to configure a retry period of 60 seconds, enter:
(config-service[serv1])# keepalive retryperiod 60
To reset the retry period to its default value of 5, enter:
(config-service[serv1])# no keepalive retryperiod
•
To configure the retry period for a global keepalive, use the keepalive mode retryperiod command. For example, to configure a retry period of 60 seconds, enter:
(config-keepalive[keepimages])# retryperiod 60
To reset the retry period to its default value of 5, enter:
(config-keepalive[keepimages])# no retryperiod
Configuring the Maximum Number of Failures for a Keepalive
The maximum failures is the number of times a service can fail to respond to a keepalive message before the CSS considers it offline. Specify a maximum failure number from 1 to 10. The default is 3.
•
To configure the keepalive maximum failure value for a service, use the service mode keepalive maxfailure command. For example, to configure the maximum failure value to 5, enter:
(config-service[serv1])# keepalive maxfailure 5
To reset the maximum failure number to its default value of 3, enter:
(config-service[serv1])# no keepalive maxfailure
•
To configure the maximum failure value for a global keepalive, use the keepalive mode maxfailure command. For example, to configure a value of 7, enter:
(config-keepalive[keepimages])# maxfailure 7
To reset the maximum failure number to its default value of 3, enter:
(config-keepalive[keepimages])# no maxfailure
Configuring a Keepalive Type
The keepalive type specifies the type of keepalive message assigned to the keepalive. The keepalive types include ICMP, HTTP-GET, HTTP-HEAD, TCP, FTP, SSL, and script keepalives. Also, with the use of an SSL module, you can configure encrypted HTTP-type keepalives to allow for HTTPS application verification.
For a service keepalive, a named keepalive type allows you to apply the service to a configured global keepalive.
•
To specify the type of keepalive message for a service, use the service mode keepalive type command, if any, appropriate for a service or to associate a service with a global keepalive. For example, to set serv1 keepalive type to ftp, enter:
(config-service[serv1])# keepalive type ftp
•
To specify the keepalive type for a global keepalive, use the keepalive mode type command. For example, to set the global keepalive keepimages to type tcp, enter:
(config-keepalive[keepimages])# type tcp
Each time you assign a keepalive type to a service or global keepalive, the CSS counts it as one keepalive.
Caution 
Do not configure more than 2048 total keepalives, including a total of 512 Class B keepalives. Any services assigned to keepalives over the supported total number will not be eligible for content rule selection.
The options for the keepalive type or type command are:
•
ftp ftp_record - Keepalive method in which the CSS logs in to an FTP server as defined in the FTP record file. Enter the name of the existing FTP record for an FTP server as an unquoted text string with no spaces. To create an FTP record, use the (config) ftp-record command.
The FTP keepalive type is a Class B type. The CSS supports a maximum of 256 FTP keepalives and concurrently executes a maximum of 32 keepalives of this type at a time.
When configuring the CSS for FTP keepalives, do not configure the keepalive frequency or the keepalive retryperiod to a value less than 15 seconds. Note that the CSS does not prevent you from configuring smaller values. Also, the default value for the keepalive frequency or the keepalive retryperiod is five seconds. You must use the keepalive frequency and keepalive retryperiod commands to override the defaults.
•
http - A persistent HTTP index page request. By default, HTTP keepalives attempt to use persistent connections.
For configuring the method for the HTTP keepalive type, see the "Configuring the HTTP Keepalive Method" section. The HTTP-HEAD persistent, and HTTP-GET persistent keepalive types are Class B types. Of each of these types, the CSS supports a maximum of 256 keepalives and concurrently executes a maximum of 32 keepalives at a time.
If an HTTP persistent keepalive fails to make a persistent connection, then it attempts to make a non-persistent connection. If the non-persistent connection succeeds, then the keepalive succeeds. At the next interval, the keepalive attempts a persistent connection.
•
http non-persistent - A non-persistent HTTP index page request. This command disables the default persistent behavior.
For configuring the method for the HTTP keepalive type, see the "Configuring the HTTP Keepalive Method" section. The HTTP-GET non-persistent keepalive type is a Class B type. Of this type, the CSS supports a maximum of 256 keepalives and concurrently executes a maximum of 32 keepalives at a time.
The HTTP-HEAD non-persistent keepalive type is a Class A type. The CSS supports a maximum of 2048 HTTP-HEAD non-persistent keepalives and concurrently executes a maximum of 2048 keepalives of this type at a time.
•
http {non-persistent} encrypt - An encrypted persistent or non-persistent HTTP HEAD or GET keepalive for SSL back-end or initiation servers. Encrypted HTTP keepalives allow the verification of the full SSL handshake and the data returned from the server. For a back-end SSL server, the keepalives perform an HTTP GET or HEAD. The keepalive selects an SSL module and the module connects to the configured server. The keepalive sends messages to the module until a keepalive failure occurs. Then the keepalive selects another SSL module in the CSS.
For an SSL initiation server, the keepalives perform an HTTP GET or HEAD that is directed to the SSL module configured for the server. Then, the module connects to the configured server.
An SSL proxy list can consist of a maximum of 256 SSL back-end or initiation servers, thus the CSS supports a maximum of 256 encrypted keepalives.
Note
The encrypted keepalives are included in the maximum and concurrent number of applicable Class A and B HTTP keepalives that the CSS supports.
For information on configuring an SSL back-end or initiation server, refer to the Cisco Content Services Switch SSL Configuration Guide.
•
icmp - An ICMP echo message (ping). This is the default keepalive type.
The ICMP keepalive type is a Class A type. The CSS supports a maximum of 2048 ICMP keepalives and concurrently executes a maximum of 2048 keepalives of this type at a time.
•
named name - (service mode only) Associates the service with a previously defined global keepalive.
Before using this command, ensure that the global keepalive is activated through the (config-keepalive) active command. Assigning a service to a global keepalive overrides any keepalive properties you assigned in service mode. For information on creating a global keepalive, see the "Configuring Global Keepalives" section.
•
none - Do not send keepalive messages to a service.
•
script script_name {"arguments"} {use-output} - Defines a script keepalive to be used by the service. The script is played each time the keepalive is issued. Enter the name of an existing script keepalive.
The optional arguments variable passes arguments into the keepalive script. Enter a quoted text string with a maximum of 128 characters including spaces.
The use-output option allows the script to parse the output for each executed command. This optional keyword allows the use grep and file direction within a script. By default, the script does not parse the output. For details on using script keepalives, see the "Using Script Keepalives with Services" section later in this chapter.
The script keepalive type is a Class B type. The CSS supports a maximum of 256 script keepalives and concurrently executes a maximum of 16 keepalives of this type at a time.
Note
To preserve CSS system resources, use script keepalives only when needed. If an ICMP or HTTP keepalive message is sufficient to validate the service, then use that type of message instead of a script keepalive.
•
ssl - SSL HELLO keepalives for this service. The CSS sends a client HELLO to establish a connection to the SSL server. After the CSS receives a HELLO from the server, the CSS closes the connection with a TCP RST.
The SSL keepalive type is a Class A type. The CSS supports a maximum of 2048 SSL keepalives and concurrently executes a maximum of 2048 keepalives of this type at a time.
When the 11500 series CSS is using an SSL module, use the keepalive type of none. The SSL module is an integrated device in the CSS and does not require the use of keepalive messages for the service.
•
tcp - A TCP session that determines service viability through a 3-way handshake and reset; SYN, SYN-ACK, ACK, RST-ACK. By default, the CSS sends a RST to close the socket on a server port for TCP keepalives. If your servers require a graceful closing of a socket using a FIN, you can use a keepalive to send a FIN to close a socket by using the tcp-close fin command. For more information on the tcp-close command, see the "Configuring a TCP Keepalive with Graceful Socket Close (FIN)" section.
The TCP keepalive type is a Class A type. The CSS supports a maximum of 2048 TCP keepalives and concurrently executes a maximum of 2048 keepalives of this type at a time.
Configuring a TCP Keepalive with Graceful Socket Close (FIN)
By default and in compliance with RFC 1122, the CSS sends a reset (RST) to close the socket on a server port for TCP keepalives. An RST is faster than a FIN, because an RST requires only one packet, while a FIN can take up to four packets. If your servers require a graceful closing of a socket using a FIN, you can configure a keepalive to send a FIN to close a socket.
Note
The CSS does not apply a keepalive tcp-close command configuration to scripted keepalives.
•
To configure a keepalive to send a FIN to close a socket, use the service mode keepalive tcp-close fin command. For example, enter:
(config-service[serv1])# keepalive tcp-close fin
To reset the keepalive to send an RST, enter:
(config-service[serv1])# keepalive tcp-close rst
•
To configure a global keepalive to send a FIN to close a socket, use the keepalive mode tcp-close fin command. For example, enter:
(config-keepalive[keepimages])# tcp-close fin
To reset the keepalive to send an RST, enter:
(config-keepalive[keepimages])# tcp-close rst
Configuring a Keepalive Port Number
By default, the port number for keepalives is based on the keepalive type. If the keepalive type is:
•
HTTP or TCP - The default port number is 80
•
FTP - The port number is 21 and is not configurable
•
SSL - The port number is 443
•
ICMP - The port number is the number for the service
You can configure a port number from 0 to 65535.
•
To specify the keepalive port number for a service, use the service mode keepalive port command. For example, to specify port 8080 as the keepalive port, enter:
(config-service[serv1])# keepalive port 8080
To reset the keepalive port to its default value, enter:
(config-service[serv1])# no keepalive port
•
To specify a port for a global keepalive, use the keepalive mode port command. For example, to specify port 8080,enter:
(config-keepalive[keepimages])# port 8080
To reset the keepalive port to its default value, enter:
(config-keepalive[keepimages])# no port
Configuring the HTTP Keepalive Method
By default, when you configure an HTTP keepalive type, the CSS uses an HTTP-HEAD method. The CSS issues an HTTP-HEAD method to the service and a 200 OK status is required. The CSS does not compute a reference hash value for this type of keepalive. If the 200 OK status is not returned, the CSS considers the service down.
You can also configure an HTTP GET method. The CSS issues an HTTP GET method to the service, computes an MD5 (Message Digest Algorithm Version 5) hash value on the page, and stores the hash value as a reference hash. Subsequent GETs require a 200 OK status (HTTP command completed OK response) and the hash value to equal the reference hash value. If the 200 OK status is not returned, or if the 200 OK status is returned but the hash value is different from the reference hash value, the CSS considers the service down.
When you specify the content information of an HTTP Uniform Resource Identifier (URI) for an HTTP keepalive, the CSS calculates a hash value for the content. If the content information changes, the hash value no longer matches the original hash value and the CSS assumes that the service is down. To prevent the CSS from assuming that a service is down due to a hash value mismatch, specify the keepalive method as HTTP HEAD.
For information of configuring an HTTP response code, see the "Configuring a Keepalive HTTP Response Code" section. For information of configuring an HTTP URI, see the "Configuring a Keepalive URI" section.
•
To specify the HTTP keepalive method for a service, use the service mode keepalive method command. For example, to specify the HTTP GET method, enter:
(config-service[serv1])# keepalive method get
To reset the HTTP keepalive method to HTTP HEAD, enter:
(config-service[serv1])# keepalive method head
•
To specify the HTTP keepalive method for a global keepalive, use the keepalive method command. For example, to specify the HTTP GET keepalive method, enter:
(config-keepalive[keepimages])# method get
To reset the HTTP keepalive method to HTTP HEAD, enter:
(config-keepalive[keepimages])# method head
If you change the keepalive method on an active service, make sure that you suspend and reactivate the service for the change to take effect.
Note
By default, HTTP keepalives attempt to use persistent connections. If an HTTP persistent keepalive fails to make a persistent connection, then it attempts to make a non-persistent connection. If the non-persistent connection succeeds, then the keepalive succeeds. At the next interval, the keepalive attempts a persistent connection.
Configuring a Keepalive HTTP Response Code
By default, when the CSS issues an HTTP-HEAD keepalive, the CSS expects a response code of 200 in the response packet from the server it is querying. For HTTP-HEAD non-persistent keepalives, you can configure the CSS to expect a non-200 response code (for example, a 302 redirect response code). Enter the response code as an integer from 100 to 999.
•
To specify the keepalive response code for a service, use the service mode keepalive http-rspcode command. For example, to specify a response code of 302, enter:
(config-service[serv1])# keepalive http-rspcode 302
To reset the response code to its default value of 200, enter:
(config-service[serv1])# no keepalive http-rspcode
•
To specify the response code for a global keepalive, use the http-rspcode command. For example, to specify a response code of 302, enter:
(config-keepalive[keepimages])# http-rspcode 302
To reset the response code to its default value of 200, enter:
(config-keepalive[keepimages])# no http-rspcode
Configuring a Keepalive URI
When you configure an HTTP keepalive type, the CSS uses the URI string to determine if the service is alive. By default, the CSS uses the URI string to the root directory,"/". For an HTTP Get, the CSS uses the URI information to calculate the hash value. You can specify the URI content information for an HTTP keepalive.
Note
When you specify the content information of a URI for an HTTP keepalive, the CSS calculates a hash value for the content. If the content information changes, the hash value no longer matches the original hash value and the CSS assumes that the service is down. To prevent the CSS from assuming that a service is down due to a hash value mismatch, define keepalive method as head. The CSS does not compute a hash value for this type of keepalive. If you specify a Web page with changeable content and do not specify the head keepalive method, you must suspend and reactivate the service each time the content changes.
Enter the content information of the URI as a quoted text string with a maximum of 64 characters. Do not include the host information in the string. The CSS derives the host information from the service IP address and the keepalive port number.
•
To specify the HTTP keepalive content information for a service, use the service mode keepalive uri command. For example, enter:
(config-service[serv1])# keepalive uri "/index.html"
To clear the content information for the keepalive, enter:
(config-service[serv1])# no keepalive uri
•
To specify the HTTP keepalive content information for a global keepalive, use the uri command. For example, to specify the content information for the global keepalive, enter:
(config-keepalive[keepimages])# uri "/index.html"
To clear the content information assigned to this keepalive, enter:
(config-keepalive[keepimages])# no uri
Configuring a Keepalive Hash Value
By default, the CSS uses the MD5 (Message Digest Algorithm Version 5) hash for an HTTP GET keepalive. The CSS compares the hash value against the computed hash value of all HTTP GET responses. A successful comparison causes the keepalive to maintain an Alive state.
For a service keepalive, use the service mode keepalive hash command to override the default MD5 hash. To configure the hash value for a service keepalive:
1.
Configure the keepalive. The example below creates a keepalive GET to a test page.
(config-service[serv1])# ip address 10.0.3.21
(config-service[serv1])# keepalive type http
(config-service[serv1])# keepalive method get
(config-service[serv1])# keepalive uri "/testpage.html"
(config-service[serv1])# keepalive hash
"1024b91e516637aaf9ffca21b4b05b8c"
(config-service[serv1])# active
2.
Display the hash value using the show keepalive command. For example, enter:
(config-service[serv1])# show keepalive
Description: Auto generated for service serv1
Address: 10.0.3.21 Port: 80
Type: HTTP:GET:/testpage.html
Hash: 1024b91e516637aaf9ffca21b4b05b8c
3.
Use the hash value from the keepalive display to configure the keepalive hash. Enter the MD5 hash as a quoted hexadecimal string with a maximum of 32 characters. For example, enter:
(config-service[serv1])# keepalive hash
"1024b91e516637aaf9ffca21b4b05b8c"
An excerpt of the service configuration from the running-config is as follows:
keepalive uri "/testpage.html"
keepalive hash "1024b91e516637aaf9ffca21b4b05b8c"
To clear a hash value and return to the default hash value, enter:
(config-service[serv1])# no keepalive hash
For a global keepalive, use the hash command to override the default MD5 hash for an HTTP GET keepalive. To configure the hash value for a global keepalive:
1.
Configure the global keepalive. For example, enter:
(config-keepalive[keepimages])# method get
(config-keepalive[keepimages])# uri "/testpage.html"
(config-keepalive[keepimages])# hash
"1024b91e516637aaf9ffca21b4b05b8c"
2.
Configure the service. For example, enter:
(config)# service imageserver1
(config-service[imageserver1])# ip address 10.0.3.21
(config-service[imageserver1])# keepalive type named keepimages
(config-service[imageserver1])# active
3.
Display the hash value using the show keepalive command. For example, enter:
(config-keepalive[keepimages])# show keepalive
Description: Auto generated for service serv1
Address: 10.0.3.21 Port:80
Type: HTTP GET:/testpage.html
Hash: 1024b91e516637aaf9ffca21b4b05b8c
4.
Use the hash value from the keepalive display to configure the keepalive hash. Enter the MD5 hash value as a quoted hexadecimal string with a maximum of 32 characters. For example, enter:
(config-keepalive[keepimages])# hash
"1024b91e516637aaf9ffca21b4b05b8c"
An excerpt of the service configuration from the running-config is as follows:
keepalive uri "/testpage.html"
keepalive hash "1024b91e516637aaf9ffca21b4b05b8c"
To clear a hash value and return to the default hash value, enter:
(config-keepalive[keepimages])# no hash
Showing Keepalive Configurations
To display keepalive information for a service, use the show service command. For more information on this command and what it displays, see the "Showing Service Configurations" section in Chapter 3, Configuring Services.
To display global keepalive configurations, use the show keepalive command. To display a list of existing keepalives, use the show keepalive ? command.
Note
Two sessions (for example, SSH, console or Telnet) can access keepalive data at the same time. If one session views the data through the show keepalive command when the other session reconfigures the keepalive data by clearing a service or a keepalive, the CSS may abort the show command and display the following message:
Command Aborted!!! Configuration changed. Please reissue command.
This command provides the following options:
•
show keepalive - Display information for all keepalives
•
show keepalive keepalive_name - Display information for a specific keepalive
•
show keepalive-summary - Display summary information for all keepalives
For example, enter:
Name: keepimages Index: 1 State: ALIVE ( ICP Check )
Description: This keepalive is for image servers
Address: 172.16.1.7 Port: 80
Type: HTTP:HEAD-302:/index.html
Dependent Services: imageserver1
Name: rualive Index: 2 State: ALIVE
Description: Auto generated for service serv2
Address: 172.16.1.8 Port: 80
Type: HTTP:HEAD:/index.html
Dependent Services: serv2
(config)# show keepalive-summary
Table 4-3 describes the fields in the show keepalive command output.
Table 4-3 Field Descriptions for the show keepalive Command Output
Field
|
Description
|
Name
|
The name of the keepalive.
|
Index
|
The CSS-assigned unique index value for each keepalive.
|
State
|
The state of the keepalive. The possible states are Down, Alive, Dying, Suspended, and No Services.
|
Description
|
The description for the keepalive.
|
Address
|
The IP address where the keepalive messages are sent.
|
Port
|
The port number for the keepalive.
|
Type
|
The type of keepalive message assigned to the keepalive. The possible types are FTP, HTTP, ICMP, script, SSL, TCP, or named. For an HTTP Head keepalive, the response code is also displayed.
|
Encryption
|
The SSL encryption state for the HTTP keepalive. Possible values are Enabled or Disabled.
|
Frequency
|
The time, in seconds, between keepalive messages sent to the IP address. The range is from 2 to 255. The default is 5.
|
Max Failures
|
The configured number of times the IP address can fail to respond to a keepalive message before being considered down. The range is from 1 to 10. The default is 3.
|
Retry Frequency
|
The retry period, in seconds, to send messages to the keepalive IP address. The range is from 2 to 255. The default is 5.
|
Dependent Services
|
Services currently configured to use the keepalive. This is mainly used for named keepalive types.
|
Using Script Keepalives with Services
Script keepalives are scripts that you can create to provide custom keepalives for your specific service requirements. To create the scripts, use the rich CSS Scripting Language that is included in your CSS software. For details on using the CSS Scripting Language, including using socket commands and examples of keepalive scripts, refer to the Cisco Content Services Switch Administration Guide.
Currently, a CSS provides keepalives for FTP, HTTP, ICMP, SSL, and TCP. For information on configuring keepalive messages, see the "CSS Keepalive Overview" section earlier in this chapter.
Using script keepalives allow you to extend the CSS keepalive functionality beyond the default keepalives. For example, you can develop a script specifically to connect a CSS to a Post Office Protocol 3 (POP3) mail server.
Once you create a script offline, you can upload it to the CSS and configure the script keepalive option on a service.
The CSS supports a maximum of 256 script keepalives. If you specify a script to parse the output for each executed command, you can configure only 16 keepalives that use script output.
Note
You can also configure a script keepalive without having the corresponding script present on the CSS. In this case, a constant Down state remains on the service until you upload the appropriate script to the CSS. This allows you to develop and implement a configuration before uploading all the scripts to the CSS.
Script Keepalive Considerations
When you configure a script keepalive, follow the same general guidelines as those for keepalive types, with the exceptions noted in these sections. For details on keepalives, see the "CSS Keepalive Overview" section earlier in this chapter.
•
The CSS provides scripted keepalives to support the need for keepalives operations that cannot be handled using non-scripted keepalives. We recommend that you limit I/O operations in a scripted keepalive to socket operations used to probe network connectivity to a server and for determining application health on a server. Although the scripting language supports file I/O on the CSS hard drive or flash drive, we recommend that you do not use file I/O operations within scripted keepalives. Extensive file I/O operations within scripted keepalives may cause services to transition. File system access is allowed in scripts executed from the CLI or from the command scheduler.
•
The CSS Scripting Language allows you to pass 128 characters in a quoted argument. Assuming an average of seven characters per argument (plus a space delimiter), you can potentially use a maximum of 16 arguments in one script.
•
The CSS executes each line in a script keepalive. If your application requires numerous script keepalives (for example, greater than 60), keep each script as short and concise as possible. A smaller script yields much faster script execution results than a larger size script. To maximize CSS system performance, avoid complex protocols or extensive scripts (for example, no database queries, not performing a full login with validation), which can take the CSS longer to execute.
•
Use the script naming convention of ap-kal-type, so that when you press Tab or "?", you can easily see the keepalive scripts available for use. For example, an SMTP script would be named ap-kal-smtp. The script name can have a maximum of 32 characters. The arguments must be in a quoted text string with a maximum of 128 characters.
•
For the configured script keepalive to find the corresponding script, the script must reside in the /<current running version>/script directory. When you configure a script keepalive, use only script names. (A CSS does not accept path names.) If the script is present elsewhere on the CSS, the script keepalive assumes it does not exist.
To see a complete list of all scripts available in the /<current running version>/script directory, press the Tab key or "?". Optionally, you can type a script name not found in the list, then you can upload the script later. You can manipulate scripts using the archive, clear, and copy commands. You can also upload a script from a local hard drive to the /script directory on the CSS, or download a script from the /script directory on the CSS to a local hard drive.
•
Because many scripts have a multistep process such as connecting, sending a request, and waiting for a specific type of response, configure a higher frequency time value for script keepalives than for standard keepalives. A time interval of 10 seconds or higher ensures that the script keepalive has enough time to finish. Otherwise, state transitions may occur more often than is usual.
•
The CSS sends keepalives only to the first address in a service range. If you configure a service with a range of IP addresses and configure a script keepalive with an IP address to it, the address must be the first address in a service range.
•
Because a CSS reads an entire script into memory, there is a maximum script keepalive size of 200 KB (approximately 6,000 lines). If a script exceeds this limit, it will not load. This should be more than adequate for all applications. For example, the script keepalives included with your CSS software are approximately 1 KB. To further conserve CSS memory, services can share a common script keepalive so that only one instance of the script needs to reside in memory. However, you must configure the script keepalive for each service where you want the script to run.
Note
For a large number of services that use script keepalives, use a smaller subset of global keepalives to handle the work for them. For information on global keepalives, see the "Configuring Global Keepalives" section earlier in this chapter.
Configuring Script Keepalives
Script keepalives are scripts that you can create to provide custom keepalives for your specific service requirements. Use the keepalive type script command to configure script keepalives. The syntax for this service configuration mode command is:
keepalive type script script_name {"arguments"} {use-output}
Enter the name of an existing script keepalive. The optional arguments variable passes arguments into the keepalive script. Enter a quoted text string with a maximum of 128 characters including spaces.
The optional use-output keyword allows the script to parse the output for each executed command. This optional keyword allows the use of grep and file direction within a script. You can configure a maximum of 16 script keepalives (out of a maximum of 255 script keepalives) to use script output. By default, the script does not parse the output.
For example, to configure a script keepalive named ap-kal-httplist, enter:
(config-service[serv1)# keepalive type script ap-kal-httplist
"10.10.102.105 /default.htm"
In the previous example, the keepalive command configures the serv1 service keepalive to be of type script with the script name ap-kal-httplist and the arguments "10.10.102.105 /default.htm". The output is not parsed by the script.
To disable a script keepalive on a service, enter:
(config-service[serv1])# keepalive type none
Viewing a Script Keepalive in a Service
When you add a script keepalive to a service, the CSS recognizes that the script is the keepalive for the service in the show service screen. The script name appears in the Keepalive field, and any potential arguments appear directly below in the Script Arguments field. If there are no script arguments, then the Script Arguments field does not appear.
For example, enter:
(config-service[serv1])# show service
Rule (10.10.102.105 ANY ANY)
Session Redundancy: Disabled
Redirect String:
Keepalive: (SCRIPT ap-kal-httplist 10 3 5)
Script Arguments: "10.10.102.105 /default.htm"
Script Run Time: 1 second
Script Using Output Parsing: No
Last Clearing of Stats Counters 03/15/2002 13:45:01
Mtu: 1500 State Transitions: 0
Connections: 0 Max Connections: 0
Total Connections: 0 Total Reused Conns: 0
Note
If a script keepalive terminates with an error, you can use the Script Error and Script Run Time fields to help troubleshoot the problem.
You can also use the show running-config command to display the script keepalive and its arguments.
For example, enter:
(config-service[serv1])# show running-config
keepalive type script ap-kal-httplist "10.10.102.105
The example above shows the script keepalive and arguments that have been configured on a service. If no arguments are specified in the script, then the quoted text following the script name will not appear.
Script Keepalive Status Codes
A script can return a status code of zero or non-zero. On a return of non-zero, the CSS flags the service state as Dying or Down; on a return of zero, the CSS flags the service state as Alive. For example, enter:
! Connect to the remote host
socket connect host einstein port 25 tcp
Because the above script fails when it executes the exit command, the script returns a non-zero value. By default, the script will fail with a syntax error if the connect command fails. Be sure to check the logic of your scripts to ensure that the CSS returns the correct value.
Script Keepalives and Upgrading WebNS Software
When you upgrade the WebNS software in your CSS, the upgrade process creates a new /<current running version>/script directory. You must copy your custom scripts (including custom script keepalives) to the new /<current running version>/script directory so that the CSS can find them.
Use the following procedure to ensure that your custom script keepalives operate properly after upgrading the software.
1.
Upgrade the WebNS software in your CSS. Refer to the Cisco Content Services Switch Administration Guide.
2.
Copy the scripts from the old /<current running version>/script directory to the new /<current running version>/script directory.
3.
Reboot the CSS.