DX Unified Infrastructure Management

 View Only
  • 1.  RegEx help nas match on 0% - 5%

    Posted Sep 14, 2020 11:21 AM
    Hello, looking for some RegEx help here.
    It seems this is correct but when I test this out in the nas regEx tester I am getting no matches when I test with values of 0% or 5% works for 1% - 4%.
    Our CDM disk throws disk alerts using this format:

    • DISK - C:\ is now 2404 MB ( 2.3 GB - 2% ), which is below the threshold 10230 MB ( 10 GB - 10% ) out of total size 99.9 GB ( 100% )
    • DISK - E:\ is now 0 MB ( 0.0 GB - 0% ), which is below the threshold 299427 MB ( 292 GB - 10% ) out of total size 2924.1 GB ( 100% )
    Trying to create a nas rule that will match on all the alerts when the disk space hits [0% - 5%] space left, then do something.
    The regEx I came up with that is semi-working is:
        /.*-\s(0%|1%|2%|3%|4%|5%)\s\),\swhich*./

    It works when the % is 1,2,3,4  
    DISK - C:\ is now 2404 MB ( 2.3 GB - 1% ), which is below the threshold 10230 MB ( 10 GB - 10% ) out of total size 99.9 GB ( 100% )
    DISK - C:\ is now 2404 MB ( 2.3 GB - 2% ), which is below the threshold 10230 MB ( 10 GB - 10% ) out of total size 99.9 GB ( 100% )
    DISK - C:\ is now 2404 MB ( 2.3 GB - 3% ), which is below the threshold 10230 MB ( 10 GB - 10% ) out of total size 99.9 GB ( 100% )
    DISK - C:\ is now 2404 MB ( 2.3 GB - 4% ), which is below the threshold 10230 MB ( 10 GB - 10% ) out of total size 99.9 GB ( 100% )



    but fails and does not match when 0% or 5%.  
    DISK - C:\ is now 2404 MB ( 2.3 GB - 0% ), which is below the threshold 10230 MB ( 10 GB - 10% ) out of total size 99.9 GB ( 100% )
    DISK - C:\ is now 2404 MB ( 2.3 GB - 5% ), which is below the threshold 10230 MB ( 10 GB - 10% ) out of total size 99.9 GB ( 100% )


    What am I missing here?

    ------------------------------
    Daniel Blanco
    Enterprise Tools Team Architect
    DBlanco@alphaserveit.com
    ------------------------------


  • 2.  RE: RegEx help nas match on 0% - 5%

    Broadcom Employee
    Posted Sep 14, 2020 11:29 AM
    The formula you are using, tested to be correct in external testers:
    What version of UIM and NAS are you using?
    Can you test escaping the -
    so 
    /.*\-\s(0%|1%|2%|3%|4%|5%)\s\),\swhich*./

    ------------------------------
    Gene Howard
    Principal Support Engineer
    Broadcom
    ------------------------------



  • 3.  RE: RegEx help nas match on 0% - 5%

    Posted Sep 14, 2020 11:38 AM
    Hi Gene,
    So using UIM 9.20, nas v9.20.

    Tried with your expression above and same results 0% and 5% don't work, they don't match. 


    ------------------------------
    Daniel Blanco
    Enterprise Tools Team Architect
    DBlanco@alphaserveit.com
    ------------------------------



  • 4.  RE: RegEx help nas match on 0% - 5%

    Broadcom Employee
    Posted Sep 14, 2020 11:46 AM
    Ok looks like there might be some type of bug.
    If you change the order of the values to the following I was able to test ALL 5 combinations ok.
    /.*-\s(1%|0%|2%|3%|4%|5%)\s\),\swhich*./

    ------------------------------
    Gene Howard
    Principal Support Engineer
    Broadcom
    ------------------------------



  • 5.  RE: RegEx help nas match on 0% - 5%

    Posted Sep 14, 2020 12:04 PM
    Uh that doesn't work b/c now it matches on anything above 5% as well. 6% thru 9% also match.

    DISK - C:\ is now 2404 MB ( 2.3 GB - 6% ), which is below the threshold 10230 MB ( 10 GB - 10% ) out of total size 99.9 GB ( 100% )
    DISK - C:\ is now 2404 MB ( 2.3 GB - 7% ), which is below the threshold 10230 MB ( 10 GB - 10% ) out of total size 99.9 GB ( 100% )
    DISK - C:\ is now 2404 MB ( 2.3 GB - 8% ), which is below the threshold 10230 MB ( 10 GB - 10% ) out of total size 99.9 GB ( 100% )


    ------------------------------
    Daniel Blanco
    Enterprise Tools Team Architect
    DBlanco@alphaserveit.com
    ------------------------------



  • 6.  RE: RegEx help nas match on 0% - 5%
    Best Answer

    Broadcom Employee
    Posted Sep 14, 2020 12:20 PM
    so the comma is causing you an issue for some reason.
    Try the below
    /.*-\s(0%|1%|2%|3%|4%|5%).*\swhich*./

    ------------------------------
    Gene Howard
    Principal Support Engineer
    Broadcom
    ------------------------------



  • 7.  RE: RegEx help nas match on 0% - 5%

    Posted Sep 14, 2020 12:54 PM
    Thank you Gene!!! That regEx works.

    ------------------------------
    Daniel Blanco
    Enterprise Tools Team Architect
    DBlanco@alphaserveit.com
    ------------------------------



  • 8.  RE: RegEx help nas match on 0% - 5%

    Posted Sep 15, 2020 02:03 AM
    "​so the comma is causing you an issue for some reason"

    ...UIM never lets you include a comma in your Regex, which is a real pain if you are trying to do something like "Between 2 and 5 occurences of 'a' " - a{2,5}

    It means that you have to get a bit more creative with your regex and always check it in the NAS regex checker, before deploying, even if it works perfectly fine in an external checker. ;-)