Using regex host matches in service definitions

Dominic J. Eidson deidson at seton.org
Wed Aug 24 17:11:22 CEST 2005


Andreas Ericsson wrote:
> Dominic J. Eidson wrote:
> 
>>
>> According to the documentation's section on "Time-Saving Tricks For 
>> Object Definitions" - I can use regular expressions to specify which 
>> hosts to apply a service to, if I enable the option use_regexp_matching.
>>
>> The example they give at 
>> http://nagios.sourceforge.net/docs/2_0/templatetricks.html - is as 
>> follows:
>>
>> All Hosts: If you want to create identical services that are assigned 
>> to all hosts that are defined in your configuration files, you can use 
>> a wildcard in the host_name directive as follows:
>>
>>     define service{
>>         host_name        *
>>         service_description    SOMESERVICE
>>         other service directives ...
>>         }
>>
>>
>> When I configure this in nagios-2.04b4, I get the following:
>>
>> # grep 'regex' nagios.cfg
>> # Values: 1 = enable regexp matching, 0 = disable regexp matching
>> use_regexp_matching=1
>> # (* and ?).  If the option is ENABLED, regexp matching occurs
>> use_true_regexp_matching=0
>>
> 
> Wildcard matching and regexes are two quite different things. man 
> regex(7) and man fnmatch(3) and glob(7) for more info on differences. 
> Nagios does only regex matching (the basic POSIX kind), so you need a 
> proper regular expression for it to work.

Yes, I'm familiar with the difference between regex and globbing. As you 
can see above, though - the documentation has an incorrect example, and 
that was what I was going by.

I tried your ^.*$ - and it works like a charm.

It would be worth for someone to fix the docs, though.... ;)


  - d.

-- 
Dominic J. Eidson                      http://www.faqs.org/rfcs/rfc1855.html
Network Engineer
Atos Origin
512-324-9914


-------------------------------------------------------
SF.Net email is Sponsored by the Better Software Conference & EXPO
September 19-22, 2005 * San Francisco, CA * Development Lifecycle Practices
Agile & Plan-Driven Development * Managing Projects & Teams * Testing & QA
Security * Process Improvement & Measurement * http://www.sqe.com/bsce5sf
_______________________________________________
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