[Nagiosplug-devel] Testcase for is_hostname (was something else)

Andreas Ericsson ae at op5.se
Wed Nov 1 12:25:45 CET 2006

Ton Voon wrote:
> On 27 Oct 2006, at 15:50, sean finney wrote:
>> On Fri, 2006-10-27 at 15:01 +0100, Ton Voon wrote:
>>> Andreas, I'm not sure what you would like to see. Is it:
>>>   "nonfqdn-but-ends-in-dot." => 0
>>>   "otherwise.something." => 1
>> i'd say something ending in '.' should be considered a valid hostname no
>> matter what (assume there are no other problems with it).  whether or
>> not it *resolves* ought to be an orthogonal issue.
> Sounds fair. I guess you may want to test the domain "com." or if you 
> implement an internal DNS with your own top level domain (we use 
> "altinity" as our top level).
> OK, I'll change the test and alter the code to reflect.
>> or is the test also testing resolvable domains?
> No - it is purely a textual test. To save for a later time, but there's 
> an argument to not bother doing this type of check at all and have an 
> "unresolveable hostname" caught in exceptions later down in any plugins.

This sounds by far the best solution. If we *do* have this check we need 
to grok /etc/resolv.conf lines properly and see if "no-dots-anywhere" 
can still be resolved.

Imo, we gain nothing for a lot of work by having the "does it look like 
a hostname?" check before "can we resolve it?". This is especially true 
as we need to try to resolve the hostname anyway if we think it's a 
valid one and there's always of chance of false rejects which I'm sure 
will annoy people no end.

Andreas Ericsson                   andreas.ericsson at op5.se
OP5 AB                             www.op5.se
Tel: +46 8-230225                  Fax: +46 8-230231

More information about the Devel mailing list