10-01-2015 03:57 AM
Basically, the EEM snippet code below hogs the switch cpu's and actually leads to the switch and downstream components showing as unreachable. The CPU graph of the switch sky rockets and the whole script takes about 15 minutes to complete on a 4x3750 stack. The error is:
Sep 30 04:08:52: %SYS-3-CPUHOG: Task is running for (2098)msecs, more than (2000)msecs (17/16),process = EEM Callback Thread.
-Traceback= 0x27ECA64z 0x27ECF88z 0x27ED4ACz 0x27EE9D8z 0x27EFD10z 0xA7823Cz 0xA6A480z 0xA786F4z 0xA6A524z 0xA6F900z 0xA5AAACz 0x26E07A8z 0x26DAD58z
I have seen this happen on a variety of IOS versions and on a variety of switches (3750 stacked and unstacked and 3560 )
Basically this EEM script parses all interfaces, and if they are not trunks and if they are set for MAB and they do not have a description, then one is set. I have checked all the steps by hand and none of them seem to be CPU hogs.
conf t
no event manager applet update-port-description-dyn
no event manager applet port-desc-dyn
event manager applet port-desc-dyn authorization bypass
event timer cron cron-entry "40 14 * * *" maxrun 1200
action 100 info type interface-names regexp "FastEthernet|GigabitEthernet|TenGigabitEthernet"
action 200 foreach _iface "$_info_interface_names"
action 300 set if "$_iface"
action 310 cli command "sh interfaces $if status | inc trunk "
action 320 regexp " trunk " $_cli_result
action 330 if $_regexp_result eq 1
action 340 continue
action 345 end
action 360 cli command "sh mab interface $if | i Enabled"
action 370 regexp "Enabled" $_cli_result
action 380 if $_regexp_result eq 0
action 385 continue
action 387 end
action 390 cli command "sh interfaces $if"
action 400 regexp ".*(Description).*" "$_cli_result"
action 410 if $_regexp_result eq 1
action 414 continue
action 416 end
action 500 cli command "enable"
action 510 cli command "config t"
action 520 cli command "interface $if"
action 530 cli command "description AUT. STAND. DYN. PORT"
action 540 cli command "end"
action 800 end
action 850 cli command "exit"
end
wr
Anyone have any idea?
Solved! Go to Solution.
10-03-2015 05:53 PM
Your regular expression for description is too greedy. You don't need it. This will work much better and avoid the CPU issue.
action 390 cli command "sh interfaces $if | inc Description:"
action 400 regexp "Description:" "$_cli_result"
10-03-2015 05:53 PM
Your regular expression for description is too greedy. You don't need it. This will work much better and avoid the CPU issue.
action 390 cli command "sh interfaces $if | inc Description:"
action 400 regexp "Description:" "$_cli_result"
Discover and save your favorite ideas. Come back to expert answers, step-by-step guides, recent topics, and more.
New here? Get started with these tips. How to use Community New member guide