DX Infrastructure Manager

Expand all | Collapse all

Regular Expression for filtering nas alarms based on host name

  • 1.  Regular Expression for filtering nas alarms based on host name

    Posted 07-20-2010 11:33 PM

    I am new to Nimsoft and am trying to create nas alerts based on Production vs. Test servers.  I want to filter out Test servers in my Production server alert.  Our naming convention is as follows.

     

    role - up to 6 characters

    test designation (if applicable) - 4 characters

    sequence - 2 digits

    location - 3 characters

     

    so as an example:  I have two servers

     

    pimapp01sea - Production PIM Application Server 1 in Seattle

    pimapptest01sea - Test PIM Application Server 1 in Seattle

     

    I want to filter my alerts so that my Production nas profile only alerts for production servers.  I used RegexBuddy to create this expression and it test out fine in RegexBuddy but when I try it in Nimsoft it doesn't match the string.

     

    [a-z]+(?<!test)[0-9]{2}sea\.domain\.com

     

    Can anyone tell me what is wrong with my expression?  Any help is much appreciated.



  • 2.  Re: Regular Expression for filtering nas alarms based on host name

    Posted 07-21-2010 02:53 AM

    Okay, I figured it out myself.  I didn't realize that expressions had to have /^ at the beginning and / at the end.

     

    This worked for me.

     

    /^[a-z]+(?<!test)[0-9]{2}sea\.domain\.com/



  • 3.  Re: Regular Expression for filtering nas alarms based on host name

    Posted 07-22-2010 06:01 PM

    Just to clarify a little for those not used to working with regexes in Nimsoft probes:

     

    The requirement in a lot of probes is that you need to surround the regex with slashes, like so:

    /<regex>/

     

    If you don't a text comparison is usually done instead, though some probes do allow pattern matching where the pattern will be turned into a regex. If you need to match on a slash you need to escape it with a backslash, otherwise you will proably confuse the regex engine quite a bit.

     

    The ^ simply says that the regex has to match from the start of the line. A fine distinction, but it could turn out to be an important one!

     

    Cheers,

    Stian