@@ -0,0 +1,471 @@
+From: Michael Friedrich <Michael.Friedrich@netways.de>
+Date: Thu, 26 Sep 2013 20:33:19 +0000 (+0200)
+Subject: idoutils: add check_source support.
+X-Git-Tag: v1.10.0-beta~37
+X-Git-Url: https://git.icinga.org/?p=icinga-core.git;a=commitdiff_plain;h=44b8ee765c69eac913dd3fb0b505b8f73d9888b2;hp=66557d4cb65018b7a7d2aff0c47f866a90ad273e
+
+idoutils: add check_source support.
+
+refs #4709
+---
+
+diff --git a/module/idoutils/db/mysql/mysql.sql b/module/idoutils/db/mysql/mysql.sql
+index 91da5b0..fa4babf 100644
+--- a/module/idoutils/db/mysql/mysql.sql
++++ b/module/idoutils/db/mysql/mysql.sql
+@@ -703,6 +703,7 @@ CREATE TABLE IF NOT EXISTS icinga_hoststatus (
+ output TEXT character set latin1 default '',
+ long_output TEXT default '',
+ perfdata TEXT character set latin1 default '',
++ check_source TEXT character set latin1 default '',
+ current_state smallint default 0,
+ has_been_checked smallint default 0,
+ should_be_scheduled smallint default 0,
+@@ -1179,6 +1180,7 @@ CREATE TABLE IF NOT EXISTS icinga_servicestatus (
+ output TEXT character set latin1 default '',
+ long_output TEXT default '',
+ perfdata TEXT character set latin1 default '',
++ check_source TEXT character set latin1 default '',
+ current_state smallint default 0,
+ has_been_checked smallint default 0,
+ should_be_scheduled smallint default 0,
+diff --git a/module/idoutils/db/oracle/create_icinga_objects_oracle.sql b/module/idoutils/db/oracle/create_icinga_objects_oracle.sql
+index 265d16d..55727bf 100644
+--- a/module/idoutils/db/oracle/create_icinga_objects_oracle.sql
++++ b/module/idoutils/db/oracle/create_icinga_objects_oracle.sql
+@@ -1071,6 +1071,7 @@ CREATE TABLE hoststatus (
+ output clob,
+ long_output clob,
+ perfdata clob,
++ check_source varchar2(255) default '',
+ current_state integer default 0 ,
+ has_been_checked integer default 0 ,
+ should_be_scheduled integer default 0 ,
+@@ -1614,6 +1615,7 @@ CREATE TABLE servicestatus (
+ output clob,
+ long_output clob,
+ perfdata clob,
++ check_source varchar2(255) default '',
+ current_state integer default 0 ,
+ has_been_checked integer default 0 ,
+ should_be_scheduled integer default 0 ,
+diff --git a/module/idoutils/db/pgsql/pgsql.sql b/module/idoutils/db/pgsql/pgsql.sql
+index a7d455b..2d79747 100644
+--- a/module/idoutils/db/pgsql/pgsql.sql
++++ b/module/idoutils/db/pgsql/pgsql.sql
+@@ -732,6 +732,7 @@ CREATE TABLE icinga_hoststatus (
+ output TEXT default '',
+ long_output TEXT default '',
+ perfdata TEXT default '',
++ check_source TEXT default '',
+ current_state INTEGER default 0,
+ has_been_checked INTEGER default 0,
+ should_be_scheduled INTEGER default 0,
+@@ -1208,6 +1209,7 @@ CREATE TABLE icinga_servicestatus (
+ output TEXT default '',
+ long_output TEXT default '',
+ perfdata TEXT default '',
++ check_source TEXT default '',
+ current_state INTEGER default 0,
+ has_been_checked INTEGER default 0,
+ should_be_scheduled INTEGER default 0,
+diff --git a/module/idoutils/include/protoapi.h b/module/idoutils/include/protoapi.h
+index 63f3198..1cbf924 100644
+--- a/module/idoutils/include/protoapi.h
++++ b/module/idoutils/include/protoapi.h
+@@ -109,7 +109,7 @@
+
+ /************** COMMON DATA ATTRIBUTES **************/
+
+-#define IDO_MAX_DATA_TYPES 272
++#define IDO_MAX_DATA_TYPES 273
+
+ #define IDO_DATA_NONE 0
+
+@@ -394,4 +394,5 @@
+ #define IDO_DATA_DOWNTIMETRIGGERTIME 269
+ #define IDO_DATA_DISABLED_NOTIFICATIONS_EXPIRE_TIME 270
+ #define IDO_DATA_CUSTOMVARIABLESTATUS 271 /* seperate type from CUSTOMVARIABLE config */
++#define IDO_DATA_CHECKSOURCE 272
+ #endif
+diff --git a/module/idoutils/src/db.c b/module/idoutils/src/db.c
+index 881b4f0..bb07063 100644
+--- a/module/idoutils/src/db.c
++++ b/module/idoutils/src/db.c
+@@ -3949,7 +3949,7 @@ int ido2db_oci_prepared_statement_hoststatus(ido2db_idi *idi) {
+ "process_performance_data=:X39, obsess_over_host=:X40, "
+ "modified_host_attributes=:X41, event_handler=:X42, "
+ "check_command=:X43, normal_check_interval=:X44, "
+- "retry_check_interval=:X45, check_timeperiod_object_id=:X46 "
++ "retry_check_interval=:X45, check_timeperiod_object_id=:X46, check_source=:X47 "
+ "WHEN NOT MATCHED THEN "
+ "INSERT (id, instance_id, host_object_id, status_update_time, output, long_output, perfdata, "
+ "current_state, has_been_checked, should_be_scheduled, current_check_attempt, "
+@@ -3963,7 +3963,7 @@ int ido2db_oci_prepared_statement_hoststatus(ido2db_idi *idi) {
+ "percent_state_change, latency, execution_time, scheduled_downtime_depth, "
+ "failure_prediction_enabled, process_performance_data, obsess_over_host, "
+ "modified_host_attributes, event_handler, check_command, normal_check_interval, "
+- "retry_check_interval, check_timeperiod_object_id) "
++ "retry_check_interval, check_timeperiod_object_id, check_source) "
+ "VALUES (seq_hoststatus.nextval, :X1, :X2, unixts2localts(:X3), :X4i, :X5i, :X6i, "
+ ":X7, :X8, :X9, :X10, "
+ ":X11, unixts2localts(:X12), unixts2localts(:X13), :X14, "
+@@ -3976,7 +3976,7 @@ int ido2db_oci_prepared_statement_hoststatus(ido2db_idi *idi) {
+ ":X34, :X35, :X36, :X37, "
+ ":X38, :X39, :X40, "
+ ":X41, :X42, :X43, :X44, "
+- ":X45, :X46)",
++ ":X45, :X46, :X47)",
+ ido2db_db_tablenames[IDO2DB_DBTABLE_HOSTSTATUS]) == -1) {
+ buf = NULL;
+ }
+@@ -4086,7 +4086,7 @@ int ido2db_oci_prepared_statement_servicestatus(ido2db_idi *idi) {
+ "failure_prediction_enabled=:X39, process_performance_data=:X40, "
+ "obsess_over_service=:X41, modified_service_attributes=:X42, "
+ "event_handler=:X43, check_command=:X44, normal_check_interval=:X45, "
+- "retry_check_interval=:X46, check_timeperiod_object_id=:X47 "
++ "retry_check_interval=:X46, check_timeperiod_object_id=:X47, check_source=:X48 "
+ "WHEN NOT MATCHED THEN "
+ "INSERT "
+ "(id, instance_id, service_object_id, status_update_time, "
+@@ -4102,7 +4102,7 @@ int ido2db_oci_prepared_statement_servicestatus(ido2db_idi *idi) {
+ "percent_state_change, latency, execution_time, scheduled_downtime_depth, "
+ "failure_prediction_enabled, process_performance_data, obsess_over_service, "
+ "modified_service_attributes, event_handler, check_command, "
+- "normal_check_interval, retry_check_interval, check_timeperiod_object_id) "
++ "normal_check_interval, retry_check_interval, check_timeperiod_object_id, check_source) "
+ "VALUES "
+ "(seq_servicestatus.nextval, :X1, :X2, unixts2localts(:X3), "
+ ":X4i, :X5i, :X6i, :X7, :X8, :X9, :X10, :X11, "
+@@ -4112,7 +4112,7 @@ int ido2db_oci_prepared_statement_servicestatus(ido2db_idi *idi) {
+ ":X22, unixts2localts(:X23), unixts2localts(:X24), :X25, "
+ ":X26, :X27, :X28, :X29, :X30, :X31, :X32, :X33, "
+ ":X34, :X35, :X36, :X37, :X38, :X39, :X40, :X41, :X42, "
+- ":X43, :X44, :X45, :X46, :X47)",
++ ":X43, :X44, :X45, :X46, :X47, :X48)",
+ ido2db_db_tablenames[IDO2DB_DBTABLE_SERVICESTATUS]) == -1) {
+ buf = NULL;
+ }
+diff --git a/module/idoutils/src/dbhandlers.c b/module/idoutils/src/dbhandlers.c
+index fa2b07c..876f85b 100644
+--- a/module/idoutils/src/dbhandlers.c
++++ b/module/idoutils/src/dbhandlers.c
+@@ -3513,11 +3513,11 @@ int ido2db_handle_hoststatusdata(ido2db_idi *idi) {
+ double normal_check_interval = 0.0;
+ double retry_check_interval = 0.0;
+ char *ts[10];
+- char *es[5];
++ char *es[6];
+ unsigned long object_id = 0L;
+ unsigned long check_timeperiod_object_id = 0L;
+ int x = 0;
+- void *data[56];
++ void *data[57];
+
+ ido2db_log_debug_info(IDO2DB_DEBUGL_PROCESSINFO, 2, "ido2db_handle_hoststatusdata() start\n");
+
+@@ -3575,6 +3575,7 @@ int ido2db_handle_hoststatusdata(ido2db_idi *idi) {
+ es[2] = ido2db_db_escape_string(idi, idi->buffered_input[IDO_DATA_PERFDATA]);
+ es[3] = ido2db_db_escape_string(idi, idi->buffered_input[IDO_DATA_EVENTHANDLER]);
+ es[4] = ido2db_db_escape_string(idi, idi->buffered_input[IDO_DATA_CHECKCOMMAND]);
++ es[5] = ido2db_db_escape_string(idi, idi->buffered_input[IDO_DATA_CHECKSOURCE]);
+
+ ts[0] = ido2db_db_timet_to_sql(idi, tstamp.tv_sec);
+ ts[1] = ido2db_db_timet_to_sql(idi, last_check);
+@@ -3649,6 +3650,8 @@ int ido2db_handle_hoststatusdata(ido2db_idi *idi) {
+ data[53] = (void *) &last_time_unreachable;
+ data[54] = (void *) &last_notification;
+ data[55] = (void *) &next_notification;
++ /* check_source */
++ data[56] = (void *) &es[5];
+
+ ido2db_log_debug_info(IDO2DB_DEBUGL_PROCESSINFO, 2, "ido2db_handle_hoststatusdata() LongLen:%d\n", strlen(es[1]));
+
+@@ -3710,11 +3713,11 @@ int ido2db_handle_servicestatusdata(ido2db_idi *idi) {
+ double normal_check_interval = 0.0;
+ double retry_check_interval = 0.0;
+ char *ts[11];
+- char *es[5];
++ char *es[6];
+ unsigned long object_id = 0L;
+ unsigned long check_timeperiod_object_id = 0L;
+ int x = 0;
+- void *data[58];
++ void *data[59];
+
+ ido2db_log_debug_info(IDO2DB_DEBUGL_PROCESSINFO, 2, "ido2db_handle_servicestatusdata() start\n");
+
+@@ -3773,6 +3776,7 @@ int ido2db_handle_servicestatusdata(ido2db_idi *idi) {
+ es[2] = ido2db_db_escape_string(idi, idi->buffered_input[IDO_DATA_PERFDATA]);
|
@@ -0,0 +1,404 @@
+From: Michael Friedrich <Michael.Friedrich@netways.de>
+Date: Thu, 26 Sep 2013 19:53:03 +0000 (+0200)
+Subject: core: add check result source
+X-Git-Tag: v1.10.0-beta~38
+X-Git-Url: https://git.icinga.org/?p=icinga-core.git;a=commitdiff_plain;h=66557d4cb65018b7a7d2aff0c47f866a90ad273e;hp=ec6c94e4dae5cc07da69fd068687c5e6807b0016
+
+core: add check result source
+
+refs #4709
+---
+
+diff --git a/base/broker.c b/base/broker.c
+index d0408e4..b7d84f5 100644
+--- a/base/broker.c
++++ b/base/broker.c
+@@ -241,7 +241,7 @@ int broker_event_handler(int type, int flags, int attr, int eventhandler_type, v
+
+
+ /* send host check data to broker */
+-int broker_host_check(int type, int flags, int attr, host *hst, int check_type, int state, int state_type, struct timeval start_time, struct timeval end_time, char *cmd, double latency, double exectime, int timeout, int early_timeout, int retcode, char *cmdline, char *output, char *long_output, char *perfdata, struct timeval *timestamp) {
++int broker_host_check(int type, int flags, int attr, host *hst, int check_type, int state, int state_type, struct timeval start_time, struct timeval end_time, char *cmd, double latency, double exectime, int timeout, int early_timeout, int retcode, char *cmdline, char *output, char *long_output, char *perfdata, struct timeval *timestamp, char *check_source) {
+ char *command_buf = NULL;
+ char *command_name = NULL;
+ char *command_args = NULL;
+@@ -300,7 +300,7 @@ int broker_host_check(int type, int flags, int attr, host *hst, int check_type,
+
+
+ /* send service check data to broker */
+-int broker_service_check(int type, int flags, int attr, service *svc, int check_type, struct timeval start_time, struct timeval end_time, char *cmd, double latency, double exectime, int timeout, int early_timeout, int retcode, char *cmdline, struct timeval *timestamp) {
++int broker_service_check(int type, int flags, int attr, service *svc, int check_type, struct timeval start_time, struct timeval end_time, char *cmd, double latency, double exectime, int timeout, int early_timeout, int retcode, char *cmdline, struct timeval *timestamp, char *check_source) {
+ char *command_buf = NULL;
+ char *command_name = NULL;
+ char *command_args = NULL;
+diff --git a/base/checks.c b/base/checks.c
+index 16d1cd7..b092e81 100644
+--- a/base/checks.c
++++ b/base/checks.c
+@@ -541,7 +541,7 @@ int run_async_service_check(service *svc, int check_options, double latency, int
+ end_time.tv_usec = 0L;
+
+ /* send data to event broker */
+- neb_result = broker_service_check(NEBTYPE_SERVICECHECK_ASYNC_PRECHECK, NEBFLAG_NONE, NEBATTR_NONE, svc, SERVICE_CHECK_ACTIVE, start_time, end_time, svc->service_check_command, svc->latency, 0.0, 0, FALSE, 0, NULL, NULL);
++ neb_result = broker_service_check(NEBTYPE_SERVICECHECK_ASYNC_PRECHECK, NEBFLAG_NONE, NEBATTR_NONE, svc, SERVICE_CHECK_ACTIVE, start_time, end_time, svc->service_check_command, svc->latency, 0.0, 0, FALSE, 0, NULL, NULL, NULL);
+
+ if (neb_result == NEBERROR_CALLBACKCANCEL || neb_result == NEBERROR_CALLBACKOVERRIDE) {
+ log_debug_info(DEBUGL_CHECKS, 0, "Check of service '%s' on host '%s' was %s by a module\n",
+@@ -610,7 +610,7 @@ int run_async_service_check(service *svc, int check_options, double latency, int
+
+ #ifdef USE_EVENT_BROKER
+ /* send data to event broker */
+- neb_result = broker_service_check(NEBTYPE_SERVICECHECK_INITIATE, NEBFLAG_NONE, NEBATTR_NONE, svc, SERVICE_CHECK_ACTIVE, start_time, end_time, svc->service_check_command, svc->latency, 0.0, service_check_timeout, FALSE, 0, processed_command, NULL);
++ neb_result = broker_service_check(NEBTYPE_SERVICECHECK_INITIATE, NEBFLAG_NONE, NEBATTR_NONE, svc, SERVICE_CHECK_ACTIVE, start_time, end_time, svc->service_check_command, svc->latency, 0.0, service_check_timeout, FALSE, 0, processed_command, NULL, NULL);
+
+ my_free(svc->processed_command);
+ svc->processed_command = strdup(processed_command);
+@@ -1194,6 +1194,7 @@ int handle_async_service_check_result(service *temp_service, check_result *queue
+ log_debug_info(DEBUGL_CHECKS, 2, "Short Output: %s\n", (temp_service->plugin_output == NULL) ? "NULL" : temp_service->plugin_output);
+ log_debug_info(DEBUGL_CHECKS, 2, "Long Output: %s\n", (temp_service->long_plugin_output == NULL) ? "NULL" : temp_service->long_plugin_output);
+ log_debug_info(DEBUGL_CHECKS, 2, "Perf Data: %s\n", (temp_service->perf_data == NULL) ? "NULL" : temp_service->perf_data);
++ log_debug_info(DEBUGL_CHECKS, 2, "Check Source: %s\n", (queued_check_result->source == NULL) ? "NULL" : queued_check_result->source);
+
+ /* grab the return code */
+ temp_service->current_state = queued_check_result->return_code;
+@@ -1817,9 +1818,15 @@ int handle_async_service_check_result(service *temp_service, check_result *queue
+ }
+ }
+
++ /* set check source */
++ if (queued_check_result->source != NULL)
++ temp_service->check_source = (char *)strdup(queued_check_result->source);
++ else
++ temp_service->check_source = (char *)strdup("(local)");
++
+ #ifdef USE_EVENT_BROKER
+ /* send data to event broker */
+- broker_service_check(NEBTYPE_SERVICECHECK_PROCESSED, NEBFLAG_NONE, NEBATTR_NONE, temp_service, temp_service->check_type, queued_check_result->start_time, queued_check_result->finish_time, temp_service->service_check_command, temp_service->latency, temp_service->execution_time, service_check_timeout, queued_check_result->early_timeout, queued_check_result->return_code, temp_service->processed_command, NULL);
++ broker_service_check(NEBTYPE_SERVICECHECK_PROCESSED, NEBFLAG_NONE, NEBATTR_NONE, temp_service, temp_service->check_type, queued_check_result->start_time, queued_check_result->finish_time, temp_service->service_check_command, temp_service->latency, temp_service->execution_time, service_check_timeout, queued_check_result->early_timeout, queued_check_result->return_code, temp_service->processed_command, NULL, temp_service->check_source);
+ #endif
+
+ /* set the checked flag */
+@@ -2848,7 +2855,7 @@ int run_sync_host_check_3x(host *hst, int *check_result_code, int check_options,
+ /* send data to event broker */
+ end_time.tv_sec = 0L;
+ end_time.tv_usec = 0L;
+- broker_host_check(NEBTYPE_HOSTCHECK_INITIATE, NEBFLAG_NONE, NEBATTR_NONE, hst, HOST_CHECK_ACTIVE, hst->current_state, hst->state_type, start_time, end_time, hst->host_check_command, hst->latency, 0.0, host_check_timeout, FALSE, 0, NULL, NULL, NULL, NULL, NULL);
++ broker_host_check(NEBTYPE_HOSTCHECK_INITIATE, NEBFLAG_NONE, NEBATTR_NONE, hst, HOST_CHECK_ACTIVE, hst->current_state, hst->state_type, start_time, end_time, hst->host_check_command, hst->latency, 0.0, host_check_timeout, FALSE, 0, NULL, NULL, NULL, NULL, NULL, NULL);
+ #endif
+
+ /* execute the host check */
+@@ -2867,7 +2874,7 @@ int run_sync_host_check_3x(host *hst, int *check_result_code, int check_options,
+
+ #ifdef USE_EVENT_BROKER
+ /* send data to event broker */
+- broker_host_check(NEBTYPE_HOSTCHECK_PROCESSED, NEBFLAG_NONE, NEBATTR_NONE, hst, HOST_CHECK_ACTIVE, hst->current_state, hst->state_type, start_time, end_time, hst->host_check_command, hst->latency, hst->execution_time, host_check_timeout, FALSE, hst->current_state, hst->processed_command, hst->plugin_output, hst->long_plugin_output, hst->perf_data, NULL);
++ broker_host_check(NEBTYPE_HOSTCHECK_PROCESSED, NEBFLAG_NONE, NEBATTR_NONE, hst, HOST_CHECK_ACTIVE, hst->current_state, hst->state_type, start_time, end_time, hst->host_check_command, hst->latency, hst->execution_time, host_check_timeout, FALSE, hst->current_state, hst->processed_command, hst->plugin_output, hst->long_plugin_output, hst->perf_data, NULL, hst->check_source);
+ #endif
+
+ return result;
+@@ -2909,7 +2916,7 @@ int execute_sync_host_check_3x(host *hst) {
+ end_time.tv_usec = 0L;
+
+ /* send data to event broker */
+- neb_result = broker_host_check(NEBTYPE_HOSTCHECK_SYNC_PRECHECK, NEBFLAG_NONE, NEBATTR_NONE, hst, HOST_CHECK_ACTIVE, hst->current_state, hst->state_type, start_time, end_time, hst->host_check_command, hst->latency, 0.0, host_check_timeout, FALSE, 0, NULL, NULL, NULL, NULL, NULL);
++ neb_result = broker_host_check(NEBTYPE_HOSTCHECK_SYNC_PRECHECK, NEBFLAG_NONE, NEBATTR_NONE, hst, HOST_CHECK_ACTIVE, hst->current_state, hst->state_type, start_time, end_time, hst->host_check_command, hst->latency, 0.0, host_check_timeout, FALSE, 0, NULL, NULL, NULL, NULL, NULL, NULL);
+
+ /*
+ * neb module wants to cancel/override the host check
+@@ -2959,11 +2966,11 @@ int execute_sync_host_check_3x(host *hst) {
+ /* send data to event broker */
+ end_time.tv_sec = 0L;
+ end_time.tv_usec = 0L;
+- broker_host_check(NEBTYPE_HOSTCHECK_RAW_START, NEBFLAG_NONE, NEBATTR_NONE, hst, HOST_CHECK_ACTIVE, return_result, hst->state_type, start_time, end_time, hst->host_check_command, 0.0, 0.0, host_check_timeout, early_timeout, result, processed_command, hst->plugin_output, hst->long_plugin_output, hst->perf_data, NULL);
++ broker_host_check(NEBTYPE_HOSTCHECK_RAW_START, NEBFLAG_NONE, NEBATTR_NONE, hst, HOST_CHECK_ACTIVE, return_result, hst->state_type, start_time, end_time, hst->host_check_command, 0.0, 0.0, host_check_timeout, early_timeout, result, processed_command, hst->plugin_output, hst->long_plugin_output, hst->perf_data, NULL, NULL);
+ #endif
+
+ log_debug_info(DEBUGL_COMMANDS, 1, "Raw host check command: %s\n", raw_command);
+- log_debug_info(DEBUGL_COMMANDS, 0, "Processed host check ommand: %s\n", processed_command);
++ log_debug_info(DEBUGL_COMMANDS, 0, "Processed host check command: %s\n", processed_command);
+ my_free(raw_command);
+
+ /* clear plugin output and performance data buffers */
+@@ -3030,9 +3037,12 @@ int execute_sync_host_check_3x(host *hst) {
+ /* high resolution end time for event broker */
+ gettimeofday(&end_time, NULL);
+
++ /* set check source */
++ hst->check_source = (char *)strdup("(local)");
++
+ #ifdef USE_EVENT_BROKER
+ /* send data to event broker */
+- broker_host_check(NEBTYPE_HOSTCHECK_RAW_END, NEBFLAG_NONE, NEBATTR_NONE, hst, HOST_CHECK_ACTIVE, return_result, hst->state_type, start_time, end_time, hst->host_check_command, 0.0, exectime, host_check_timeout, early_timeout, result, processed_command, hst->plugin_output, hst->long_plugin_output, hst->perf_data, NULL);
++ broker_host_check(NEBTYPE_HOSTCHECK_RAW_END, NEBFLAG_NONE, NEBATTR_NONE, hst, HOST_CHECK_ACTIVE, return_result, hst->state_type, start_time, end_time, hst->host_check_command, 0.0, exectime, host_check_timeout, early_timeout, result, processed_command, hst->plugin_output, hst->long_plugin_output, hst->perf_data, NULL, hst->check_source);
+ #endif
+
+ log_debug_info(DEBUGL_CHECKS, 0, "** Sync host check done: state=%d\n", return_result);
+@@ -3177,7 +3187,7 @@ int run_async_host_check_3x(host *hst, int check_options, double latency, int sc
+ end_time.tv_usec = 0L;
+
+ /* send data to event broker */
+- neb_result = broker_host_check(NEBTYPE_HOSTCHECK_ASYNC_PRECHECK, NEBFLAG_NONE, NEBATTR_NONE, hst, HOST_CHECK_ACTIVE, hst->current_state, hst->state_type, start_time, end_time, hst->host_check_command, hst->latency, 0.0, host_check_timeout, FALSE, 0, NULL, NULL, NULL, NULL, NULL);
++ neb_result = broker_host_check(NEBTYPE_HOSTCHECK_ASYNC_PRECHECK, NEBFLAG_NONE, NEBATTR_NONE, hst, HOST_CHECK_ACTIVE, hst->current_state, hst->state_type, start_time, end_time, hst->host_check_command, hst->latency, 0.0, host_check_timeout, FALSE, 0, NULL, NULL, NULL, NULL, NULL, NULL);
+
+ /* neb module wants to cancel the host check - the check will be rescheduled for a later time by the scheduling logic */
+ if (neb_result == NEBERROR_CALLBACKCANCEL)
+@@ -3299,7 +3309,7 @@ int run_async_host_check_3x(host *hst, int check_options, double latency, int sc
+
+ #ifdef USE_EVENT_BROKER
+ /* send data to event broker */
+- broker_host_check(NEBTYPE_HOSTCHECK_INITIATE, NEBFLAG_NONE, NEBATTR_NONE, hst, HOST_CHECK_ACTIVE, hst->current_state, hst->state_type, start_time, end_time, hst->host_check_command, hst->latency, 0.0, host_check_timeout, FALSE, 0, processed_command, NULL, NULL, NULL, NULL);
++ broker_host_check(NEBTYPE_HOSTCHECK_INITIATE, NEBFLAG_NONE, NEBATTR_NONE, hst, HOST_CHECK_ACTIVE, hst->current_state, hst->state_type, start_time, end_time, hst->host_check_command, hst->latency, 0.0, host_check_timeout, FALSE, 0, processed_command, NULL, NULL, NULL, NULL, NULL);
+ #endif
+
+ /* reset latency (permanent value for this check will get set later) */
+@@ -3497,6 +3507,7 @@ int handle_async_host_check_result_3x(host *temp_host, check_result *queued_chec
+ log_debug_info(DEBUGL_CHECKS, 2, "\tLatency: %.3f\n", temp_host->latency);
+ log_debug_info(DEBUGL_CHECKS, 2, "\tReturn Status: %d\n", queued_check_result->return_code);
+ log_debug_info(DEBUGL_CHECKS, 2, "\tOutput: %s\n", (queued_check_result == NULL) ? "NULL" : queued_check_result->output);
++ log_debug_info(DEBUGL_CHECKS, 2, "\tSource: %s\n", (queued_check_result == NULL) ? "NULL" : queued_check_result->source);
+
+ /* decrement the number of host checks still out there... */
+ if (queued_check_result->check_type == HOST_CHECK_ACTIVE && currently_running_host_checks > 0)
+@@ -3652,6 +3663,11 @@ int handle_async_host_check_result_3x(host *temp_host, check_result *queued_chec
+ result = HOST_DOWN;
+ }
+
++ /* set check source */
++ if (queued_check_result->source != NULL)
++ temp_host->check_source = (char *)strdup(queued_check_result->source);
++ else
++ temp_host->check_source = (char *)strdup("(local)");
+
+ /******************* PROCESS THE CHECK RESULTS ******************/
+
+@@ -3671,7 +3687,7 @@ int handle_async_host_check_result_3x(host *temp_host, check_result *queued_chec
+
+ #ifdef USE_EVENT_BROKER
+ /* send data to event broker */
+- broker_host_check(NEBTYPE_HOSTCHECK_PROCESSED, NEBFLAG_NONE, NEBATTR_NONE, temp_host, temp_host->check_type, temp_host->current_state, temp_host->state_type, start_time_hires, end_time_hires, temp_host->host_check_command, temp_host->latency, temp_host->execution_time, host_check_timeout, queued_check_result->early_timeout, queued_check_result->return_code, temp_host->processed_command, temp_host->plugin_output, temp_host->long_plugin_output, temp_host->perf_data, NULL);
++ broker_host_check(NEBTYPE_HOSTCHECK_PROCESSED, NEBFLAG_NONE, NEBATTR_NONE, temp_host, temp_host->check_type, temp_host->current_state, temp_host->state_type, start_time_hires, end_time_hires, temp_host->host_check_command, temp_host->latency, temp_host->execution_time, host_check_timeout, queued_check_result->early_timeout, queued_check_result->return_code, temp_host->processed_command, temp_host->plugin_output, temp_host->long_plugin_output, temp_host->perf_data, NULL, temp_host->check_source);
+ #endif
+
+ return OK;
+diff --git a/base/utils.c b/base/utils.c
+index 6a34123..29d28a7 100644
+--- a/base/utils.c
++++ b/base/utils.c
+@@ -2933,6 +2933,8 @@ int process_check_result_file(char *fname) {
+ new_cr->return_code = atoi(val);
+ else if (!strcmp(var, "output"))
+ new_cr->output = (char *)strdup(val);
++ else if (!strcmp(var, "source"))
++ new_cr->source = (char *)strdup(val);
+ }
+ }
+
+@@ -3029,6 +3031,7 @@ int init_check_result(check_result *info) {
+ info->exited_ok = TRUE;
+ info->return_code = 0;
+ info->output = NULL;
|