common/objects: Make 'address' optional for hosts

Many people put fully qualified dns names as host_names and
don't really need or want to put in an extra 'address' field.
We humor them with this patch, assigning the host_name to the
address field in case address isn't set.

While at it, we do the same for 'alias', which was previously
copied (rather than assigned), and naturally make sure that
all variables are free()'d safely or ignored correctly at cleanup
time.

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

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

It's been deprecated since 2008, so the gracetime was about three
years longer than anyone could possibly need.

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

git-svn-id: https://nagios.svn.sourceforge.net/svnroot/nagios/nagioscore/trunk@2184 5f96b256-904b-4d8d-8c98-d829582c6739
core: Restore -x, but as a noop with a deprecation notice

Some large users will have that in more than a few scripts, so we
play nice with them and give them a year or so so remove those
occurrences.

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

git-svn-id: https://nagios.svn.sourceforge.net/svnroot/nagios/nagioscore/trunk@2185 5f96b256-904b-4d8d-8c98-d829582c6739
core: Move the timing_point() calls somewhat

The previous output was somewhat confusing, as the time used
didn't show up on the line where the time was actually spent. By
moving the timing points to after the things they time, we get a
picture that's easier to understand.

While we're at it, we also print the number of objects we added
at each point.

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

git-svn-id: https://nagios.svn.sourceforge.net/svnroot/nagios/nagioscore/trunk@2186 5f96b256-904b-4d8d-8c98-d829582c6739
Fix small thinko in fcache_servicedependency()

We would previously print dependency_period even if it wasn't set.
This patch corrects that.

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

git-svn-id: https://nagios.svn.sourceforge.net/svnroot/nagios/nagioscore/trunk@2187 5f96b256-904b-4d8d-8c98-d829582c6739
xdata/xodtemplate: Fix typo causing segfaults with serviceescalations

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

git-svn-id: https://nagios.svn.sourceforge.net/svnroot/nagios/nagioscore/trunk@2188 5f96b256-904b-4d8d-8c98-d829582c6739
xdata/xodtemplate: Start counting escalations too

Since escalations can avoid skiplist insertions just as dependencies,
we have to count them manually as we duplicate them. We also add the
missing code to cound objects properly for the cgi's, which have been
a second class citizen up til now (actually, they still are, since I'm
not bothering with testing them until I'm done with the core).

Since we're now counting an awful lot of object types, we might as
well do so using an object_count struct and move all other counters
over to that one.

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

git-svn-id: https://nagios.svn.sourceforge.net/svnroot/nagios/nagioscore/trunk@2189 5f96b256-904b-4d8d-8c98-d829582c6739
xdata/xodtemplate: Honor exclusions when creating service lists

Everywhere else we're careful to create (and use) member maps when
creating lists of objects, but xodtemplate_create_service_list()
neglected to do that, causing servicedependencies like this:

  define servicedependency {
      hostgroup_name                 all-hosts
      service_description            agent
      dependent_hostgroup_name       all-hosts
      dependent_host_name            A,B,C
      dependent_service_description  PING,PONG,PANG,!PANG
      execution_failure_criteria     w,u,c
      notification_failure_criteria  w,u,c
  }

to result in multiple (identical) servicedependencies for all
hosts from all hosts (including explicitly rejected PANG service),
leading to potentially far more service dependencies than we
could sensibly handle.

With this patch, all services named PANG are completely excluded
from the created list, and each host gets exactly one dependency.

For our small test-config (with only 8 hosts and 24 services),
this means a reduction in dependencies from 912 to 640. For
larger networks, the savings will be much greater.

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

git-svn-id: https://nagios.svn.sourceforge.net/svnroot/nagios/nagioscore/trunk@2190 5f96b256-904b-4d8d-8c98-d829582c6739
core: Only warn about hosts with no services if verify_config >= 2

This is accomplished by giving -v twice (or more). "empty" hosts
are perfectly valid ever since active host checks were introduced,
so it's time we get these warnings a bit harder to come by.

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

git-svn-id: https://nagios.svn.sourceforge.net/svnroot/nagios/nagioscore/trunk@2191 5f96b256-904b-4d8d-8c98-d829582c6739
common/objects: Stash dependencies with their parents for cgi's too

Otherwise config.cgi won't be able to list them at all.

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

git-svn-id: https://nagios.svn.sourceforge.net/svnroot/nagios/nagioscore/trunk@2192 5f96b256-904b-4d8d-8c98-d829582c6739
xdata/xodtemplate: Update timing_point() messages

It's nifty to see how many objects were created with respect to how
many services there are, since that provides a meaningful context for
later errors.

While at it, we also add the missing message for when servicegroup
recombobulation is done and fix service counting so it's never tainted
by future cgi code.

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

git-svn-id: https://nagios.svn.sourceforge.net/svnroot/nagios/nagioscore/trunk@2193 5f96b256-904b-4d8d-8c98-d829582c6739
core: Speed up group registration considerable

Previously we'd engage in insertion-sorting the members into their
respective lists. That's fine and dandy when there's about five of
them, but with the massive member-lists found in large configs today
it's sheer murder to use an O(n^2) algorithm to do sorting. Until we
can be bothered to do an O(n lg n) algorithm for an unbound number of
members (heap-sort should work well), we simply stash the objects to
the front of the member list if large installation tweaks are enabled.

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

git-svn-id: https://nagios.svn.sourceforge.net/svnroot/nagios/nagioscore/trunk@2194 5f96b256-904b-4d8d-8c98-d829582c6739
common/objects: Revamp group member addition logic somewhat

I spotted this micro-optimization while doing the previous patch
and since it works nicely we might as well use it.

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

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