Réf. : Nagios-devel digest, Vol 1 #833 - 11 msgs

Yann DIRSON yann.dirson at sagem.com
Fri Jun 10 12:10:36 CEST 2005


Andreas wrote:
>Yann DIRSON wrote:
>> (about multiple occurences of a property)
>> 
>(about multiple occurrences of 'use', actually).
>
>Several objects might want to inherit some variables that are common to 
>all objects. Several of those other objects may have many other settings 
>in common. It is then practical for the object in question to inherit 
>some variables and have others overwritten by subsequent 'use' 
statements.

Ah, that makes sense, in a way.  I thought that "use" would be handled in 
the same way as the other properties at read time, and then the last value 
read would prevail, and then in a subsequent pass the "use" clauses would 
be expanded.

Si if I understand well, "use" is handled specially at read time, right ? 
I've not looked at this part of the code, but I would tend to think it 
would make the code more complicated.  In addition, that would give to 
"use" quite different semantics from standard properties, which may not be 
a nice idea either. But I'll go and read the code, when I have time.


> You can, however, do *,!croiseur in the service description.

Ah, nice, thanks.  However, it looks like it does not work in regexp mode. 
 I could see that we could express it as an "everything but this word" 
anchored on both sides, but expressing such a thing with either regexp 
system is quite painful.  Having this "!" syntax available using regexps 
would be nice.  Since commas seem to still be available ("host_name 
a.*,z.*" matches all hosts starting with a or z), it would make sense to 
allow things like "host_name .*,!a.*", or more generally, 
"regexp,!regexp".  Would that be possible ?


>As for flavours, all regexes have the 
>same base features (and there aren't "so many". There are three; POSIX, 
>Extended POSIX and Perl. Perl regexes are pretty much only used in perl 
>and POSIX and extended POSIX are very similar).

Well, perl regexp are more and more used, thanks to libpcre - not sure yet 
if it would make sense to consider them for nagios, at least until I've 
used the current ones enough.

I guess we can forget about emacs and tcl regexp, which I think predate 
perl ones, but were virtually never implemented outside of their primary 
environments.  But even without mentionning the peculiarities of emacs 
regexps, there is enough differences between "basic" (also called 
"obsolete" in the glibc manpage) POSIX and extended POSIX (no + or ?, and 
different way to use parentheses in basic), that we will want to be more 
specific in the documentation.


>> And even if that would work, I would need back-references on groups in 
the 
>> regexps, so the alias can be something meaningful.  Can we do that, and 
if 
>> yes, using which syntax ?
>> 
>
>This I don't understand at all, but most likely it ties in with 
>referencing and naming. The _name_ of an object isn't supposed to be a 
>regex; The reference to it is.

Yes, the way I was expecting to us back-references in this case was not 
valid because the case was not valid.

There is however a situation where I would have like back-references : 
when we have a whole set of hosts for which we should define the same 
service-dependencies, for services on the same host, we currently have to 
duplicate the servicedependency blocks like the following:

define servicedependency{
       host_name                                a
       service_description                      s1
       dependent_host_name              a
       dependent_service_description    s2,s3
}

back-references would allow to factorize like:

define servicedependency{
       host_name                                (a|b|c)
       service_description                      s1
       dependent_host_name              \1
       dependent_service_description    s2,s3
}

But indeed, thinking more about it, it would not be flexible enough to 
address the problem that way, since using hostgroups would not allow us to 
bar-reference a host.  What we would need here is the ability to reference 
to a magic "self" host in "dependent_host_name".



-------------------------------------------------------
This SF.Net email is sponsored by: NEC IT Guy Games.  How far can you shotput
a projector? How fast can you ride your desk chair down the office luge track?
If you want to score the big prize, get to know the little guy.  
Play to win an NEC 61" plasma display: http://www.necitguy.com/?r=20




More information about the Developers mailing list