[Pkg-nagios-devel] Bug#398767: nagios-plugins-basic: utils.pm is_hostname() doesn't allow dashes in hostname or domains

Michael Bussmann debian at mb-net.net
Wed Nov 15 14:21:20 CET 2006

Package: nagios-plugins-basic
Version: 1.4.4-1
Severity: normal

Hi there,

is_hostname() in /usr/lib/nagios/plugins/utils.pm:79 contains the pattern

| if ($host1 && $host1 =~ m/^([0-9]+\.[0-9]+\.[0-9]+\.[0-9]+|[a-zA-Z0-9]+(\.[a-zA-Z0-9]+)*)$/) {

This will fail if either the hostname or the domain part contains a
dash.  I ran into this problem, because some host definitons have names
in the address statement, so $HOSTADDRESS$ expands to a name instead of
an address.

Simply adding "-" to the RE fixes the issue for me:

| if ($host1 && $host1 =~ m/^([0-9]+\.[0-9]+\.[0-9]+\.[0-9]+|[a-zA-Z0-9-]+(\.[a-zA-Z0-9-]+)*)$/) {


-- System Information:
Debian Release: 3.1
  APT prefers stable
  APT policy: (920, 'stable'), (900, 'stable'), (810, 'testing'), (200, 'unstable'), (50, 'experimental')
Architecture: i386 (i686)
Shell:  /bin/sh linked to /bin/dash
Kernel: Linux
Locale: LANG=C, LC_CTYPE=de_DE (charmap=ISO-8859-1)

Versions of packages nagios-plugins-basic depends on:
ii  iputils-ping                3:20020927-2 Tools to test the reachability of 
ii  libc6                       2.3.6.ds1-7  GNU C Library: Shared libraries
ii  libssl0.9.8                 0.9.8c-3     SSL shared libraries
ii  procps                      1:3.2.7-3    /proc file system utilities
ii  ucf                         2.0016       Update Configuration File: preserv

nagios-plugins-basic recommends no packages.

-- debconf-show failed

More information about the Pkg-nagios-devel mailing list