Required object directive validation missing

pm426 at graffiti.net pm426 at graffiti.net
Mon Feb 14 23:20:28 CET 2011


According to 'current' nagios documentation for host definition
(http://nagios.sourceforge.net/docs/3_0/objectdefinitions.html),
there are few required directives. Those directives are:

  - host_name
  - alias
  - address
  - max_check_attempts
  - check_period
  - contacts
  - contact_groups
  - notification_interval
  - notification_period

NOTE: address is not really required according to Note under 
descriptions
for host definition, but still listed (red) ... and so 
required?/confusing?
NOTE2: Either contacts or contact_groups must be defined, both do not 
have to
be defined

This however does not appear to be correctly/fully validated. Example 
of
invalid host definitions that pass validation without errors:

  define host{
  }

  define host{
  max_check_attempts 5
  }

  define host{
  contact_groups router-admins
  }

  # This will warns there are no contacts specified
  # maybe it should raise Error?
  define host{
  host_name bogus-router
  max_check_attempts 5
  }

  define host{
  host_name bogus-router
  max_check_attempts 5
  contact_groups router-admins
  }

>From above, only max_check_attempts and contact/contact_groups are
validated. Following additional directives are never checked but should 
be:

  - host_name
  - alias
  - check_period
  - notification_interval
  - notification_period


Similar applies to service definition. List of required directives 
according
to docs:

  - host_name
  - service_description
  - check_command
  - max_check_attempts
  - check_interval
  - retry_interval
  - check_period
  - notification_interval
  - notification_period
  - contacts
  - contact_groups

However, one can use following service definitions and they pass as 
valid:

  define service{
  }

  define service{
  host_name test-host
  }

  define service{
  host_name test-host
  check_command check-host-up
  }

  define service{
  host_name test-host
  service_description Ping
  max_check_attempts 2
  check_command check-host-alive
  }

Without check_command directive validation alerts with:
  "Error: Service description, host name, or check command is NULL"

Without max_check_attempts following error message is shown:
   "Error: Invalid max_attempts, check_interval, retry_interval, or 
notification_interval value for service ..."

But the messages do not apply to each and every directive they mention,
specifying just one makes the error go away (though I have not done 
every
possible iteration for each).

It is possible that other required object directives are not validated, 
but
this was not tested.

Some of the above examples are not that bad, nagios ends up ignoreing 
those
invalid definitions. For example host definition with no directives or 
with
only max_check_attempts directive does nothing. But other definitions, 
last
host definition and last service definition for example (granted 
host_name and
contact_groups used there are defined), result in never ending:
  "Caught SIGSEGV, shutting down..."

message in nagios.log.

Is anyone else experiencing these problems or am I missing something 
obvious?

Thanks,
-Peter 

------------------------------------------------------------------------------
The ultimate all-in-one performance toolkit: Intel(R) Parallel Studio XE:
Pinpoint memory and threading errors before they happen.
Find and fix more than 250 security defects in the development cycle.
Locate bottlenecks in serial and parallel code that limit performance.
http://p.sf.net/sfu/intel-dev2devfeb




More information about the Developers mailing list