action string through D Commands

action string compare

To compare two unequal strings when an Embedded Event Manager (EEM) applet is triggered, use the actionstringcomparecommand in applet configuration mode. To disable this function, use the no form of this command.

actionlabelstringcompare [nocase]
[ lengthinteger ]
string1string2

noactionlabelstringcompare

Syntax Description

label

Unique identifier that can be any string value. Actions are sorted and run in ascending alphanumeric key sequence using the label as the sort key. If the string contains embedded blanks, enclose it in double quotation marks.

nocase

(Optional) Specifies case insensitive comparison.

length

(Optional) Limits the comparison to the first integer character.

integer

(Optional) Valid values for the length argument range from 1 to 4294967295.

string1

Sequence of characters.

string2

Sequence of characters.

Command Default

Unequal strings are not compared.

Command Modes

Applet configuration (config-applet)

Command History

Release

Modification

12.4(22)T

This command was introduced.

12.2(33)SRE

This command was integrated into Cisco IOS Release 12.2(33)SRE.

Usage Guidelines

String comparisons are performed on a byte-by-byte basis from left to right. If the strings are of unequal length, the longer string is compared greater than the shorter string. The actionstringcompare command forces a comparison between two unequal strings, which is followed by an integer comparison of the result of the string comparison.

When two equal strings are compared, the result is 0 and when one string sorts before the other, the result is -1. For all other comparisons the result is 1. If the strings being compared are converted to integers, the comparison is performed between the results using the strcmp command.

The table below shows the built-in variable in which the results of the actionstringcompare command are stored.

Table 1 EEM Built-in Variables for action string compare Command

Built-in Variable

Description

$_string_result

The result of the actionstringcompare command is stored in this variable.

Related Commands

Command

Description

eventmanagerapplet

Registers an event applet with the EEM and enters applet configuration mode.

action string equal

To verify whether or not two strings are equal when an Embedded Event Manager (EEM) applet is triggered, use the actionstringequalcommand in applet configuration mode. To disable this function, use the no form of this command.

actionlabelstringequal [nocase]
[ lengthinteger ]
string1string2

noactionlabelstringequal

Syntax Description

label

Unique identifier that can be any string value. Actions are sorted and run in ascending alphanumeric key sequence using the label as the sort key. If the string contains embedded blanks, enclose it in double quotation marks.

nocase

(Optional) Specifies case insensitive comparison.

length

(Optional) Specifies the length of the value to limit the comparison.

integer

(Optional) Valid values for the length argument range from 1 to 4294967295.

string1

Sequence of characters. If the string contains embedded blanks, enclose it in double quotation marks.

string2

Sequence of characters. If the string contains embedded blanks, enclose it in double quotation marks.

Command Default

Strings are not verified as equal.

Command Modes

Applet configuration (config-applet)

Command History

Release

Modification

12.4(22)T

This command was introduced.

12.2(33)SRE

This command was integrated into Cisco IOS Release 12.2(33)SRE.

Usage Guidelines

The actionstringequal command compares two strings and returns 1 if the strings are equal. Use nocase for case insensitive comparison.

The table below shows the built-in variable in which the results of the actionstringequal command are stored.

Table 2 EEM Built-in Variables for action string equal Command

Built-in Variable

Description

$_string_result

The result of the actionstringequal command is stored in this variable.

Examples

The following example shows how to verify whether or not two strings are equal:

Related Commands

Command

Description

eventmanagerapplet

Registers an event applet with the EEM and enters applet configuration mode.

action string first

To return the index on the first occurrence of string1 within string2 when an Embedded Event Manager (EEM) applet is triggered, use the actionstringfirst command in applet configuration mode. To disable this function, use the no form of this command.

actionlabelstringfirststring1string2 [index-value]

noactionlabelstringfirst

Syntax Description

label

Unique identifier that can be any string value. Actions are sorted and run in ascending alphanumeric key sequence using the label as the sort key. If the string contains embedded blanks, enclose it in double quotation marks.

string1

Sequence of characters. If the string contains embedded blanks, enclose it in double quotation marks.

string2

Sequence of characters. If the string contains embedded blanks, enclose it in double quotation marks.

index-value

(Optional) The index value to start the first test. Number in the range from 0 to 4294967295.

Command Default

The index is not returned on the first occurrence of string1 within string2.

Command Modes

Applet configuration (config-applet)

Command History

Release

Modification

12.4(22)T

This command was introduced.

12.2(33)SRE

This command was integrated into Cisco IOS Release 12.2(33)SRE.

Usage Guidelines

On the first occurrence of string1, the index is placed in string2. If string1 is not found, it returns -1.

The table below shows the built-in variable in which the results of the actionstringfirst command are stored.

Table 3 EEM Built-in Variables for action string first Command

Built-in Variable

Description

$_string_result

The result of the actionstringfirst command is stored in this variable.

Examples

The following example shows how to return the index on the first occurrence of string1 within string2:

Related Commands

Registers an event applet with the EEM and enters applet configuration mode.

action string index

To return the characters specified at a given index value when an Embedded Event Manager (EEM) applet is triggered, use the actionstringindexcommand in applet configuration mode. To disable this function, use the no form of the command.

actionlabelstringindexstring
[ value | end ]

noactionlabelstringindex

Syntax Description

label

Unique identifier that can be any string value. Actions are sorted and run in ascending alphanumeric key sequence using the label as the sort key. If the string contains embedded blanks, enclose it in double quotation marks.

string

Sequence of characters. If the string contains embedded blanks, enclose it in double quotation marks.

value

(Optional) The index value. Number in the range from 0 to 4294967295. The count starts from 0.

end

(Optional) Last character of the string.

Command Default

The characters specified at a given index value are not returned.

Command Modes

Applet configuration (config-applet)

Command History

Release

Modification

12.4(22)T

This command was introduced.

12.2(33)SRE

This command was integrated into Cisco IOS Release 12.2(33)SRE.

Usage Guidelines

The index count starts from zero. Use the end argument for the last character of the string.

The table below shows the built-in variable in which the actionstringindex command stores the characters.

Table 4 EEM Built-in Variables for action string index Command

Built-in Variable

Description

$_string_result

The actionstringindex command stores the characters in this variable.

Examples

The following example shows how to return the character specified at a given index value:

Related Commands

Command

Description

eventmanagerapplet

Registers an event applet with the EEM and enters applet configuration mode.

action string last

To return the index on the last occurrence of string1 within string 2 when an Embedded Event Manager (EEM) applet is triggered, use the actionstringlastcommand in applet configuration mode. To disable this function, use the no form of this command.

actionlabelstringlaststring1string2 [index-value]

noactionlabelstringlast

Syntax Description

label

Unique identifier that can be any string value. Actions are sorted and run in ascending alphanumeric key sequence using the label as the sort key. If the string contains embedded blanks, enclose it in double quotation marks.

string1

Sequence of characters. If the string contains embedded blanks, enclose it in double quotation marks.

string2

Sequence of characters. If the string contains embedded blanks, enclose it in double quotation marks.

index-value

(Optional) The index value to start the last test. Number in the range from 0 to 4294967295.

Command Default

The index is not returned on the last occurrence of string1 within string2.

Command Modes

Applet configuration (config-applet)

Command History

Release

Modification

12.4(22)T

This command was introduced.

12.2(33)SRE

This command was integrated into Cisco IOS Release 12.2(33)SRE.

Usage Guidelines

On the first occurrence of string1, the index is placed in string2. If string1 is not found, it returns -1.

The table below shows the built-in variable in which the results of the actionstringlast command are stored.

Table 5 EEM Built-in Variables for action string last Command

Built-in Variable

Description

$_string_result

The result of the actionstringlast command is stored in this variable.

Examples

The following example shows how to return the index on the last occurrence of string1 within string2:

Related Commands

Registers an event applet with the EEM and enters applet configuration mode.

action string length

To return the number of characters in a string when the Embedded Event Manager (EEM) applet is triggered, use the actionstringlengthcommand in applet configuration mode. To disable this function, use the no form of this command.

actionlabelstringlengthstring

noactionlabelstringlength

Syntax Description

label

Unique identifier that can be any string value. Actions are sorted and run in ascending alphanumeric key sequence using the label as the sort key. If the string contains embedded blanks, enclose it in double quotation marks.

string

Sequence of characters. If the string contains embedded blanks, enclose it in double quotation marks.

Command Default

The number of characters in a string are not returned.

Command Modes

Applet configuration (config-applet)

Command History

Release

Modification

12.4(22)T

This command was introduced.

12.2(33)SRE

This command was integrated into Cisco IOS Release 12.2(33)SRE.

Usage Guidelines

Use the actionstringlength command to specify the action of returning the number of characters in a string when an EEM applet is triggered.

The table below shows the built-in variable in which the results of the actionstringlength command are stored.

Table 6 EEM Built-in Variables for action string length Command

Built-in Variable

Description

$_string_result

The result of the actionstringlength command is stored in this variable.

Examples

The following example shows how to return the number of characters in a string:

Related Commands

Command

Description

eventmanagerapplet

Registers an event applet with the EEM and enters applet configuration mode.

action string match

To return 1 to the $_string_result, if the string matches the pattern when an Embedded Event Manager (EEM) applet is triggered, use the actionstringmatch command in applet configuration mode. To disable this action, use the no form of this command.

actionlabelstringmatch [nocase] string-patternstring

noactionlabelstringmatch

Syntax Description

label

Unique identifier that can be any string value. Actions are sorted and run in ascending alphanumeric key sequence using the label as the sort key. If the string contains embedded blanks, enclose it in double quotation marks.

nocase

(Optional) Specifies case insensitive comparison.

string-pattern

The pattern for case insensitive comparison.

string

Sequence of characters. If the string contains embedded blanks, enclose it in double quotation marks.

Command Default

Results of the pattern matching of strings are not returned to the $_string_result.

Command Modes

Applet configuration (config-applet)

Command History

Release

Modification

12.4(22)T

This command was introduced.

12.2(33)SRE

This command was integrated into Cisco IOS Release 12.2(33)SRE.

Usage Guidelines

When the string matches the specified pattern, the result is 1; when the pattern does not match, the result is 0.

The table below shows the built-in variable in which the results of the actionstringmatchcommand is stored.

Table 7 EEM Built-in Variables for action string match Command

Built-in Variable

Description

$_string_result

The result of theactionstringmatch command is stored in this variable.

Examples

The following example shows how to return 1 to the $_string_result if the string matches the pattern:

Related Commands

Command

Description

eventmanagerapplet

Registers an event applet with the EEM and enters applet configuration mode.

action string range

To store a range of characters in a string when an Embedded Event Manager (EEM) applet is triggered, use the actionstringrange command in a pplet configuration mode . To disable this function, use the no form of this command.

actionlabelstringrangestringstart-indexend-index

noactionlabelstringrange

Syntax Description

label

Unique identifier that can be any string value. Actions are sorted and run in ascending alphanumeric key sequence using the label as the sort key. If the string contains embedded blanks, enclose it in double quotation marks.

string

Sequence of characters which can be up to 4294967295. If the string contains embedded blanks, enclose it in double quotation marks.

start-index

The starting index string value. The range is from 0 to 4294967295.

end-index

The ending index string value. The range is from 0 to 4294967295.

Command Default

A string is not stored.

Command Modes

Applet configuration (config-applet)

Command History

Release

Modification

12.4(22)T

This command was introduced.

12.2(33)SRE

This command was integrated into Cisco IOS Release 12.2(33)SRE.

Usage Guidelines

Use the actionstringrange command to specify the action of storing a range of characters in a string when an EEM applet is triggered. The start-index and end-indexarguments specify the range of the string on which to operate.

The table below shows the built-in variable in which the result of the actionstringrange command is stored.

Table 8 EEM Built-in Variables for action string range Command

Built-in Variable

Description

$_string_result

The result of the actionstringrange command is stored in this variable.

Examples

The following example shows how to store a range of characters in a specified string:

Related Commands

Command

Description

eventmanagerapplet

Registers an event applet with the EEM and enters applet configuration mode.

action string replace

To store a new string by replacing the range of characters in the specified string when an Embedded Event Manager (EEM) applet is triggered, use the actionstringreplacecommand in applet configuration mode. To disable this function, use the no form of this command.

actionlabelstringreplacestringstart-indexend-index [new-string]

noactionlabelstringreplace

Syntax Description

label

Unique identifier that can be any string value. Actions are sorted and run in ascending alphanumeric key sequence using the label as the sort key. If the string contains embedded blanks, enclose it in double quotation marks.

string

Sequence of characters, which can be up to 4294967295. If the string contains embedded blanks, enclose it in double quotation marks.

start-index

The starting index string value. The range is from 0 to 4294967295.

end-index

The ending index string value. The range is from 0 to 4294967295.

new-string

(Optional) The sequence of characters that will replace the range of characters in the string.

Command Default

A string is not stored.

Command Modes

Applet configuration (config-applet)

Command History

Release

Modification

12.4(22)T

This command was introduced.

12.2(33)SRE

This command was integrated into Cisco IOS Release 12.2(33)SRE.

Usage Guidelines

Use the actionstringreplace command to get a new string by replacing specific characters in a particular string. If the value for new-string argument is not specified, the characters are replaced with white space.

The table below shows the built-in variable in which the result of the actionstringreplace command is stored.

Table 9 EEM Built-in Variables for action string replace Command

Built-in Variable

Description

$_string_result

The result of the actionstringreplace command is stored in this variable.

Examples

The following example shows how to store the new string made by replacing the specific characters in a string:

Related Commands

Command

Description

eventmanagerapplet

Registers an event applet with the EEM and enters applet configuration mode.

action string tolower

To store a specific range of characters of a string in lowercase when an Embedded Event Manager (EEM) applet is triggered, use the actionstringtolowercommand in applet configuration mode. To disable this function, use the no form of this command.

actionlabelstringtolowerstring [start-index] [end-index]

noactionlabelstringtolower

Syntax Description

label

Unique identifier that can be any string value. Actions are sorted and run in ascending alphanumeric key sequence using the label as the sort key. If the string contains embedded blanks, enclose it in double quotation marks.

string

The sequence of characters that needs to be replaced. If the string contains embedded blanks, enclose it in double quotation marks.

start-index

(Optional) The starting index string value. The range is from 0 to 4294967295.

end-index

(Optional) The ending index string value. The range is from 0 to 4294967295.

Command Default

A string is not stored.

Command Modes

Applet configuration (applet-config)

Command History

Release

Modification

12.4(22)T

This command was introduced.

12.2(33)SRE

This command was integrated into Cisco IOS Release 12.2(33)SRE.

Usage Guidelines

Use the actionstringtolower command to store a specific range of characters of a string in lowercase. The start-index and end-index arguments specify the range of the string on which to operate.

The table below shows the built-in variable in which the result of the actionstringtolower command is stored.

Table 10 EEM Built-in Variables for action string tolower Command

Built-in Variable

Description

$_string_result

The result of the actionstringtolower command is stored in this variable.

Examples

The following example shows how to store a range of characters in a specific string in lowercase:

Related Commands

Registers an event applet with the EEM and enters applet configuration mode.

action string toupper

To store a specific range of characters of a string in uppercase when an Embedded Event Manager (EEM) applet is triggered, use the actionstringtouppercommand in applet configuration mode. To disable this function, use the no form of this command.

actionlabelstringtoupperstring [start-index] [end-index]

noactionlabelstringtoupper

Syntax Description

label

Unique identifier that can be any string value. Actions are sorted and run in ascending alphanumeric key sequence using the label as the sort key. If the string contains embedded blanks, enclose it in double quotation marks.

string

Specifies the sequence of characters, that needs to be replaced. If the string contains embedded blanks, enclose it in double quotation marks.

start-index

(Optional) The starting index string value. The range is from 0 to 4294967295.

end-index

(Optional) The ending index string value. The range is from 0 to 4294967295.

Command Default

A string is not stored.

Command Modes

Applet configuration (config-applet)

Command History

Release

Modification

12.4(22)T

This command was introduced.

12.2(33)SRE

This command was integrated into Cisco IOS Release 12.2(33)SRE.

Usage Guidelines

Use the actionstringtoupper command to store a specific range of characters of a string in uppercase. The start-index and end-index arguments specify the range of the string on which to operate.

The table below shows the built-in variable in which the result of the actionstringtoupper command is stored.

Table 11 EEM Built-in Variables for action string toupper Command

Built-in Variable

Description

$_string_result

The result of the actionstringtoupper command is stored in this variable.

Examples

The following example shows how to store a range of characters in a specific string in uppercase:

Related Commands

Registers an event applet with the EEM and enters applet configuration mode.

action string trim

To trim a string when an Embedded Event Manager (EEM) applet is triggered, use the actionstringtrim command in applet configuration mode. To disable this function, use the no form of this command.

actionlabelstringtrimstring1 [string2]

noactionlabelstringtrim

Syntax Description

label

Unique identifier that can be any string value. Actions are sorted and run in ascending alphanumeric key sequence using the label as the sort key. If the string contains embedded blanks, enclose it in double quotation marks.

string1

Sequence of characters. If the string contains embedded blanks, enclose it in double quotation marks.

string2

(Optional) Sequence of characters. If the string contains embedded blanks, enclose it in double quotation marks.

Command Default

By default, there is no action to trim a string.

Command Modes

Applet configuration (config-applet)

Command History

Release

Modification

12.4(22)T

This command was introduced.

12.2(33)SRE

This command was integrated into Cisco IOS Release 12.2(33)SRE.

Usage Guidelines

Use the actionstringtrim command to trim the characters in a string. This command trims the characters in string2 from both ends of string1. By default, string2 corresponds to white space.

The table below shows the built-in variable in which the result of the actionstringtrim command is stored.

Table 12 EEM Built-in Variables for action string trim Command

Built-in Variable

Description

$_string_result

The result of the actionstringtrim command is stored in this variable.

Related Commands

Trims the characters by one string from the left end of another string.

actionstringtrimright

Trims the characters by one string from the right end of another string.

eventmanagerapplet

Registers an event applet with the EEM and enters applet configuration mode.

action string trimleft

To trim the characters of one string from the left end of another string when an Embedded Event Manager (EEM) applet is triggered, use the actionstringtrimleftcommand in applet configuration mode. To disable this function, use the no form of this command.

actionlabelstringtrimleftstring1 [string2]

noactionlabelstringtrimleft

Syntax Description

label

Unique identifier that can be any string value. Actions are sorted and run in ascending alphanumeric key sequence using the label as the sort key. If the string contains embedded blanks, enclose it in double quotation marks.

string1

Sequence of characters. If the string contains embedded blanks, enclose it in double quotation marks.

string2

(Optional) Sequence of characters. If the string contains embedded blanks, enclose it in double quotation marks.

Command Default

By default, there is no action to trim a string.

Command Modes

Applet configuration (config-applet)

Command History

Release

Modification

12.4(22)T

This command was introduced.

12.2(33)SRE

This command was integrated into Cisco IOS Release 12.2(33)SRE.

Usage Guidelines

Use the actionstringtrimleft command to trim a string from the left end of another string. This command trims the characters specified by string2 from the left end of string1. By default, string2 corresponds to white space.

The table below shows the built-in variable in which the result of the actionstringtrimleft command is stored.

Table 13 EEM Built-in Variables for action string trimleft Command

Built-in Variable

Description

$_string_result

The result of the actionstringtrimleft command is stored in this variable.

Examples

The following example shows how to trim a string from the left side of another string:

Related Commands

Trims the characters by one string from the right end of another string.

eventmanagerapplet

Registers an event applet with the EEM and enters applet configuration mode.

action string trimright

To trim the characters one string from the right end of another string when an Embedded Event Manager (EEM) applet is triggered, use the actionstringtrimrightcommand in applet configuration mode. To disable this function, use the no form of this command.

actionlabelstringtrimrightstring1 [string2]

noactionlabelstringtrimright

Syntax Description

label

Unique identifier that can be any string value. Actions are sorted and run in ascending alphanumeric key sequence using the label as the sort key. If the string contains embedded blanks, enclose it in double quotation marks.

string1

Sequence of characters. If the string contains embedded blanks, enclose it in double quotation marks.

string2

(Optional) Sequence of characters. If the string contains embedded blanks, enclose it in double quotation marks.

Command Default

By default, there is no action to trim a string.

Command Modes

Applet configuration (config-applet)

Command History

Release

Modification

12.4(22)T

This command was introduced.

12.2(33)SRE

This command was integrated into Cisco IOS Release 12.2(33)SRE.

Usage Guidelines

Use the actionstringtrimright command to trim a string from the right end of another string. This command trims the characters specified by string2 from the right end of string1. By default, string2 corresponds to white space.

The table below shows the built-in variable in which the result of the actionstringtrimright command is stored.

Table 14 EEM Built-in Variables for action string trimright Command

Built-in Variable

Description

$_string_result

The result of the actionstringtrimright command is stored in this variable.

Examples

The following example shows how to trim a string from the right side of another string:

Related Commands

Trims the characters by one string from the left end of another string.

eventmanagerapplet

Registers an event applet with the EEM and enters applet configuration mode.

action subtract

To specify the action of subtracting the value of a variable from another value, when an Embedded Event Manager (EEM) applet is triggered, use the actionsubtractcommand in applet configuration mode. To undo the subtract action, use the no form of this command.

Syntax Description

label

Unique identifier that can be any string value. Actions are sorted and run in ascending alphanumeric key sequence using the label as the sort key. If the string contains embedded blanks, enclose it in double quotation marks.

subtract

Subtracts the value of a variable from the value of another variable.

variable-name

String value to be placed as the variable name.

long-integer

Long integer value by which another value gets subtracted.

Command Default

By default, there is no change in the value of variables configured within an EEM applet.

Command Modes

Applet configuration (config-applet)

Command History

Release

Modification

12.4(22)T

This command was introduced.

12.2(33)SRE

This command was integrated into Cisco IOS Release 12.2(33)SRE.

Usage Guidelines

You can use this action to subtract the value of a variable from the value of another variable. The result is stored in the variable named $_result. The value of the variable must be a long integer, else the action will fail.

Examples

The following example shows how to configure an EEM applet to subtract the value of a variable from another value:

Related Commands

action track read

To specify the action of reading the state of a tracked object when an Embedded Event Manager (EEM) applet is triggered, use the actiontrackreadcommand in applet configuration mode. To remove the actiontrackread command from the configuration, use the no form of this command.

actionlabeltrackreadobject-number

noactionlabeltrackreadobject-number

Syntax Description

label

Unique identifier that can be any string value. Actions are sorted and run in ascending alphanumeric key sequence using the label as the sort key. If the string contains embedded blanks, enclose it in double quotation marks.

object-number

Tracked object number in the range from 1 to 500, inclusive. The number is defined using the trackstub command.

Command Default

The state of a tracked object is not read.

Command Modes

Applet configuration (config-applet)

Command History

Release

Modification

12.4(2)T

This command was introduced.

12.2(31)SB3

This command was integrated into Cisco IOS Release 12.2(31)SB3.

12.2(33)SRB

This command was integrated into Cisco IOS Release 12.2(33)SRB.

12.2(33)SXI

This command was integrated into Cisco IOS Release 12.2(33)SXI.

Usage Guidelines

This command generates the following result variable:

_track_state--State of the specified tracked object. The text string returned is either up or down. If the state is up, it means that the object exists and is in an up state. If the state is down, it means that the object either does not exist or is in a down state.

This command is used to help track objects using EEM. Each tracked object is identified by a unique number that is specified on the tracking command-line interface (CLI). Client processes such as EEM use this number to track a specific object. The tracking process periodically polls the tracked objects and notes any change of value. The changes in the tracked object are communicated to interested client processes, either immediately or after a specified delay. The object values are reported as either up or down. The enhanced object tracking event detector publishes an EEM event when the tracked object changes.

Examples

The following example shows how to specify event criteria based on a tracked object:

action track set

To specify the action of setting the state of a tracked object when an Embedded Event Manager (EEM) applet is triggered, use the actiontracksetcommand in applet configuration mode. To remove the actiontrackset command from the configuration, use the no form of this command.

actionlabeltracksetobject-numberstate
{ up | down }

noactionlabeltracksetobject-numberstate
{ up | down }

Syntax Description

label

Unique identifier that can be any string value. Actions are sorted and run in ascending alphanumeric key sequence using the label as the sort key. If the string contains embedded blanks, enclose it in double quotation marks.

object-number

Tracked object number in the range from 1 to 500, inclusive. The number is defined using the trackstub command.

state

Specifies the state to which the tracked object will be set.

up

Specifies that the state of the tracked object will be set to up.

down

Specifies that the state of the tracked object will be set to down.

Command Default

The state of a tracked object is not set.

Command Modes

Applet configuration (config-applet)

Command History

Release

Modification

12.4(2)T

This command was introduced.

12.2(31)SB3

This command was integrated into Cisco IOS Release 12.2(31)SB3.

12.2(33)SRB

This command was integrated into Cisco IOS Release 12.2(33)SRB.

12.2(33)SXI

This command was integrated into Cisco IOS Release 12.2(33)SXI.

Usage Guidelines

This command generates the following result variable:

_track_state--State of the specified tracked object. The text string returned is either up or down. If the state is up, it means that the object exists and is in an up state. If the state is down, it means that the object either does not exist or is in a down state.

This command is used to help track objects using EEM. Each tracked object is identified by a unique number that is specified on the tracking command-line interface (CLI). Client processes such as EEM use this number to track a specific object. The tracking process periodically polls the tracked objects and notes any change of value. The changes in the tracked object are communicated to interested client processes, either immediately or after a specified delay. The object values are reported as either up or down. The enhanced object tracking event detector publishes an EEM event when the tracked object changes.

Examples

The following example shows how to specify event criteria based on a tracked object:

action while

To identify the beginning of a loop of a conditional block when an Embedded Event Manager (EEM) applet is triggered, use the actionwhilecommand in a pplet configuration mode . To disable this function, use the no form of this command.

actionlabelwhilestring-op1operatorstring-op2

noactionlabelwhile

Syntax Description

label

Unique identifier that can be any string value. Actions are sorted and run in ascending alphanumeric key sequence using the label as the sort key. If the string contains embedded blanks, enclose it in double quotation marks.

string-op1

Specifies the first operand.

operator

Value used with the string-op1 and string-op2 operands that determines how the current counter value is compared to the entry value or the exit value. Valid values are:

gt--Greater than.

ge--Greater than or equal to.

eq--Equal to.

ne--Not equal to.

lt--Less than.

le--Less than or equal to.

string-op2

The second operand.

Command Default

No conditional block is specified.

Command Modes

Applet configuration (config-applet)

Command History

Release

Modification

12.4(22)T

This command was introduced.

12.2(33)SRE

This command was integrated into Cisco IOS Release 12.2(33)SRE.

Usage Guidelines

Use the actionwhile command to identify the beginning of a loop conditional block. If $_variable is found within a string, it will be substituted before the expression is tested.

Examples

The following example shows how to identify the beginning of a loop of a conditional block when an EEM applet is triggered:

Related Commands

Identifies the beginning of an else block in the if/else conditional block.

actionelseif

Identifies the beginning of the if/else conditional block.

actionif

Identifies the beginning of an if conditional block.

eventmanagerapplet

Registers an event applet with the EEM and enters applet configuration mode.

attribute (EEM)

To specify a complex event for an Embedded Event Manager (EEM) applet, use the attributecommand in trigger applet configuration mode. To remove the attributes, use the no form of this command.

attributetagevent-tag
[ occursoccurs-value ]

noattributetagevent-tag
[ occursoccurs-value ]

Syntax Description

tag

Specifies a tag using the event-tag argument that can be used with the attribute command to associate an event.

event-tag

String that identifies the tag.

occurs

(Optional) Specifies the number of occurrences before an EEM event is triggered. If not specified, an EEM event is triggered on the first occurrence.

occurs-value

(Optional) Number in the range from 1 to 4294967295.

Command Default

No complex events are specified for an EEM applet.

Command Modes

Trigger applet configuration (config-applet-trigger)

Command History

Release

Modification

12.4(20)T

This command was introduced.

12.2(33)SRE

This command was integrated into Cisco IOS Release 12.2(33)SRE.

Usage Guidelines

In the trigger applet configuration mode, up to eight attribute statements can be specified to build a complex event. If no attribute statements are specified, the options in the trigger statement apply to the first event defined in the applet.

Examples

The following example shows how to use the attribute command to specify a complex events for an EEM applet. In this example, the applet is run when the showbgpall command and any syslog message that contains the string “COUNT” occurs within a period of 60 seconds.

description (EEM)

To describe what an Embedded Event Manager (EEM) applet does, use the description (EEM) command in applet configuration mode. To remove the description of an applet, use the no form of this command.

descriptionline

nodescription

Syntax Description

line

A brief description of a policy, upto 240 characters.

Command Default

By default, no description is specified for an applet.

Command Modes

Applet configuration (config-applet)

Command History

Release

Modification

15.0(1)M

This command was introduced.

Usage Guidelines

Use this command to describe what an EEM applet does. It is valid to have applets without a description. The Description of an applet can be added in any order, before or after any other applet configuration. Configuring a new description for an applet that already has a description, overwrites the current description.

Examples

The following example shows how to add or modify the description for an EEM: