02-21-2017 05:45 PM
I am very new to scripting in general and I am working on a script that will detect a module failure on an HP chassis switch. Here is a partial output (did not format well when pasted):
Status and Counters - Module Information
Chassis: 5412zl J8698A! Serial Number:
Allow V1 Modules: Yes
Management Module: J8726A Serial Number: Core Dump: YES
Slot Module Description Serial Number Status Dump Ver
---- -------------------------------------- -------------- -------- ----- ---
A HP J9637A 12p GT PoE+/12p SFP v2 zl... SG37DRQ6X6 Up YES 2
B HP J8705A Gig-T/SFP zl Module SG030AU01J Up NO 1
C HP J9534A 24p Gig-T PoE+ v2 zl Module SG3287R0SZ Up YES 2
D HP J9534A 24p Gig-T PoE+ v2 zl Module SG4127R132 Up YES 2
F HP J9534A 24p Gig-T PoE+ v2 zl Module SG3287R0T4 Up YES 2
L Failed -
The following seems to work to detect the L module:
This will picked up 'Failed' and put it in the $modStatus which is a start. I am having issues because the modules are different, A-L, and there is no consistent identifier to use. I've been battling finding a way to get it done. Any help would be awesome! and I'll keep banging my head until then...
02-24-2017 07:00 AM
It's hard to provide an accurate answer without getting the complete script or knowing the purpose or end result.
However, the following is worth a try
Also, use the following link on a new tab after login to NetMRI GUI
This is an in-built regex tester within NetMRI and will give you outputs similar to the one seen after running jobs.
Hope this helps !
02-27-2017 05:08 AM
Thank you for your suggestions!
Is there a way to reset the RunRegex.tdf? I used this for a few days and now when I open it comes up to the previous test run and will not reset to allow me to enter new information.
I will be testing the code below today, thanks!
02-27-2017 05:11 AM
As far as what I am attempting to accomplish, I am wanting to grab A-L into a variable so that I can understand when a module is in the failed state and create an issue or possibly run a trigger script to resolve.
02-27-2017 07:36 AM
So you want to obtain the module letter and whether any have failed. The following should only match on failed modules and only then execute any following commands/actions.
PRINT: $module $modStatus
...fire custom issue, do whatever...
02-27-2017 07:39 AM
I haven't experienced that but I'm not using it every day. Actually, I'm delighted that the previous entries are now saved after executing it once, and then using the browser "back" to try again. It was so tedious to have to save the three entries to a text editor and then paste them back in, just to iterate. I'm guessing this behavior changed in 7.1.2.
02-28-2017 06:26 AM
Seems to be in the software. I cleared cache/cookies, even tried another browser. I will open an issue with support. Thanks!
02-28-2017 06:35 AM
This pulled back a match and gave me a status Failed for $modStatus which is great. I would like to get this matched up A-L and create a variable for A-L when found. Thanks!
Here is what was used:
02-28-2017 06:42 AM
Thanks for the response!
I'm currently unable to test through the Regex but I did modify my test script with the info below. Unfortunately it did not return a match, could it be off by a small detail?