Add 'dist' make target

We first create a symlink to ourselves and then create a tarball
excluding nested symlinks of ourselves. This way we can create a
tarball without leaving the current directoy.

Signed-off-by: Sven Nierlein <sven@nierlein.de>
Patched-by: Sven Nierlein <sven@nierlein.de>
Signed-off-by: Andreas Ericsson <ae@op5.se>

git-svn-id: https://nagios.svn.sourceforge.net/svnroot/nagios/nagioscore/trunk@2294 5f96b256-904b-4d8d-8c98-d829582c6739
Merge remote-tracking branch 'upstream/master' into almostcore
core: Remove perform_scheduled_host_check()

It only calls out to run_scheduled_host_check() anyway, so the only
real change is to call that function instead from the only callsite
perform_scheduled_host_check() had.

Signed-off-by: Andreas Ericsson <ae@op5.se>

git-svn-id: https://nagios.svn.sourceforge.net/svnroot/nagios/nagioscore/trunk@2295 5f96b256-904b-4d8d-8c98-d829582c6739
Make online_cpus() return at least 1

This makes calculations a bit easier when we need to autodetermine
something where knowing how many cores we have online is relevant.

Signed-off-by: Andreas Ericsson <ae@op5.se>

git-svn-id: https://nagios.svn.sourceforge.net/svnroot/nagios/nagioscore/trunk@2296 5f96b256-904b-4d8d-8c98-d829582c6739
core: Create more workers when asked to auto-decide

Two workers didn't work quite so well with large installs, but
the previous hardcoded value of 4 seems to have been quite ok
for most setups, so we're going with that as a minimum thing
and set no upper cap, as workers will mostly sleep anyways.

Signed-off-by: Andreas Ericsson <ae@op5.se>

git-svn-id: https://nagios.svn.sourceforge.net/svnroot/nagios/nagioscore/trunk@2297 5f96b256-904b-4d8d-8c98-d829582c6739
nagios.c: Take typical config file location from DEFAULT_CONFIG_FILE

This way it gets automagically updated whrn running ./configure

Signed-off-by: Andreas Ericsson <ae@op5.se>

git-svn-id: https://nagios.svn.sourceforge.net/svnroot/nagios/nagioscore/trunk@2300 5f96b256-904b-4d8d-8c98-d829582c6739
nagios.c: Update copyright years

Setting 'present' as the end date for the copyright makes sense so
long as we change it when the copyright owners change.

Signed-off-by: Andreas Ericsson <ae@op5.se>

git-svn-id: https://nagios.svn.sourceforge.net/svnroot/nagios/nagioscore/trunk@2301 5f96b256-904b-4d8d-8c98-d829582c6739
nagios.c: Mark -x as a deprecated option and remove -o altogether

-o used to be commented out, and -x used to be flagged as potentiall
dangerous with the "USE WITH CAUTION" text, so this just brings help
texts back in line with what we actually implement.

Signed-off-by: Andreas Ericsson <ae@op5.se>

git-svn-id: https://nagios.svn.sourceforge.net/svnroot/nagios/nagioscore/trunk@2302 5f96b256-904b-4d8d-8c98-d829582c6739
Make update checks work again

Carry-over from op5 specific code. Bleh...

Signed-off-by: Andreas Ericsson <ae@op5.se>

git-svn-id: https://nagios.svn.sourceforge.net/svnroot/nagios/nagioscore/trunk@2303 5f96b256-904b-4d8d-8c98-d829582c6739
janitor: Spelling

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

git-svn-id: https://nagios.svn.sourceforge.net/svnroot/nagios/nagioscore/trunk@2304 5f96b256-904b-4d8d-8c98-d829582c6739
worker: Make it easier to use from 3rd party code

We split the child_process struct into two parts - one public half that
anyone implementing a worker will probably care about, and one private
one that adds statistics for nagios to use.

We add a simple callback arg to enter_worker, and make it public, so we
can override the callback in 3rd party code and make it do other stuff
with jobs than simply to spawn commands.

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

git-svn-id: https://nagios.svn.sourceforge.net/svnroot/nagios/nagioscore/trunk@2305 5f96b256-904b-4d8d-8c98-d829582c6739
base/commands: Add source_name to command worker

source_name is a fairly recent addition, but it makes it possible to
display very useful names, assuming it's set everywhere. So set it.

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

git-svn-id: https://nagios.svn.sourceforge.net/svnroot/nagios/nagioscore/trunk@2306 5f96b256-904b-4d8d-8c98-d829582c6739
base/workers: Wrap worker variables into a struct

This creates the possibility to have more than one list of workers, each
having their own length and load distribution.

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

git-svn-id: https://nagios.svn.sourceforge.net/svnroot/nagios/nagioscore/trunk@2307 5f96b256-904b-4d8d-8c98-d829582c6739
base/workers: Use source_name to print which worker logged something

It looks nicer for the regular workers, and makes more sense for
non-standard workers.

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

git-svn-id: https://nagios.svn.sourceforge.net/svnroot/nagios/nagioscore/trunk@2308 5f96b256-904b-4d8d-8c98-d829582c6739
base/workers: Make it possible to register workers through query_handler

If a process opens the query handler socket, and sends a string on the
form
	@register_worker name=<name> plugin=<plugin1> plugin=<pluginN>
this process will be considered the only worker authorized for all the
plugins listed in the string.

It is possible for two processes to register for the same plugin, then
the load from the checks will be distributed between them evenly.

If the worker process dies, nagios will start to distribute the load
between the remaining workers for that plugin. If all of them dies,
nagios will move them back to the internal workers. Nagios will not
reschedule the already sent-out jobs, yet, though.

This creates the possibility to create workers that work completely
fork-free, which is sometimes a big win: embedded perl (or embedded
python/ruby/whatever) could be brought back through this API, rather
than through the old ifdef-heavy, in-core way. SNMP checks are another
example of checks that could benefit greatly from a dedicated worker.

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

git-svn-id: https://nagios.svn.sourceforge.net/svnroot/nagios/nagioscore/trunk@2309 5f96b256-904b-4d8d-8c98-d829582c6739
Add default location for query_socket

It's immensely useful (and will be made even more so), so we'll
just assume everybody wants it present.

Signed-off-by: Andreas Ericsson <ae@op5.se>

git-svn-id: https://nagios.svn.sourceforge.net/svnroot/nagios/nagioscore/trunk@2310 5f96b256-904b-4d8d-8c98-d829582c6739
lib/runcmd: Fix typo in runcmd_open()

s/execvpe/execvp/ for the "failed" error message.

Signed-off-by: Andreas Ericsson <ae@op5.se>

git-svn-id: https://nagios.svn.sourceforge.net/svnroot/nagios/nagioscore/trunk@2311 5f96b256-904b-4d8d-8c98-d829582c6739
Add -Wno-unused-result to nagios.spec

Otherwise we get a ton of alerts from not checking return codes
from asprintf() when we build things with decently recent versions
of gcc and glibc-headers.

Signed-off-by: Andreas Ericsson <ae@op5.se>

git-svn-id: https://nagios.svn.sourceforge.net/svnroot/nagios/nagioscore/trunk@2312 5f96b256-904b-4d8d-8c98-d829582c6739
Fix default location of query socket

@localstatedir@, not @localstatedir

Patched-by: Daniel Wittenberg <dwittenberg2008@gmail.com>
Signed-off-by: Andreas Ericsson <ae@op5.se>

git-svn-id: https://nagios.svn.sourceforge.net/svnroot/nagios/nagioscore/trunk@2313 5f96b256-904b-4d8d-8c98-d829582c6739
core: Make query_handler() sockets non-blocking

This means we can get rid of the non-portable MSG_NOSIGNAL, which
various BSD's (MacOSX included) doesn't support.

Signed-off-by: Andreas Ericsson <ae@op5.se>

git-svn-id: https://nagios.svn.sourceforge.net/svnroot/nagios/nagioscore/trunk@2314 5f96b256-904b-4d8d-8c98-d829582c6739