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

Limiting script to run once or twice

nawas
Level 4
Level 4

I have this script which I'm trying to collect snmp stack based on the %SNMP-3-INPUT_QFULL_ERR. But my concerns is that when these error starts they run for about 2 hours and I get thousands of syslog entries for this error. I want to be able to limit this script and may run once or twice regarldess of how many error I get. Can someone assist me in tweaking this?

Thanks.

event manager session cli username "username"

event manager applet SNMP_STACK

event syslog pattern "%SNMP-3-INPUT_QFULL_ERR" occurs 32

action 1.0 cli command "enable"

action 2.1 cli command "show clock | append bootflash:SNMP_STACK.TXT"

action 2.2 cli command "show proc cpu sort | append bootflash:SNMP_STACK.TXT"

action 3.1 cli command "show stacks 560 | append bootflash:SNMP_STACK.TXT"

action 3.2 cli command "show stacks 560 | append bootflash:SNMP_STACK.TXT"

action 3.3 cli command "show stacks 560 | append bootflash:SNMP_STACK.TXT"

action 3.4 cli command "show stacks 560 | append bootflash:SNMP_STACK.TXT"

action 3.5 cli command "show stacks 560 | append bootflash:SNMP_STACK.TXT"

action 3.6 cli command "show stacks 560 | append bootflash:SNMP_STACK.TXT"

action 3.7 cli command "show stacks 560 | append bootflash:SNMP_STACK.TXT"

action 3.8 cli command "show stacks 560 | append bootflash:SNMP_STACK.TXT"

action 3.9 cli command "show stacks 560 | append bootflash:SNMP_STACK.TXT"

1 Reply 1

Joe Clarke
Cisco Employee
Cisco Employee

One way to do this would be to have this applet install a second, timer-based applet then sets the event detector type of itself to "none".  The second applet would countdown the number of seconds that correspond to your time window, then reconfigures the event detector on the first applet to be your syslog event.  For example:

event manager environment q "

!

...

action 4.0 cli command "config t"

action 4.1 cli command "event manager applet stack-countdown

action 4.2 cli command "event timer countdown time 7200"

action 4.3 cli command "action 1.0 cli command enable"

action 4.4 cli command "action 2.0 cli command $q config t$q"

action 4.4 cli command "action 3.0 cli command $q event manager applet SNMP_STACK$q"

action 4.5 cli command "action 4.0 cli command $q event syslog pattern %SNMP-3-INPUT_QFULL_ERR$q"

action 4.6 cli command "no event manager applet stack-countdown"

action 4.7 cli command "event manager applet SNMP_STACK"

action 4.8 cli command "event none"

action 4.9 cli command "end"