Wednesday, April 26, 2017

script to check packet count to CPU

Below script gather the infrormation of “show ipstats” regualraly ( every 10 sec ) and and generate the log if the number of packet to cpu is over 100.

disable clipaging

clear counters ipstats
set var temp $TCL(after [expr 10*1000])

set var CLI.OUT " "
show ipstats

set var flr_list $TCL(split ${CLI.OUT} "\n")
set var len $TCL(llength $flr_list)
set var ex_cnt $TCL(lindex $flr_list 1)
set var count2cpu $TCL(string range $ex_cnt 17 22)

if ($count2cpu > 100) then
create log entry "the count is over threshold"
disable port all

endif


No comments:

Post a Comment