DX Infrastructure Manager

Expand all | Collapse all

Disk Space Message String Regex Not Working -- Please Help

  • 1.  Disk Space Message String Regex Not Working -- Please Help

    Posted 04-24-2013 09:05 PM

    /Free space on disk [a-z]:\\(?:[-\w\.\d]+\\)*(?:[-\w\.\d]+)? is now at \d+ % \(^[2-9][0-9]*(\.[0-9]+)? GB\), which is below the threshold \(\d+%\) out of total size [+-]?\d*\.\d+)(?![-+0-9\.] GB/

     

    In layman's terms here is the goal of my regular expression:

     

    Free space on disk [windows path] is now at [integer]% [floating point number > 1.9] GB, which is below the threshold ([integer]%) out of total size [floating point number] GB

     

    So, I wrote a fairly complex regular expression the goal of which is to look at the free disk space variable in the message string at match if it is 2.0 or higher -- This way I can write a pre-processing filter to effectively exclude messages that are where there is 2+ GB in the filesystem. This would achieve my goal of being able to monitor both by total number of GB AND by percentage.

     

    As part of the whole string the regex seems to be failing here: ^[2-9][0-9]*(\.[0-9]+)? which works on its own but not when I add it to the whole string. Any thoughts on how to fix or alternative methods?? 



  • 2.  Re: Disk Space Message String Regex Not Working -- Please Help

    Posted 04-25-2013 07:30 AM

    Hi,

     

    I think I see a couple of errors there, but I'm not sure why you want to match everything in the message if you only need to check the disk space available? Wouldn't it be easier to do just something like this:

     

    /%\s[2-9][0-9]*\.[0-9]/

     It matches the part bolded here, which should be unique in your string:

     

    "Free space on disk [windows path] is now at [integer]% [floating point number > 1.9] GB, which is below the threshold ([integer]%) out of total size [floating point number] GB"

     


    -jon



  • 3.  Re: Disk Space Message String Regex Not Working -- Please Help

    Posted 04-25-2013 10:16 PM

    Thank you for the advice and I will test this.