08-13-2013 03:51 AM
I want to be able to run this script regularly and only update the logs if there has been a change. To do this I have used the context save and retrieve commands to store and retreve the variables.
When I run this script it causes my router to reload. I've debugged it down to 5.0 and it runs ok. If I go to 5.40 it crashes, any ideas?
event manager applet report_adsl_health_test
event none
action 1.0 comment Collect ADSL sync speed and format it for the log and banner output
action 1.1 info type snmp oid 1.3.6.1.2.1.10.94.1.1.2.1.8.11 get-type exact
action 1.2 divide $_info_snmp_value 1000000
action 1.3 regexp "^." "$_remainder" _match
action 1.4 set final_remainder "$_match"
action 1.5 set dsl_rate "$_result.$final_remainder"
action 2.0 comment Collect noise margin and format it for the log and banner output
action 2.1 info type snmp oid 1.3.6.1.2.1.10.94.1.1.3.1.4.11 get-type exact
action 2.2 divide $_info_snmp_value 10
action 2.3 set noise_margin "$_result.$_remainder"
action 3.0 comment Collect number of carrier and format it for the log and banner output
action 3.1 info type snmp oid 1.3.6.1.4.1.9.2.2.1.1.21.16 get-type exact
action 3.2 set carrier_transitions "$_info_snmp_value"
action 4.0 comment Retrieve previous ADSL health measurements or if non-existant, then set previous variables to 0
action 4.10 handle-error type ignore
action 4.11 context retrieve key key_prev_dsl_rate variable "previous_dsl_rate"
action 4.12 if $_error ne FH_EOK goto 4.20
action 4.13 handle-error type ignore
action 4.14 context retrieve key key_prev_noise_margin variable "previous_noise_margin"
action 4.15 if $_error ne FH_EOK goto 4.20
action 4.16 handle-error type ignore
action 4.17 context retrieve key key_prev_carrier_transitions variable "previous_carrier_transitions"
action 4.18 if $_error ne FH_EOK goto 4.20
action 4.20 set previous_dsl_rate "0"
action 4.21 set previous_noise_margin "0"
action 4.22 set previous_carrier_transitions "0"
action 5.0 comment Compare current and previous adsl health measurements
action 5.10 set changes "0"
action 5.11 if $previous_dsl_rate eq $dsl_rate goto 5.20
action 5.12 increment changes 1
action 5.20 if $previous_noise_margin eq $noise_margin goto 5.30
action 5.21 increment changes 1
action 5.30 if $previous_carrier_transitions eq $carrier_transitions goto 5.40
action 5.31 increment changes 1
action 5.40 if $changes eq 0 goto 93.1
action 90.0 comment Record new ADSL heath in log and set banner
action 90.1 syslog priority notifications msg "Current ADSL speed is $dsl_rate Mbps, Noise Margin is $noise_margin dB, $carrier_transitions WAN interface resets since counters last cleared"
action 91.1 cli command "enable"
action 91.2 cli command "conf t"
action 91.3 cli command "banner exec ZCurrent ADSL speed is $dsl_rate Mbps, Noise Margin is $noise_margin dB, $carrier_transitions WAN interface resets since counters last clearedZ"
action 91.4 cli command "end"
action 92.0 comment Save updated ADSL health measurements
action 92.1 context save key key_prev_dsl_rate variable "dsl_rate"
action 92.2 context save key key_prev_noise_margin variable "noise_margin"
action 92.3 context save key key_prev_carrier_transitions variable "carrier_transitions"
action 93.1 exit
end
Solved! Go to Solution.
08-19-2013 10:44 PM
Hi Ryan,
Yes that's the workaround to this bug. Add instead of increment.
Mike
08-13-2013 07:39 AM
Post the output of show ver, show stack and show region from this device.
08-13-2013 04:05 PM
See below:
router#show ver
Cisco IOS Software, C870 Software (C870-ADVIPSERVICESK9-M), Version 15.1(4)M6, RELEASE SOFTWARE (fc2)
Technical Support: http://www.cisco.com/techsupport
Copyright (c) 1986-2013 by Cisco Systems, Inc.
Compiled Thu 14-Feb-13 11:07 by prod_rel_team
ROM: System Bootstrap, Version 12.3(8r)YI4, RELEASE SOFTWARE
router uptime is 12 hours, 1 minute
System returned to ROM by reload at 20:58:05 AEST Tue Aug 13 2013
System restarted at 20:59:32 AEST Tue Aug 13 2013
System image file is "flash:c870-advipservicesk9-mz.151-4.M6.bin"
Last reload reason: Unknown reason
This product contains cryptographic features and is subject to United
States and local country laws governing import, export, transfer and
use. Delivery of Cisco cryptographic products does not imply
third-party authority to import, export, distribute or use encryption.
Importers, exporters, distributors and users are responsible for
compliance with U.S. and local country laws. By using this product you
agree to comply with applicable laws and regulations. If you are unable
to comply with U.S. and local laws, return this product immediately.
A summary of U.S. laws governing Cisco cryptographic products may be found at:
http://www.cisco.com/wwl/export/crypto/tool/stqrg.html
If you require further assistance please contact us by sending email to
Cisco 877 (MPC8272) processor (revision 3.0) with 236544K/25600K bytes of memory.
Processor board ID FCZ11386182
MPC8272 CPU Rev: Part Number 0xC, Mask Number 0x10
4 FastEthernet interfaces
1 ATM interface
1 Virtual Private Network (VPN) Module
128K bytes of non-volatile configuration memory.
53248K bytes of processor board System flash (Intel Strataflash)
Configuration register is 0x2102
router#show region
Region Manager:
Start End Size(b) Class Media Name
0x0E700000 0x0FFFFFFF 26214400 Iomem R/W iomem
0x80000000 0x8E6FFFFF 242221056 Local R/W main
0x8002007C 0x82DAC93F 47761604 IText R/W main:text
0x82DAC940 0x83E76413 17603284 IData R/W main:data
0x83E76414 0x8470B08F 8998012 IBss R/W main:bss
0x8470B090 0x8E6FFFFF 167726960 Local R/W main:heap
Free Region Manager:
Start End Size(b) Class Media Name
router#show stack
Minimum process stacks:
Free/Size Name
11124/12000 MRIB IPv4 Init Process
11128/12000 MRIB IPv6 Init Process
8092/9000 EEM ED RF
4184/6000 EEM Shell Director
4928/6000 Inspect Init Msg
5116/6000 SPAN Subsystem
18760/24000 Init
58608/60000 EEM Auto Registration Proc
5128/6000 SASL MAIN
4916/6000 RADIUS INITCONFIG
5096/6000 HTTP DNS Update Process
2128/3000 Rom Random Update Process
5128/6000 IP SLAs Deferred Schedule Processor
6172/9000 EEM Callback Thread
22108/24000 Virtual Exec
Interrupt level stacks:
Level Called Unused/Size Name
2 1268177 5464/9000 Host/PCI Bridge Interrupt
3 401000 5340/9000 SEC Interrupt Handler
5 41996 8968/9000 Console Break Risc Timer Interrupt
6 1410 8876/9000 MPC8270 Console Interrupt
7 10830035 8892/9000 MPC8270 Timer4 Interrupt
router#
08-13-2013 08:44 PM
This output doesn't indicate a crash. Did you reload again after the EEM crash?
08-14-2013 04:49 PM
No, I haven't reloaded it since.
You can see from "Last reload reason: Unknown reason" that something has gone wrong.
Any idea what in the script could be causing this behaviour?
08-15-2013 07:36 AM
No. If you connect to the console and reproduce the problem, what messages do you see?
08-19-2013 04:31 AM
Hi Joseph,
Ok I'm still having this problem and have captured the console messages:
chaney-xtr#event manager run report_adsl_health_loop
Aug 19 21:25:42: %HA_EM-5-LOG: report_adsl_health_loop: Current ADSL speed is 4.4 Mbps, Noise Margin is 6.0 dB, ADSL has failed 1 times since last reboot
validblock_diagnose, code = 2
current memory block, bp = 0x86CA5334,
memorypool type is Processor
data check, ptr = 0x86CA5364
bp->next(0x0) not in any mempool
bp_prev(0xFFFFFFEC) not in any mempool
========= Dump bp = 0x86CA5334 ======================
86CA5234: B0D0B0D 15A3C78B 0 80D60D18 86C9C82C EF4321CD 80D60B94 B0D0B0D
86CA5254: 15A3C78B 0 80D60D18 86C9C82C EF4321CD 80D60B94 B0D0B0D 15A3C78B
86CA5274: 0 80D60D18 86C9C82C EF4321CD 80D60B94 B0D0B0D 15A3C78B 0
86CA5294: 80D60D18 86C9C82C EF4321CD 80D60B94 B0D0B0D 15A3C78B 0 80D60D18
86CA52B4: 86C9C82C EF4321CD 80D60B94 B0D0B0D 15A3C78B 0 80D60D18 86C9C82C
86CA52D4: EF4321CD 80D60B94 B0D0B0D 15A3C78B 0 80D60CDC 86C9C82C EF4321CD
86CA52F4: 80D60B8C B0D0B0D 15A3C78B 0 80D60CDC 86C9C82C EF4321CD 80D60B8C
86CA5314: B0D0B0D 15A3C78B 0 80D60D18 86C9C82C EF4321CD 80D60B94 B0D0B0D
86CA5334: 15A3C78B 1 82071A78 86C9C82C 0 0 0 A3C78B
86CA5354: 1 80D60D18 86C9C82C 0 342E3131 0 15A3C78B 0
86CA5374: 80D60D18 86C9C82C EF4321CD 80D60B94 B0D0B0D 15A3C78B 0 80D60D18
86CA5394: 86C9C82C EF4321CD 80D60B94 B0D0B0D 15A3C78B 0 80D60CDC 86C9C82C
86CA53B4: EF4321CD 80D60B8C B0D0B0D 15A3C78B 0 80D60D18 86C9C82C EF4321CD
86CA53D4: 80D60B94 B0D0B0D 15A3C78B 0 80D60D18 86C9C82C EF4321CD 80D60B94
86CA53F4: B0D0B0D 15A3C78B 0 80D60D18 86C9C82C EF4321CD 80D60B94 B0D0B0D
86CA5414: 15A3C78B 1 809EE550 86C9C82C 0 5279616E 0 15A3C78B
========= Dump bp->next = 0x0 ======================
========== Dump bp->previous = 0x0 =====================
============================================
%Software-forced reload
21:26:04 AEST Mon Aug 19 2013: Unexpected exception to CPU: vector 700, PC = 0x80393A88, LR = 0x80393A20
-Traceback= 0x80393A88z 0x80393A20z 0x81FDC560z 0x82DA91F0z 0x80D60B98z 0x80D652A4z 0x80D5AE90z 0x80395CB4z 0x8037B7ECz
CPU Register Context:
MSR = 0x00029032 CR = 0x24048082 CTR = 0x80B81134 XER = 0x00000000
R0 = 0x80393A20 R1 = 0x862DDCC0 R2 = 0xFFF4FFF4 R3 = 0x83F1F890
R4 = 0x00000000 R5 = 0x00000000 R6 = 0x00000000 R7 = 0x00000001
R8 = 0x00000000 R9 = 0x83E70000 R10 = 0x83E70000 R11 = 0x00000000
R12 = 0x28048028 R13 = 0x8FFFFF30 R14 = 0x80D5AD30 R15 = 0x00000000
R16 = 0x00000000 R17 = 0x00000000 R18 = 0x00000000 R19 = 0x82F80000
R20 = 0x8474DD54 R21 = 0x862DE068 R22 = 0x83CD0000 R23 = 0x83E70000
R24 = 0x83E70000 R25 = 0x00000000 R26 = 0x83CD0000 R27 = 0x83E8A1D4
R28 = 0x00000000 R29 = 0x836CD928 R30 = 0x83920000 R31 = 0x00000000
TEXT_START : 0x8002007C
DATA_START : 0x82DAC940
Writing crashinfo to flash:crashinfo_20130819-212604-AEST
=== Flushing messages (21:26:06 AEST Mon Aug 19 2013) ===
Buffered messages:
Aug 19 21:25:42: %HA_EM-5-LOG: report_adsl_health_loop: Current ADSL speed is 4.4 Mbps, Noise Margin is 6.0 dB, ADSL has failed 1 times since last reboot
.Aug 19 21:26:04: %SYS-3-BADMAGIC: Corrupt block at 86CA5334 (magic 15A3C78B)
-Traceback= 80B87144z 82024D10z 81FDC560z 82DA91F0z 80D60B98z 80D652A4z 80D5AE90z 80395CB4z 8037B7ECz
Queued messages:
.Aug 19 21:26:06: %SYS-3-LOGGER_FLUSHING: System pausing to ensure console debugging output.
.Aug 19 21:26:04: %SYS-3-BADMAGIC: Corrupt block at 86CA5334 (magic 15A3C78B)
-Traceback= 80B87144z 82024D10z 81FDC560z 82DA91F0z 80D60B98z 80D652A4z 80D5AE90z 80395CB4z 8037B7ECz
.Aug 19 21:26:04: %SYS-6-MTRACE: mallocfree: addr, pc
86DD6D04,80B60C2C 86DD6D04,40000294 86DD4908,80B60C04 86DD4908,4000020A
86CA5364,80D60B94 86ACC844,80D7B0F8 86DB9C5C,80D7B0E0 86DBAD2C,82D8DCB8
.Aug 19 21:26:04: %SYS-6-MTRACE: mallocfree: addr, pc
86DBB248,600000E0 86DBB114,82D8DCA0 86DBB248,82D8DC80 847E9FC4,82D9DD6C
8492A8F4,802FB690 8492A8F4,30008050 87464968,802FB63C 87464968,30000246
.Aug 19 21:26:04: %SYS-6-BLKINFO: Corrupted magic value in in-use block blk 86CA5334, words 10733451, alloc 0, Free, dealloc 0, rfcnt 1
-Traceback= 80B87144z 81FD9458z 82025328z 81FDC560z 82DA91F0z 80D60B98z 80D652A4z 80D5AE90z 80395CB4z 8037B7ECz
.Aug 19 21:26:04: %SYS-6-MEMDUMP: 0x86CA5334: 0x15A3C78B 0x1 0x82071A78 0x86C9C82C
.Aug 19 21:26:04: %SYS-6-MEMDUMP: 0x86CA5344: 0x0 0x0 0x0 0xA3C78B
.Aug 19 21:26:04: %SYS-6-MEMDUMP: 0x86CA5354: 0x1 0x80D60D18 0x86C9C82C 0x0
.Aug 19 21:26:05: %SYS-5-CONFIG_I: Configured from console by on vty0 (EEM:report_adsl_health_loop)CPU Register Context:
VEC = 0x00000700 PC = 0x80393A88 MSR = 0x00029032 CR = 0x24048082
LR = 0x80393A20 CTR = 0x80B81134 XER = 0x00000000
R0 = 0x80393A20 R1 = 0x862DDCC0 R2 = 0xFFF4FFF4 R3 = 0x83F1F890
R4 = 0x00000000 R5 = 0x00000000 R6 = 0x00000000 R7 = 0x00000001
R8 = 0x00000000 R9 = 0x83E70000 R10 = 0x83E70000 R11 = 0x00000000
R12 = 0x28048028 R13 = 0x8FFFFF30 R14 = 0x80D5AD30 R15 = 0x00000000
R16 = 0x00000000 R17 = 0x00000000 R18 = 0x00000000 R19 = 0x82F80000
R20 = 0x8474DD54 R21 = 0x862DE068 R22 = 0x83CD0000 R23 = 0x83E70000
R24 = 0x83E70000 R25 = 0x00000000 R26 = 0x83CD0000 R27 = 0x83E8A1D4
R28 = 0x00000000 R29 = 0x836CD928 R30 = 0x83920000 R31 = 0x00000000
DEC = 0x7FFF5A84 TBU = 0x00000001 TBL = 0x020CDDAB PVR = 0x80822014
DAR = 0x00000000 DSISR = 0x000000ÿ
*** System received a Software forced crash ***
signal= 0x17, code= 0x700, context= 0x83ed1348
PC = 0x80393a88, Vector = 0x700, SP = 0x862ddcc0
System Bootstrap, Version 12.3(8r)YI4, RELEASE SOFTWARE
Technical Support: http://www.cisco.com/techsupport
Copyright (c) 2006 by cisco Systems, Inc.
C870 series (Board ID: 1-148) platform with 262144 Kbytes of main memory
Booting flash:/c870-advipservicesk9-mz.151-4.M6.bin
[snip]
I have updated my script slightly since my earlier post, current EEM script is below. It does appear to run successfully but the router crashes soon after.
event manager applet report_adsl_health_loop
event none sync yes
action 1.0 comment Collect ADSL sync speed and format it for the log and banner output
action 1.1 info type snmp oid 1.3.6.1.2.1.10.94.1.1.2.1.8.11 get-type exact
action 1.2 divide $_info_snmp_value 1000000
action 1.3 regexp "^." "$_remainder" _match
action 1.4 set final_remainder "$_match"
action 1.5 set dsl_rate "$_result.$final_remainder"
action 2.0 comment Collect noise margin and format it for the log and banner output
action 2.1 info type snmp oid 1.3.6.1.2.1.10.94.1.1.3.1.4.11 get-type exact
action 2.2 divide $_info_snmp_value 10
action 2.3 set noise_margin "$_result.$_remainder"
action 3.0 comment Collect the number of times the ADSL interface has gone down and format it for the log and banner output
action 3.1 cli command "enable"
action 3.2 cli command "show dsl int atm0 | in Activations"
action 3.3 regexp "[0-9]+" "$_cli_result" activations
action 4.0 comment Retrieve previous ADSL health measurements or if non-existant, then set previous variables to 0
action 4.10 handle-error type ignore
action 4.11 context retrieve key key_prev_dsl_rate variable "previous_dsl_rate"
action 4.12 if $_error ne FH_EOK goto 4.20
action 4.13 handle-error type ignore
action 4.14 context retrieve key key_prev_noise_margin variable "previous_noise_margin"
action 4.15 if $_error ne FH_EOK goto 4.20
action 4.16 handle-error type ignore
action 4.17 context retrieve key key_prev_activations variable "previous_activations"
action 4.18 if $_error ne FH_EOK goto 4.20
action 4.20 set previous_dsl_rate "0"
action 4.21 set previous_noise_margin "0"
action 4.22 set previous_activations "0"
action 5.0 comment Compare current and previous adsl health measurements
action 5.10 set changes "0"
action 5.11 if $previous_dsl_rate eq $dsl_rate goto 5.20
action 5.12 increment changes 1
action 5.20 if $previous_noise_margin eq $noise_margin goto 5.30
action 5.21 increment changes 1
action 5.30 if $previous_activations eq $activations goto 5.40
action 5.31 increment changes 1
action 5.40 if $changes eq 0 goto 93.1
action 90.0 comment Record new ADSL heath in log and set banner
action 90.1 syslog priority notifications msg "Current ADSL speed is $dsl_rate Mbps, Noise Margin is $noise_margin dB, ADSL has failed $activations times since last reboot"
action 91.1 cli command "enable"
action 91.2 cli command "conf t"
action 91.3 cli command "banner exec Z\x0aCurrent ADSL speed is $dsl_rate Mbps, Noise Margin is $noise_margin dB, ADSL has failed $activations times since last reboot\x0a\x0aZ"
action 91.4 cli command "end"
action 92.0 comment Save updated ADSL health measurements
action 92.1 context save key key_prev_dsl_rate variable "dsl_rate"
action 92.2 context save key key_prev_noise_margin variable "noise_margin"
action 92.3 context save key key_prev_activations variable "activations"
action 93.1 exit
end
end
event manager run report_adsl_health_loop
08-19-2013 07:24 AM
This is CSCud31581.
08-19-2013 09:31 PM
Thanks.
Looking at bug toolkit I presume I can use Add instead of Increment to get around this?
08-19-2013 10:44 PM
Hi Ryan,
Yes that's the workaround to this bug. Add instead of increment.
Mike
08-20-2013 03:13 AM
That works.
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