regular expression matching.

John A. Sullivan III jsullivan at opensourcedevel.com
Fri Aug 18 22:52:18 CEST 2006


On Fri, 2006-08-18 at 11:44 -0700, Christian Hedegaard wrote:
> The Nagios documentation relating to the "regular expression" matching
> seems very thin to me. And not quite clear.
> 
> It appears, by example, that the only regular expressions you can use
> are "*" and "?", which I would just consider wildcard matching and not
> regular expressions.
> 
> Regardless, can anything else be used as far as these "regular
> expressions" are concerned?
> 
> The documentation uses the examples of "host *", and I am assuming that
> I can do something like "host *-edu" or "host tc-??-00".
> 
> And can these regular expressions be used everywhere in the configs? For
> instance, we have an 110K escalations config file that could in theory
> be reduced to just:
> 
> define serviceescalation{
>         host_name                       *
>         service_description             *
>         first_notification              3
>         last_notification               0
>         contact_groups
> on-duty-pagers,off-duty-pagers,operations-email
>         notification_interval           30
>         }
> 
> Right now we have one unique entry for every service_description on
> every host_name.
> 
> So is the above correct? would that work? can anything at all be used
> besides "*" and "?" for matching?
> 
> Thanks!
> 
> P.S. Are there any plans to clarify the documentation in this regards?
> 
> 
For all the really good things Nagios does, the regular expression
implementation seems to be a bit lacking.  We still struggle with why
some expressions work and others don't.

I believe I read somewhere that the examples are in error -- that if you
enable true regular expressions, you would need .* and not *.

Here are two examples of what we had to do.  Notice that there is a more
concise and powerful expression which is commented out.  They do not
work in Nagios.  In fact, if they did, we could reduce our fourteen
dependency definitions to two or three.

define servicedependency{
        dependent_host_name             HammondSGGW.niag
        dependent_service_description   ^Tun.*-Chattanooga$, ^Tun.*-Midlothian$
#       dependent_service_description   ^Tun.*-\(?:Chattanooga|Midlothian\)$
        host_name                       BuffaloSGGW.niag
        service_description             Niagara_SSH
        execution_failure_criteria      c
}
define servicedependency{
        dependent_host_name             WessonSGGW.niag,MESSGGW.niag,EnfieldSGGW.niag,GBLongmoreSGGW.niag,HarveySGGW.niag,ManchesterSGGW.niag,NewportSGGW.n
#       dependent_service_description   ^Tun.*-10\.[125]$
        dependent_service_description   ^Tun.*-Buffalo$, ^Tun.*-Chattanooga$, ^Tun.*-Midlothian$
#       dependent_service_description   ^Tun.*-Buffalo|Chattanooga|Midlothian$
        host_name                       BuffaloSGGW.niag
        service_description             Niagara_SSH
        execution_failure_criteria      c
}

-- 
John A. Sullivan III
Open Source Development Corporation
+1 207-985-7880
jsullivan at opensourcedevel.com

Financially sustainable open source development
http://www.opensourcedevel.com


-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Nagios-users mailing list
Nagios-users at lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nagios-users
::: Please include Nagios version, plugin version (-v) and OS when reporting any issue. 
::: Messages without supporting info will risk being sent to /dev/null





More information about the Users mailing list