naemon/Makefile.am: Add wpres-phash.h to CLEANFILES

Signed-off-by: Adam James <adam.james@transitiv.co.uk>
autotools: Detect supported compiler flags

This commit adds an autoconf macro that checks for supported compiler
flags. We use this to dynamically build AM_CFLAGS in configure.ac.

Preprocessor defines have been moved into AM_CPPFLAGS and CFLAGS to
AM_CFLAGS. This allows users to negate certain flags should they so
wish.

Signed-off-by: Adam James <adam.james@transitiv.co.uk>
utils.c and commands.c need poll.h to compile successfully.

Signed-off-by: Jonathan Reams <jbreams@gmail.com>
Add ability for NEB modules to override host checks.

Service checks can be overriden both in
NEBTYPE_SERVICECHECK_ASYNC_PRECHECK and in
NEBTYPE_SERVICECHECK_INITIATE, but host checks only allow
ASYNC_PRECHECK. This makes hosts consistent with services.

Signed-off-by: Jonathan Reams <jbreams@gmail.com>
make rc script work on other systems too

make rc script work on debian, ubuntu and sles too

Signed-off-by: Sven Nierlein <sven@consol.de>
clean some more files

clean files which are not part of the repository.

Signed-off-by: Sven Nierlein <sven@consol.de>
naemon/Makefile.am: Add wpres-phash.h to CLEANFILES

Signed-off-by: Adam James <adam.james@transitiv.co.uk>
fix rc script

use start-stop-daemon if available, unfortunatly daemon has different options
and behaviour on various systems.

Signed-off-by: Sven Nierlein <sven@consol.de>
changed version

the first release should not have version 4

Signed-off-by: Sven Nierlein <sven@consol.de>
defaults.h is generated so it should be ignored

Signed-off-by: Sven Nierlein <sven@consol.de>
Remove ramdisk references since not needed anymore, fix pid path

Signed-off-by: Daniel Wittenberg <dwittenberg2008@gmail.com>
use "naemon.cfg" instead of "nagios.cfg"

fixes "name of main configuration file looks suspicious" if there's an
mistake in configuration. also changed comments.

Signed-off-by: Sven Velt <sven@velt.de>
Merge pull request #11 from wAmpIre/change-cfg-from-nagios-to-naemon

use "naemon.cfg" instead of "nagios.cfg"
Cherry-pick nagios 7a5c874, which makes sure we don't forget output

Original commit message:

Really fixed bug #484 - Output from checks not getting back into Core

There was a race condition in the code that gathered the output from
checks where if the stderr was read first, stdout would never be read.
This commit fixes that condition.

Signed-off-by: Robin Sonefors <robin.sonefors@op5.com>
Change-Id: I292564157dbe9bfa822d7439d905f596ac25a413
test_checks: disable test case for service state type transition

Rationale (also as inline comment):

Since we now (as per a466b8f75d19819ca329069b555ea8c3fb872717) use only
asynchronous checks, we cannot get the routing result necessary to
determine the real state of the host before we're done evaluating the
service check result. This means that we'll always run max_attempts
checks for a service before we set it in a hard state.

The solution proposed to mitigate this issue is to add some kind of
trigger to checks, such that (in this case) the scheduled host check,
when finished would update the state type of the service appropriately.

Change-Id: I3bd7208118c1ddb353793d3f3e2e950d61e2ec3b
Signed-off-by: Anton Lofgren <alofgren@op5.com>
checks: don't require neb modules to redo service alert calculations

It's pretty unlikely that they want to do something different (although
that's still possible.) Nebmods that want to report/record host and
service alerts can now do so, rather effortlessly.

This patch adds NEBATTR_CHECK_ALERT to signify alert status of a check.

This allows us to avoid duplicating alert controls for modules which
just want to record alert information on their own.

Unfortunately, this requires some ABI breakage (in checks:handle_host_status)
which for some unknown reason is not declared static, despite not being
used anywhere outside the compilation unit, in order to gain access to the
alert_recorded information. It would be _possible_ to work around this
by recording the information to a global instead, but I really feel we
have enough of those.

Change-Id: I2667d093611eb1e8a91953d4713cc68c6138076d
Signed-off-by: Anton Lofgren <alofgren@op5.com>
Signed-off-by: Robin Sonefors <robin.sonefors@op5.com>
Allow contactgroups without members but having contactgroup_members

This doesn't make any sense actually. First if the members-string
isn't set, skip. If it still isn't set, and another string isn't set,
skip. Later, do some stuff, but not with the members-string, and if
it still isn't set, skip...

A contact group can have members in three ways:
- contacts, through the members attribute in the contactgroup
  definition
- contacts, through the contactgroup attribute in the contact
  definition
- contactgroups, through the contactgroup_members definition in the
  contactgroup definition.

Bailing out, just by not having "members", in the case where
contactgroup_members is resolved doesn't make much sense at all...

This solves the issue of nested contact groups doesn't work for
contactgroups not having members set.

Resolves the nagios part of op5#7958

Change-Id: I7a1d6615a98cef2024b8dc1df68fb4ad10884397
Signed-off-by: Max Sikstrom <msikstrom@op5.com>
test_checks: NULL-initialize check result structure

Previously, engine was left uninitialized, which seems to work out fine
in practice when building on centos6, but x86_32 on centos5 crashed a
lot.

Valgrind exposed a bunch of "Conditional jump or move depends on
uninitialised value(s)", a value which this small patch simply
initializes.

Change-Id: I0c050d1ec1d6a97e06a3884c7b4e2f7123805f65
Signed-off-by: Robin Sonefors <robin.sonefors@op5.com>
test_macros: Verify escaping of HOSTCHECKCOMMAND

We need to be able to STRIP_ILLEGAL_MACRO_CHARS for check command
macros. This patch verifies that we are, as implemented in f3a7f6d2

This verifies op5#7762.

Change-Id: I230dd230271744f32eb0556871390402e69b94dd
Signed-off-by: Anton Lofgren <alofgren@op5.com>
Signed-off-by: Robin Sonefors <robin.sonefors@op5.com>
worker: De-nest worker killing code

There's only really one system call that needs to loop - no need to put
a return in the middle of an if statement inside a loop that covers half
of the rest of the function.

Signed-off-by: Robin Sonefors <robin.sonefors@op5.com>