cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
1783
Views
0
Helpful
5
Replies

EEM Counter Names

I would like to create an EEM script that creates a syslog or trap when the AgPoliced-By counter increments under the "show mls qos protocol" command. It looks like maybe the 'event counter name x' may work, but I am having difficulty finding a list of the available counters, and if one of the counters would match the counter I'm seeking. Any help would be appreciated. Thanks.

5 Replies 5

Joe Clarke
Cisco Employee
Cisco Employee

No, the EEM counter is not what you want here.  You will need to parse the output of the "show mls qos protocol" command, extract the desired counter value, then check the value.  This could be doable using an EEM applet if the version of IOS supports EEM 3.0 or higher.  If not, you'll need to use Tcl.  For example, in Tcl, once you have the output, you'd do something like this:

if { [regexp {AgPoliced-By:\s+(\d+)} $output -> count] } {

    puts "AgPoliced-By value is $count"

}

Thanks Joe. I'm running s72033-adventerprisek9_wan-mz.122-33.SXI4 on a 6500 VSS-cluster. Can you give me a little more guidance?

Try this script:

::cisco::eem::event_register_none 

namespace import ::cisco::eem::*
namespace import ::cisco::lib::*


if [catch {cli_open} result] {
    error $result $errorInfo
} else {
    array set cli1 $result
}

if [catch {cli_exec $cli1(fd) "enable"} _cli_result] {
    error $_cli_result $errorInfo
}

if [catch {cli_exec $cli1(fd) "show mls qos protocol"} _cli_result] {
    error $_cli_result $errorInfo
}

set _regexp_result [regexp {AgPoliced-By:\s+([0-9]+)} $_cli_result ignore count]
if {$_regexp_result == 1} {
    # Perform any additional actions based on the counter value here.
    puts "AgPoliced-By value is $count"
}

# Close open cli before exit.
if [catch {cli_close $cli1(fd) $cli1(tty_id)} result] {
    error $result $errorInfo
}

Once registered, you'll run this script with:

event manager run SCRIPTNAME

Where SCRIPTNAME is the name of the script you used.  You should be able to get the idea of how the counter value is extracted.  Once you have it you can compare it to a threshold value and perform additional actions based on that.

Thanks Joe. What am I missing here?

C6513-LAB(config)#event manager directory user library "sup-bootdisk:/"

C6513-LAB(config)#even manager policy cl_cli_cmd.tcl type user

Embedded Event Manager configuration: policy file cl_cli_cmd.tcl could not be found

C6513-LAB(config)#even manager policy cl_cli_cmd.tcl type system

Embedded Event Manager configuration: policy file cl_cli_cmd.tcl could not be found

C6513-LAB#more sup-bootdisk:cl_cli_cmd.tcl

::cisco::eem::event_register_none

namespace import ::cisco::eem::*

namespace import ::cisco::lib::*

if [catch {cli_open} result] {

   error $result $errorInfo

} else {

   array set cli1 $result

}

if [catch {cli_exec $cli1(fd) "enable"} _cli_result] {

   error $_cli_result $errorInfo

}

if [catch {cli_exec $cli1(fd) "show mls qos protocol"} _cli_result] {

   error $_cli_result $errorInfo

}

set _regexp_result [regexp {AgPoliced-By:\s+([0-9]+)} $_cli_result ignore count]

if {$_regexp_result == 1} {

   # Perform any additional actions based on the counter value here.

        

   puts "AgPoliced-By value is $count"

}

# Close open cli before exit.

if [catch {cli_close $cli1(fd) $cli1(tty_id)} result] {

   error $result $errorInfo

}

C6513-LAB#

Your library command is not what you want.  Add this:

event manager directory user policy "sup-bootdisk:/"

Review Cisco Networking for a $25 gift card