cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
2429
Views
0
Helpful
1
Replies

EEM Scripting for error and drop counters

Afonso Aires
Cisco Employee
Cisco Employee

Hi,

We want to check the following counters for drops every 5 minutes and generate an alarm if a certain threshold of errors (example: increment of 100 in the error/drop counters in the last 5 minutes) is overcome:

My sample script is inline, i'm missing how to parse and generate the alarm if the threshold is surpassed:

Example command:

SPLAB_7600_3#remote command module 4 show platform hardware drops | include Selene|drp                

------ Selene 0 Channel 0 ------

Selene Ingress Drop Counters Ch[0]

Selene Egress Drop Counters Ch[0]

    egr_tot_fifo_drp_ctr                          25

Selene Drop Counters

------ Selene 1 Channel 0 ------

Selene Ingress Drop Counters Ch[0]

Selene Egress Drop Counters Ch[0]

Selene Drop Counters

Best Regards,

Afonso

::cisco::eem::event_register_timer watchdog time $check_interval nice 1

#------------------------------------------------------------------

# EEM policy to monitor a internal counters

#

# August 2012, Cisco Systems

#

# Copyright (c) 2012 by cisco Systems, Inc.

# All rights reserved.

#------------------------------------------------------------------

namespace import ::cisco::eem::*

namespace import ::cisco::lib::*

# 2. Execute the counter show commands

if [catch {cli_open} result] {

    error $result $errorInfo

} else {

    array set cli1 $result

}

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

    error $result $errorInfo

}

if [catch {cli_exec $cli1(fd) "cisco"} result] {

    error $result $errorInfo

}

# - - - - - -  Interface error counters

if [catch {cli_exec $cli1(fd) "remote command module x show platform hardware selene np-idx 0 counters | include drop"} result] {

        error $result $errorInfo

}

set egr_drp_ctr $result

#- Parsing and conditional programming for the generation of traps based on the drop value extracted from the show command

action_syslog priority info msg "Counter Alarm"

#Exit

if [catch {cli_exec $cli1(fd) "end"} result] {

    error $result $errorInfo

1 Reply 1

uranthaci
Level 1
Level 1

I believe this is what you are looking for:

set egr_drp_ctr $result

expr {$egr_drp_ctr + 100} sumof

if {$egr_drp_ctr >= $sumof}

    puts "Alarm"

It may need correction on the syntax , but thats the logic.