Page 1 of 1

[Nagios-devel] Required object directive validation missing

Posted: Mon Feb 14, 2011 10:35 pm
by Guest
According to 'current' nagios documentation for host definition
(http://nagios.sourceforge.net/docs/3_0/ ... tions.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=20
descriptions
for host definition, but still listed (red) ... and so=20
required?/confusing?
NOTE2: Either contacts or contact_groups must be defined, both do not=20
have to
be defined

This however does not appear to be correctly/fully validated. Example=20
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=20
be:

- host_name
- alias
- check_period
- notification_interval
- notification_period


Similar applies to service definition. List of required directives=20
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=20
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=20
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=20
every
possible iteration for each).

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

Some of the above examples are not that bad, nagios ends up ignoreing=20
those
invalid definitions. For example host definition with no directives or=20
with
only max_check_attempts directive does nothing. But other definitions,=20
last
host definition and last service definition for example (granted=20
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=20
obvious?

Thanks,
-Peter=20





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