Re: [Nagios-devel] Again some pattern matching problem now with use_true_regexp_matching=0

Support forum for Nagios Core, Nagios Plugins, NCPA, NRPE, NSCA, NDOUtils and more. Engage with the community of users including those using the open source solutions.
Locked
Guest

Re: [Nagios-devel] Again some pattern matching problem now with use_true_regexp_matching=0

Post by Guest »

Andreas Ericsson wrote:

> Robert Bossecker wrote:
>
>> Hello,
>>
>> when trying no true patterns in service definitions all went fine
>> with "*" substitutions,
>> at least when using the asterisk at the end.
>>
>> i tried then using "?" in patterns and it failed.
>>
>
> Which is expected behaviour. ? by itself is not a special regex char,
> but a wildcard. There's a difference.
> I suppose you have the use_regexp_matching enabled?
>
yes

>> i have defined hosts named "sapt11ms" "sapt12ms" and so on
>>
>> now i created a service definition with a host_name "sap???ms" and
>> nagios complained
>> that there are no matches
>>
>
> Try host_name sap...ms
> I know the docs state otherwise, but I know for a fact that the regex
> matching is fairly new and replaced wildcard substitution not very
> long ago. It might just be that the docs aren't up to date with the
> code (it is beta after all, and people who want regex matching usually
> knows how to write regexes).
>
also the source code checks for "?" contained in the pattern and sets
"use_regexp=1", but this makes
only sense if then all "?" are converted to "." to match the documentation.

also when use_true_regexp is not set then a "*" must normally be
translated into ".*" otherwise the last
character of the "argument" is 0 or more times allowed, because
internally all patterns are computed
as regexp and not as globs as the documentation states.

But nevertheless i actually have converted my config to true regexps

Regards
Robert






This post was automatically imported from historical nagios-devel mailing list archives
Original poster: [email protected]
Locked