cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
2701
Views
5
Helpful
8
Replies

::cisco::eem::event_register_stat name ifstats-datarate

dean holroyd
Level 1
Level 1

Hello

Please can someone tell me the correct syntax for this registration on IOS XR 4.2?

::cisco::eem::event_register_stat name ifstats-datarate modifier_1 Gi0/3/0/2 modifier_2 InputPacketRate entry_op gt entry_val 100 exit_comb and exit_op ne exit_val 100 exit_time_sec 60 poll_interval_sec 5

I have a very simple script as follows, which I can never get to trigger

::cisco::eem::event_register_stat  name ifstats-datarate modifier_1 Gi0/3/0/2 modifier_2 InputPacketRate  entry_op gt entry_val 100 exit_comb and exit_op ne exit_val 100  exit_time_sec 60 poll_interval_sec 5

namespace import ::cisco::eem::*

namespace import ::cisco::lib::*

action_syslog msg "TRAFFIC LEVEL IS HIGH"

The documentation says that the / in the interface name in modifier_1 should be changed to an _ (Gi0_3_0_2), but this does not work for me either.

I can not find any examples of the use of "ifstats-datarate" searching the docs and google. I can only find mention of it in posts on this forum where also the posters cannot get it to work. Does anyone have a working script for "ifstats-datarate" ?

RP/0/1/CPU0:BORD1#sh ver | i XR

Fri Mar 15 01:31:46.896 UTC

Cisco IOS XR Software, Version 4.2.1[Default]

RP/0/1/CPU0:BORD1#sh event manager statistics-table ifstats-datarate | i InputPacketRate

Fri Mar 15 01:32:52.775 UTC

InputPacketRate          uint64    Input packets per second

Thanks

RP/0/1/CPU0:BORD1(config)#event manager policy 1.tcl username eem

RP/0/1/CPU0:BORD1(config)#commit

Fri Mar 15 01:37:42.110 UTC

RP/0/1/CPU0:Mar 15 01:37:43.766 : eem_ed_stats[191]: received msg : 130-FH_MSG_EVENT_PARSE_BUFFER ipc handle:65536

RP/0/1/CPU0:Mar 15 01:37:43.767 : eem_ed_stats[191]: fh_fd_process_server_msg ED REPLY : 131-FH_RPL_EVENT_PARSE_BUFFER

RP/0/1/CPU0:Mar 15 01:37:44.857 : eem_ed_stats[191]: received msg : 2-FH_MSG_EVENT_CREATE ipc handle:65536

RP/0/1/CPU0:Mar 15 01:37:44.858 : eem_ed_stats[191]: fh_fd_stats_event_create: re=500ac234, sid=59

RP/0/1/CPU0:Mar 15 01:37:44.859 : eem_ed_stats[191]: fh_fd_process_server_msg ED REPLY : 3-FH_RPL_EVENT_CREATE

RP/0/1/CPU0:Mar 15 01:37:45.044 : eem_ed_stats[191]: received msg : 6-FH_MSG_EVENT_REGISTER ipc handle:65536

RP/0/1/CPU0:Mar 15 01:37:45.045 : eem_ed_stats[191]: fh_fd_stats_event_register: re=500ac234, sid=59

RP/0/1/CPU0:Mar 15 01:37:45.046 : eem_ed_stats[191]: fh_fd_process_server_msg ED REPLY : 7-FH_RPL_EVENT_REGISTER

RP/0/1/CPU0:BORD1(config)#end

RP/0/1/CPU0:Mar 15 01:38:23.799 : eem_ed_stats[191]: fh_fd_process_server_msg ED REPLY : 21-FH_RPL_EVENT_DESCRIBE_ID

No.  Class     Type    Event Type          Trap  Time Registered           Name

1    script    user    statistics          Off   Fri Mar 15 01:37:45 2013  1.tcl

name {ifstats-datarate} modifier_1 {Gi0/3/0/2} modifier_2 {InputPacketRate}

entry_op gt entry_val {100} exit_comb and exit_op ne exit_val {100}

exit_time_sec 60 exit_time_nsec 0 poll_interval_sec 5 poll_interval_nsec 0

nice 0 queue-priority normal maxrun 20.000 scheduler rp_primary Secu none

persist_time: 3600 seconds,  username: eem

RP/0/1/CPU0:BORD1#sh int g0/3/0/2 | i rate

Fri Mar 15 01:39:32.167 UTC

  30 second input rate 4316000 bits/sec, 356 packets/sec

  30 second output rate 4316000 bits/sec, 356 packets/sec

RP/0/1/CPU0:BORD1#sh logg

Fri Mar 15 01:39:37.072 UTC

Syslog logging: enabled (0 messages dropped, 0 flushes, 0 overruns)

    Console logging: level debugging, 1357 messages logged

    Monitor logging: level debugging, 200 messages logged

    Trap logging: level informational, 0 messages logged

    Buffer logging: level debugging, 0 messages logged

Log Buffer (307200 bytes):

8 Replies 8

dean holroyd
Level 1
Level 1

the correct syntax for this is

::cisco::eem::event_register_stat name ifstats-datarate modifier_1 "GigabitEthernet0_3_0_2" modifier_2 "InputPacketRate" entry_op gt entry_val 100 exit_comb and exit_op le exit_val 100 exit_time_sec 60 poll_interval_sec 30

Thanks for the follow-up.  I had a request into IOS-XR development to look at this, but they hadn't got back to me yet.  I'll see if this works for the other thread on this topic.

I was testing on a lab GSR, but moved it to production ASR9K so I could raise a case via Cisco TAC

here is the complete script they sent me

::cisco::eem::event_register_stat name ifstats-datarate modifier_1 "TenGigE0_0_0_0" modifier_2 "InputDataRate" entry_op gt entry_val 100 exit_comb and exit_op ne exit_val 100 exit_time_sec 60 poll_interval_sec 5

namespace import ::cisco::eem::*

namespace import ::cisco::lib::*

# 1. query the information of latest triggered eem event

array set arr_einfo [event_reqinfo]

if {$_cerrno != 0} {

        set result [format "component=%s; subsys err=%s; posix err=%s;\n%s" \

        $_cerr_sub_num $_cerr_sub_err $_cerr_posix_err $_cerr_str]

error $result

}

set errorInfo ""

# 2. Notify Customer

set output_msg "TRAFFIC LEVEL IS HIGH"

action_syslog priority info msg $output_msg

# 3. execute the user-defined config commands

if [catch {cli_open} result] {

    error $result $errorInfo

} else {

    array set cli1 $result

}

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

    error $result $errorInfo

}

if [catch {cli_exec $cli1(fd) "interface TenGigE0/0/0/1.123"} result] {

    error $result $errorInfo

}

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

    error $result $errorInfo

}

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

    error $result $errorInfo

}

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

    error $result $errorInfo

}

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

    error $result $errorInfo

}

Hi, anyone, knows how to write and copy to the router ??

I don't understand.  You mean how to get this script onto the router?

Hi Dean, Could you help me to confirm my script?

 

I  would like to shutdown any interface, when this interface runs out of traffic in the input rate.

 

::cisco::eem::event_register_stat name ifstats-datarate modifier_1 "BE246" modifier_2 "InputLoad" entry_op lt entry_val 2 exit_comb and exit_op le exit_val 2 exit_time_sec 60 poll_interval_sec 30

 

Thanks!

Hi

You just need to add some CLI commands to do something (if that is what you are asking?

        if [catch {cli_open} result] {
            error $result $errorInfo
        } else {
            array set cli1 $result
        }
       
        if [catch {cli_exec $cli1(fd) "config t"} result] {
            error $result $errorInfo
        }
       
        action_syslog priority info msg $result
       
        if [catch {cli_exec $cli1(fd) "interface BE246"} result] {
            error $result $errorInfo
        }
       
        action_syslog priority info msg $result

 

      if [catch {cli_exec $cli1(fd) "shut"} result] {
            error $result $errorInfo
        }
       
        action_syslog priority info msg $result
       
        if [catch {cli_exec         if [catch {cli_exec $cli1(fd) "commit"} result] {
            error $result $errorInfo
        }

       action_syslog priority info msg $result

Thanks Dean!!

 

I mean, if my line ::cisco::eem... it is correct, is not?

 

so this will be my TCL file.

****************************************************************************************************


::cisco::eem::event_register_stat name ifstats-datarate modifier_1 "BE246" modifier_2 "InputLoad" entry_op lt entry_val 2 exit_comb and exit_op le exit_val 2 exit_time_sec 60 poll_interval_sec 30

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) "config t"} result] {
            error $result $errorInfo
        }
       
        action_syslog priority info msg $result
       
        if [catch {cli_exec $cli1(fd) "interface BE246"} result] {
            error $result $errorInfo
        }
       
        action_syslog priority info msg $result

 

      if [catch {cli_exec $cli1(fd) "shut"} result] {
            error $result $errorInfo
        }
       
        action_syslog priority info msg $result
       
        if [catch {cli_exec         if [catch {cli_exec $cli1(fd) "commit"} result] {
            error $result $errorInfo
        }

       action_syslog priority info msg $result

# 3. log a message                                                              
# Generar un log del cambio en la configuracion                                                         
# emerg|alert|crit|err|warning|notice|info|debug                                                                
set msg "Se apago la interface por pisible problema con el ISP favor de reportarlo"                                                              
action_syslog priority alert msg $msg 

 

 

 

 

Getting Started

Find answers to your questions by entering keywords or phrases in the Search bar above. New here? Use these resources to familiarize yourself with the community: