Search
j0ke.net Open Build Service
>
Projects
>
server:monitoring
>
icinga110
> icinga-core.git-eca694ab5905f2a827f9e46fbb7a0ef3bb0b4b9b.txt
Sign Up
|
Log In
Username
Password
Cancel
Overview
Repositories
Revisions
Requests
Users
Advanced
Attributes
Meta
File icinga-core.git-eca694ab5905f2a827f9e46fbb7a0ef3bb0b4b9b.txt of Package icinga110 (Revision 4)
Currently displaying revision
4
,
show latest
From: Michael Friedrich <Michael.Friedrich@netways.de> Date: Mon, 28 Oct 2013 19:06:41 +0000 (+0100) Subject: core/idoutils: revert check_source attribute due to mod_gearman manipulating in-memor... X-Git-Url: https://git.icinga.org/?p=icinga-core.git;a=commitdiff_plain;h=eca694ab5905f2a827f9e46fbb7a0ef3bb0b4b9b;hp=6fbac667be3335c8cdb1bf1d24ac27ecf21df841 core/idoutils: revert check_source attribute due to mod_gearman manipulating in-memory checkresult list mod_gearman uses the old nagios headers where check_source is not available. while using object compiler tricks with attribute at the end will work on direct object casts, this does not work with a neb broker addon which manipulates the doubly-linked check result list in memory stashing objects of different type altogether causing memory corruption. while the "thing" mod_gearman does in core memory remains a clear violation of the neb api ("subscribe to a neb callback and do stuff") it's just yet another proof that the neb api is not a safe place for innovative core features at all. reverting the check_source feature in 1.x for the sake of compatibility and only using 'check_source' in Icinga 2 as additional attribute. (been saying that for 4+ years now that core memory manipulation by addons is a bad thing, but noone ever believed me) refs #4958 --- diff --git a/Changelog b/Changelog index dd1d90b..9a06f1d 100644 --- a/Changelog +++ b/Changelog @@ -13,6 +13,12 @@ UPGRADE NOTES - idoutils: ${source}/module/idoutils/config/updates * package locations may differ! +1.10.1 - XX/YY/2013 + +* core/idoutils: revert check_source attribute due to mod_gearman manipulating in-memory checkresult list #4958 - MF + ** classic ui/idoutils schema: functionality is kept only for Icinga 2 support + + 1.10.0 - 24/10/2013 * idoutils: slahistory table must be removed manually after enable_sla removal #4363 diff --git a/base/broker.c b/base/broker.c index 58f1acb..0cfff17 100644 --- a/base/broker.c +++ b/base/broker.c @@ -258,7 +258,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, char *check_source) { +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 *command_buf = NULL; char *command_name = NULL; char *command_args = NULL; @@ -317,7 +317,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, char *check_source) { +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 *command_buf = NULL; char *command_name = NULL; char *command_args = NULL; diff --git a/base/checks.c b/base/checks.c index b092e81..16d1cd7 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, 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); 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, 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); my_free(svc->processed_command); svc->processed_command = strdup(processed_command); @@ -1194,7 +1194,6 @@ 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; @@ -1818,15 +1817,9 @@ 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, temp_service->check_source); + 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); #endif /* set the checked flag */ @@ -2855,7 +2848,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, 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); #endif /* execute the host check */ @@ -2874,7 +2867,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, hst->check_source); + 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); #endif return result; @@ -2916,7 +2909,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, 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); /* * neb module wants to cancel/override the host check @@ -2966,11 +2959,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, 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); #endif log_debug_info(DEBUGL_COMMANDS, 1, "Raw host check command: %s\n", raw_command); - log_debug_info(DEBUGL_COMMANDS, 0, "Processed host check command: %s\n", processed_command); + log_debug_info(DEBUGL_COMMANDS, 0, "Processed host check ommand: %s\n", processed_command); my_free(raw_command); /* clear plugin output and performance data buffers */ @@ -3037,12 +3030,9 @@ 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, hst->check_source); + 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); #endif log_debug_info(DEBUGL_CHECKS, 0, "** Sync host check done: state=%d\n", return_result); @@ -3187,7 +3177,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, 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); /* 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) @@ -3309,7 +3299,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, 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); #endif /* reset latency (permanent value for this check will get set later) */ @@ -3507,7 +3497,6 @@ 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) @@ -3663,11 +3652,6 @@ 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 ******************/ @@ -3687,7 +3671,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, temp_host->check_source); + 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); #endif return OK; diff --git a/base/utils.c b/base/utils.c index a2e96aa..33a7500 100644 --- a/base/utils.c +++ b/base/utils.c @@ -2933,8 +2933,6 @@ 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); } } @@ -3031,7 +3029,6 @@ int init_check_result(check_result *info) { info->exited_ok = TRUE; info->return_code = 0; info->output = NULL; - info->source = NULL; info->next = NULL; return OK; diff --git a/common/objects.c b/common/objects.c index cb1bda2..3bb52bf 100644 --- a/common/objects.c +++ b/common/objects.c @@ -848,7 +848,6 @@ host *add_host(char *name, char *display_name, char *alias, char *address, char my_free(new_host->plugin_output); my_free(new_host->long_plugin_output); my_free(new_host->perf_data); - my_free(new_host->check_source); #endif my_free(new_host->statusmap_image); my_free(new_host->vrml_image); @@ -1766,7 +1765,6 @@ service *add_service(char *host_name, char *description, char *display_name, cha my_free(new_service->perf_data); my_free(new_service->plugin_output); my_free(new_service->long_plugin_output); - my_free(new_service->check_source); #endif my_free(new_service->failure_prediction_options); my_free(new_service->notification_period); @@ -3489,7 +3487,6 @@ int free_object_data(void) { my_free(this_host->long_plugin_output); my_free(this_host->perf_data); my_free(this_host->processed_command); - my_free(this_host->check_source); free_objectlist(&this_host->hostgroups_ptr); #endif @@ -3691,7 +3688,6 @@ int free_object_data(void) { my_free(this_service->long_plugin_output); my_free(this_service->perf_data); my_free(this_service->processed_command); - my_free(this_service->check_source); my_free(this_service->event_handler_args); my_free(this_service->check_command_args); diff --git a/include/broker.h b/include/broker.h index dcf044a..6b4d0d0 100644 --- a/include/broker.h +++ b/include/broker.h @@ -194,8 +194,8 @@ void broker_log_data_with_host_service(int, int, int, char *, unsigned long, tim int broker_event_handler(int,int,int,int,void *,int,int,struct timeval,struct timeval,double,int,int,int,char *,char *,char *,struct timeval *); void broker_ocp_data(int,int,int,void *,int,int,double,int,int,struct timeval *); void broker_system_command(int,int,int,struct timeval,struct timeval,double,int,int,int,char *,char *,struct timeval *); -int broker_host_check(int,int,int,host *,int,int,int,struct timeval,struct timeval,char *,double,double,int,int,int,char *,char *,char *,char *,struct timeval *, char *); -int broker_service_check(int,int,int,service *,int,struct timeval,struct timeval,char *,double,double,int,int,int,char *,struct timeval *, char*); +int broker_host_check(int,int,int,host *,int,int,int,struct timeval,struct timeval,char *,double,double,int,int,int,char *,char *,char *,char *,struct timeval *); +int broker_service_check(int,int,int,service *,int,struct timeval,struct timeval,char *,double,double,int,int,int,char *,struct timeval *); void broker_comment_data(int,int,int,int,int,char *,char *,time_t,char *,char *,int,int,int,time_t,unsigned long,struct timeval *); void broker_downtime_data(int,int,int,int,char *,char *,time_t,char *,char *,time_t,time_t,int,unsigned long,unsigned long,unsigned long,struct timeval *,int,time_t); void broker_flapping_data(int,int,int,int,void *,double,double,double,struct timeval *); diff --git a/include/icinga.h b/include/icinga.h index dba8d76..40253ab 100644 --- a/include/icinga.h +++ b/include/icinga.h @@ -331,7 +331,6 @@ typedef struct check_result_struct{ int return_code; /* plugin return code */ char *output; /* plugin output */ struct check_result_struct *next; - char *source; }check_result; @@ -372,7 +371,6 @@ typedef struct passive_check_result_struct{ time_t check_time; double latency; struct passive_check_result_struct *next; - char *source; }passive_check_result; diff --git a/include/objects.h b/include/objects.h index 6bfe2ad..88da85c 100644 --- a/include/objects.h +++ b/include/objects.h @@ -421,7 +421,6 @@ struct host_struct{ $HOSTADDRESS6$ macro */ char *address6; time_t acknowledgement_end_time; - char *check_source; #ifdef NSCORE int current_down_notification_number; int current_unreachable_notification_number; @@ -566,7 +565,6 @@ struct service_struct{ PROCESSED state on host|service checks */ char *processed_command; time_t acknowledgement_end_time; - char *check_source; #ifdef NSCORE int current_warning_notification_number; int current_critical_notification_number; diff --git a/module/idoutils/include/protoapi.h b/module/idoutils/include/protoapi.h index 1cbf924..63f3198 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 273 +#define IDO_MAX_DATA_TYPES 272 #define IDO_DATA_NONE 0 @@ -394,5 +394,4 @@ #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 dda2744..f3c06b9 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, check_source=:X47 " + "retry_check_interval=:X45, check_timeperiod_object_id=:X46 " "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, check_source) " + "retry_check_interval, check_timeperiod_object_id) " "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, :X47)", + ":X45, :X46)", 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, check_source=:X48 " + "retry_check_interval=:X46, check_timeperiod_object_id=:X47 " "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, check_source) " + "normal_check_interval, retry_check_interval, check_timeperiod_object_id) " "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, :X48)", + ":X43, :X44, :X45, :X46, :X47)", ido2db_db_tablenames[IDO2DB_DBTABLE_SERVICESTATUS]) == -1) { buf = NULL; } diff --git a/module/idoutils/src/dbhandlers.c b/module/idoutils/src/dbhandlers.c index 3aaa132..e6c3dac 100644 --- a/module/idoutils/src/dbhandlers.c +++ b/module/idoutils/src/dbhandlers.c @@ -3597,11 +3597,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[6]; + char *es[5]; unsigned long object_id = 0L; unsigned long check_timeperiod_object_id = 0L; int x = 0; - void *data[57]; + void *data[56]; ido2db_log_debug_info(IDO2DB_DEBUGL_PROCESSINFO, 2, "ido2db_handle_hoststatusdata() start\n"); @@ -3659,7 +3659,6 @@ 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); @@ -3734,8 +3733,6 @@ 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])); @@ -3797,11 +3794,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[6]; + char *es[5]; unsigned long object_id = 0L; unsigned long check_timeperiod_object_id = 0L; int x = 0; - void *data[59]; + void *data[58]; ido2db_log_debug_info(IDO2DB_DEBUGL_PROCESSINFO, 2, "ido2db_handle_servicestatusdata() start\n"); @@ -3860,7 +3857,6 @@ int ido2db_handle_servicestatusdata(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); @@ -3943,8 +3939,6 @@ int ido2db_handle_servicestatusdata(ido2db_idi *idi) { data[55] = (void *) &last_time_critical; data[56] = (void *) &last_notification; data[57] = (void *) &next_notification; - /* check_source */ - data[58] = (void *) &es[5]; ido2db_query_insert_or_update_servicestatusdata_add(idi, data); diff --git a/module/idoutils/src/dbqueries.c b/module/idoutils/src/dbqueries.c index dd36d98..b46812e 100644 --- a/module/idoutils/src/dbqueries.c +++ b/module/idoutils/src/dbqueries.c @@ -3423,7 +3423,7 @@ int ido2db_query_insert_or_update_hoststatusdata_add(ido2db_idi *idi, void **dat } } } - asprintf(&query1, "UPDATE %s SET instance_id=%lu, host_object_id=%lu, status_update_time=%s, output='%s', long_output='%s', perfdata='%s', current_state=%d, has_been_checked=%d, should_be_scheduled=%d, current_check_attempt=%d, max_check_attempts=%d, last_check=%s, next_check=%s, check_type=%d, last_state_change=%s, last_hard_state_change=%s, last_hard_state=%d, last_time_up=%s, last_time_down=%s, last_time_unreachable=%s, state_type=%d, last_notification=%s, next_notification=%s, no_more_notifications=%d, notifications_enabled=%d, problem_has_been_acknowledged=%d, acknowledgement_type=%d, current_notification_number=%d, passive_checks_enabled=%d, active_checks_enabled=%d, event_handler_enabled=%d, flap_detection_enabled=%d, is_flapping=%d, percent_state_change='%lf', latency='%lf', execution_time='%lf', scheduled_downtime_depth=%d, failure_prediction_enabled=%d, process_performance_data=%d, obsess_over_host=%d, modified_host_attributes=%lu, event_handler='%s', check_command='%s', normal_check_interval='%lf', retry_check_interval='%lf', check_timeperiod_object_id=%lu, check_source='%s' WHERE host_object_id=%lu", + asprintf(&query1, "UPDATE %s SET instance_id=%lu, host_object_id=%lu, status_update_time=%s, output='%s', long_output='%s', perfdata='%s', current_state=%d, has_been_checked=%d, should_be_scheduled=%d, current_check_attempt=%d, max_check_attempts=%d, last_check=%s, next_check=%s, check_type=%d, last_state_change=%s, last_hard_state_change=%s, last_hard_state=%d, last_time_up=%s, last_time_down=%s, last_time_unreachable=%s, state_type=%d, last_notification=%s, next_notification=%s, no_more_notifications=%d, notifications_enabled=%d, problem_has_been_acknowledged=%d, acknowledgement_type=%d, current_notification_number=%d, passive_checks_enabled=%d, active_checks_enabled=%d, event_handler_enabled=%d, flap_detection_enabled=%d, is_flapping=%d, percent_state_change='%lf', latency='%lf', execution_time='%lf', scheduled_downtime_depth=%d, failure_prediction_enabled=%d, process_performance_data=%d, obsess_over_host=%d, modified_host_attributes=%lu, event_handler='%s', check_command='%s', normal_check_interval='%lf', retry_check_interval='%lf', check_timeperiod_object_id=%lu WHERE host_object_id=%lu", ido2db_db_tablenames[IDO2DB_DBTABLE_HOSTSTATUS], *(unsigned long *) data[0], /* update start */ *(unsigned long *) data[1], @@ -3470,8 +3470,7 @@ int ido2db_query_insert_or_update_hoststatusdata_add(ido2db_idi *idi, void **dat *(char **) data[42], *(double *) data[43], *(double *) data[44], - *(unsigned long *) data[45], - *(char **) data[56], /* update end */ + *(unsigned long *) data[45], /* update end */ *(unsigned long *) data[1] /* unique constraint start/end */ ); /* send query to db */ @@ -3511,7 +3510,7 @@ int ido2db_query_insert_or_update_hoststatusdata_add(ido2db_idi *idi, void **dat if (mysql_update == FALSE) { /* try insert instead */ - asprintf(&query2, "INSERT INTO %s (instance_id, host_object_id, status_update_time, output, long_output, perfdata, current_state, has_been_checked, should_be_scheduled, current_check_attempt, max_check_attempts, last_check, next_check, check_type, last_state_change, last_hard_state_change, last_hard_state, last_time_up, last_time_down, last_time_unreachable, state_type, last_notification, next_notification, no_more_notifications, notifications_enabled, problem_has_been_acknowledged, acknowledgement_type, current_notification_number, passive_checks_enabled, active_checks_enabled, event_handler_enabled, flap_detection_enabled, is_flapping, 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, check_source) VALUES (%lu, %lu, %s, '%s', '%s', '%s', %d, %d, %d, %d, %d, %s, %s, %d, %s, %s, %d, %s, %s, %s, %d, %s, %s, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d, %lf, %lf, %lf, %d, %d, %d, %d, %lu, '%s', '%s', %lf, %lf, %lu, '%s')", + asprintf(&query2, "INSERT INTO %s (instance_id, host_object_id, status_update_time, output, long_output, perfdata, current_state, has_been_checked, should_be_scheduled, current_check_attempt, max_check_attempts, last_check, next_check, check_type, last_state_change, last_hard_state_change, last_hard_state, last_time_up, last_time_down, last_time_unreachable, state_type, last_notification, next_notification, no_more_notifications, notifications_enabled, problem_has_been_acknowledged, acknowledgement_type, current_notification_number, passive_checks_enabled, active_checks_enabled, event_handler_enabled, flap_detection_enabled, is_flapping, 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) VALUES (%lu, %lu, %s, '%s', '%s', '%s', %d, %d, %d, %d, %d, %s, %s, %d, %s, %s, %d, %s, %s, %s, %d, %s, %s, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d, %lf, %lf, %lf, %d, %d, %d, %d, %lu, '%s', '%s', %lf, %lf, %lu)", ido2db_db_tablenames[IDO2DB_DBTABLE_HOSTSTATUS], *(unsigned long *) data[0], /* insert start */ *(unsigned long *) data[1], @@ -3558,8 +3557,7 @@ int ido2db_query_insert_or_update_hoststatusdata_add(ido2db_idi *idi, void **dat *(char **) data[42], *(double *) data[43], *(double *) data[44], - *(unsigned long *) data[45], - *(char **) data[56] /* insert end */ + *(unsigned long *) data[45] /* insert end */ ); /* send query to db */ result = ido2db_db_query(idi, query2); @@ -3573,7 +3571,7 @@ int ido2db_query_insert_or_update_hoststatusdata_add(ido2db_idi *idi, void **dat case IDO2DB_DBSERVER_PGSQL: - asprintf(&query1, "UPDATE %s SET instance_id=%lu, host_object_id=%lu, status_update_time=%s, output=E'%s', long_output=E'%s', perfdata=E'%s', current_state=%d, has_been_checked=%d, should_be_scheduled=%d, current_check_attempt=%d, max_check_attempts=%d, last_check=%s, next_check=%s, check_type=%d, last_state_change=%s, last_hard_state_change=%s, last_hard_state=%d, last_time_up=%s, last_time_down=%s, last_time_unreachable=%s, state_type=%d, last_notification=%s, next_notification=%s, no_more_notifications=%d, notifications_enabled=%d, problem_has_been_acknowledged=%d, acknowledgement_type=%d, current_notification_number=%d, passive_checks_enabled=%d, active_checks_enabled=%d, event_handler_enabled=%d, flap_detection_enabled=%d, is_flapping=%d, percent_state_change='%lf', latency='%lf', execution_time='%lf', scheduled_downtime_depth=%d, failure_prediction_enabled=%d, process_performance_data=%d, obsess_over_host=%d, modified_host_attributes=%lu, event_handler=E'%s', check_command=E'%s', normal_check_interval='%lf', retry_check_interval='%lf', check_timeperiod_object_id=%lu, check_source=E'%s' WHERE host_object_id=%lu", + asprintf(&query1, "UPDATE %s SET instance_id=%lu, host_object_id=%lu, status_update_time=%s, output=E'%s', long_output=E'%s', perfdata=E'%s', current_state=%d, has_been_checked=%d, should_be_scheduled=%d, current_check_attempt=%d, max_check_attempts=%d, last_check=%s, next_check=%s, check_type=%d, last_state_change=%s, last_hard_state_change=%s, last_hard_state=%d, last_time_up=%s, last_time_down=%s, last_time_unreachable=%s, state_type=%d, last_notification=%s, next_notification=%s, no_more_notifications=%d, notifications_enabled=%d, problem_has_been_acknowledged=%d, acknowledgement_type=%d, current_notification_number=%d, passive_checks_enabled=%d, active_checks_enabled=%d, event_handler_enabled=%d, flap_detection_enabled=%d, is_flapping=%d, percent_state_change='%lf', latency='%lf', execution_time='%lf', scheduled_downtime_depth=%d, failure_prediction_enabled=%d, process_performance_data=%d, obsess_over_host=%d, modified_host_attributes=%lu, event_handler=E'%s', check_command=E'%s', normal_check_interval='%lf', retry_check_interval='%lf', check_timeperiod_object_id=%lu WHERE host_object_id=%lu", ido2db_db_tablenames[IDO2DB_DBTABLE_HOSTSTATUS], *(unsigned long *) data[0], /* update start */ *(unsigned long *) data[1], @@ -3620,8 +3618,7 @@ int ido2db_query_insert_or_update_hoststatusdata_add(ido2db_idi *idi, void **dat *(char **) data[42], *(double *) data[43], *(double *) data[44], - *(unsigned long *) data[45], - *(char **) data[56], /* update end */ + *(unsigned long *) data[45], /* update end */ *(unsigned long *) data[1] /* unique constraint start/end */ ); /* send query to db */ @@ -3634,7 +3631,7 @@ int ido2db_query_insert_or_update_hoststatusdata_add(ido2db_idi *idi, void **dat idi->dbinfo.dbi_result = NULL; /* try insert instead */ - asprintf(&query2, "INSERT INTO %s (instance_id, host_object_id, status_update_time, output, long_output, perfdata, current_state, has_been_checked, should_be_scheduled, current_check_attempt, max_check_attempts, last_check, next_check, check_type, last_state_change, last_hard_state_change, last_hard_state, last_time_up, last_time_down, last_time_unreachable, state_type, last_notification, next_notification, no_more_notifications, notifications_enabled, problem_has_been_acknowledged, acknowledgement_type, current_notification_number, passive_checks_enabled, active_checks_enabled, event_handler_enabled, flap_detection_enabled, is_flapping, 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, check_source) VALUES (%lu, %lu, %s, E'%s', E'%s', E'%s', %d, %d, %d, %d, %d, %s, %s, %d, %s, %s, %d, %s, %s, %s, %d, %s, %s, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d, %lf, %lf, %lf, %d, %d, %d, %d, %lu, E'%s', E'%s', %lf, %lf, %lu, E'%s')", + asprintf(&query2, "INSERT INTO %s (instance_id, host_object_id, status_update_time, output, long_output, perfdata, current_state, has_been_checked, should_be_scheduled, current_check_attempt, max_check_attempts, last_check, next_check, check_type, last_state_change, last_hard_state_change, last_hard_state, last_time_up, last_time_down, last_time_unreachable, state_type, last_notification, next_notification, no_more_notifications, notifications_enabled, problem_has_been_acknowledged, acknowledgement_type, current_notification_number, passive_checks_enabled, active_checks_enabled, event_handler_enabled, flap_detection_enabled, is_flapping, 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) VALUES (%lu, %lu, %s, E'%s', E'%s', E'%s', %d, %d, %d, %d, %d, %s, %s, %d, %s, %s, %d, %s, %s, %s, %d, %s, %s, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d, %lf, %lf, %lf, %d, %d, %d, %d, %lu, E'%s', E'%s', %lf, %lf, %lu)", ido2db_db_tablenames[IDO2DB_DBTABLE_HOSTSTATUS], *(unsigned long *) data[0], /* insert start */ *(unsigned long *) data[1], @@ -3681,8 +3678,7 @@ int ido2db_query_insert_or_update_hoststatusdata_add(ido2db_idi *idi, void **dat *(char **) data[42], *(double *) data[43], *(double *) data[44], - *(unsigned long *) data[45], - *(char **) data[56] /* insert end */ + *(unsigned long *) data[45] /* insert end */ ); /* send query to db */ result = ido2db_db_query(idi, query2); @@ -3850,15 +3846,6 @@ int ido2db_query_insert_or_update_hoststatusdata_add(ido2db_idi *idi, void **dat if (!OCI_BindUnsignedInt(idi->dbinfo.oci_statement_hoststatus, MT(":X46"), (uint *) data[45])) { return IDO_ERROR; } - if (*(char **) data[56] == NULL) { - if (ido2db_oci_prepared_statement_bind_null_param(idi->dbinfo.oci_statement_hoststatus, ":X47") == IDO_ERROR) { - return IDO_ERROR; - } - } else { - if (!OCI_BindString(idi->dbinfo.oci_statement_hoststatus, MT(":X47"), *(char **) data[56], 0)) { - return IDO_ERROR; - } - } //bind clob 2 times,once for update, once for insert to make oracle happy and avoid ora-600 because of double binding ido2db_log_debug_info(IDO2DB_DEBUGL_PROCESSINFO, 2, "ido2db_query_insert_or_update_hoststatus() bind clob\n"); lob_oi = OCI_LobCreate(idi->dbinfo.oci_connection, OCI_CLOB); @@ -3957,7 +3944,7 @@ int ido2db_query_insert_or_update_servicestatusdata_add(ido2db_idi *idi, void ** } } } - asprintf(&query1, "UPDATE %s SET instance_id=%lu, service_object_id=%lu, status_update_time=%s, output='%s', long_output='%s', perfdata='%s', current_state=%d, has_been_checked=%d, should_be_scheduled=%d, current_check_attempt=%d, max_check_attempts=%d, last_check=%s, next_check=%s, check_type=%d, last_state_change=%s, last_hard_state_change=%s, last_hard_state=%d, last_time_ok=%s, last_time_warning=%s, last_time_unknown=%s, last_time_critical=%s, state_type=%d, last_notification=%s, next_notification=%s, no_more_notifications=%d, notifications_enabled=%d, problem_has_been_acknowledged=%d, acknowledgement_type=%d, current_notification_number=%d, passive_checks_enabled=%d, active_checks_enabled=%d, event_handler_enabled=%d, flap_detection_enabled=%d, is_flapping=%d, percent_state_change='%lf', latency='%lf', execution_time='%lf', scheduled_downtime_depth=%d, failure_prediction_enabled=%d, process_performance_data=%d, obsess_over_service=%d, modified_service_attributes=%lu, event_handler='%s', check_command='%s', normal_check_interval='%lf', retry_check_interval='%lf', check_timeperiod_object_id=%lu, check_source='%s' WHERE service_object_id=%lu", + asprintf(&query1, "UPDATE %s SET instance_id=%lu, service_object_id=%lu, status_update_time=%s, output='%s', long_output='%s', perfdata='%s', current_state=%d, has_been_checked=%d, should_be_scheduled=%d, current_check_attempt=%d, max_check_attempts=%d, last_check=%s, next_check=%s, check_type=%d, last_state_change=%s, last_hard_state_change=%s, last_hard_state=%d, last_time_ok=%s, last_time_warning=%s, last_time_unknown=%s, last_time_critical=%s, state_type=%d, last_notification=%s, next_notification=%s, no_more_notifications=%d, notifications_enabled=%d, problem_has_been_acknowledged=%d, acknowledgement_type=%d, current_notification_number=%d, passive_checks_enabled=%d, active_checks_enabled=%d, event_handler_enabled=%d, flap_detection_enabled=%d, is_flapping=%d, percent_state_change='%lf', latency='%lf', execution_time='%lf', scheduled_downtime_depth=%d, failure_prediction_enabled=%d, process_performance_data=%d, obsess_over_service=%d, modified_service_attributes=%lu, event_handler='%s', check_command='%s', normal_check_interval='%lf', retry_check_interval='%lf', check_timeperiod_object_id=%lu WHERE service_object_id=%lu", ido2db_db_tablenames[IDO2DB_DBTABLE_SERVICESTATUS], *(unsigned long *) data[0], /* update start */ *(unsigned long *) data[1], @@ -4005,8 +3992,7 @@ int ido2db_query_insert_or_update_servicestatusdata_add(ido2db_idi *idi, void ** *(char **) data[43], *(double *) data[44], *(double *) data[45], - *(unsigned long *) data[46], - *(char **) data[58], /* update end */ + *(unsigned long *) data[46], /* update end */ *(unsigned long *) data[1] /* unique constraint start/end */ ); @@ -4049,7 +4035,7 @@ int ido2db_query_insert_or_update_servicestatusdata_add(ido2db_idi *idi, void ** if (mysql_update == FALSE) { /* try insert instead */ - asprintf(&query2, "INSERT INTO %s (instance_id, service_object_id, status_update_time, output, long_output, perfdata, current_state, has_been_checked, should_be_scheduled, current_check_attempt, max_check_attempts, last_check, next_check, check_type, last_state_change, last_hard_state_change, last_hard_state, last_time_ok, last_time_warning, last_time_unknown, last_time_critical, state_type, last_notification, next_notification, no_more_notifications, notifications_enabled, problem_has_been_acknowledged, acknowledgement_type, current_notification_number, passive_checks_enabled, active_checks_enabled, event_handler_enabled, flap_detection_enabled, is_flapping, 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, check_source) VALUES (%lu, %lu, %s, '%s', '%s', '%s', %d, %d, %d, %d, %d, %s, %s, %d, %s, %s, %d, %s, %s, %s, %s, %d, %s, %s, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d, '%lf', '%lf', '%lf', %d, %d, %d, %d, %lu, '%s', '%s', '%lf', '%lf', %lu, '%s')", + asprintf(&query2, "INSERT INTO %s (instance_id, service_object_id, status_update_time, output, long_output, perfdata, current_state, has_been_checked, should_be_scheduled, current_check_attempt, max_check_attempts, last_check, next_check, check_type, last_state_change, last_hard_state_change, last_hard_state, last_time_ok, last_time_warning, last_time_unknown, last_time_critical, state_type, last_notification, next_notification, no_more_notifications, notifications_enabled, problem_has_been_acknowledged, acknowledgement_type, current_notification_number, passive_checks_enabled, active_checks_enabled, event_handler_enabled, flap_detection_enabled, is_flapping, 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) VALUES (%lu, %lu, %s, '%s', '%s', '%s', %d, %d, %d, %d, %d, %s, %s, %d, %s, %s, %d, %s, %s, %s, %s, %d, %s, %s, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d, '%lf', '%lf', '%lf', %d, %d, %d, %d, %lu, '%s', '%s', '%lf', '%lf', %lu)", ido2db_db_tablenames[IDO2DB_DBTABLE_SERVICESTATUS], *(unsigned long *) data[0], /* insert start */ *(unsigned long *) data[1], @@ -4097,8 +4083,7 @@ int ido2db_query_insert_or_update_servicestatusdata_add(ido2db_idi *idi, void ** *(char **) data[43], *(double *) data[44], *(double *) data[45], - *(unsigned long *) data[46], - *(char **) data[58] /* insert end */ + *(unsigned long *) data[46] /* insert end */ ); /* send query to db */ result = ido2db_db_query(idi, query2); @@ -4111,7 +4096,7 @@ int ido2db_query_insert_or_update_servicestatusdata_add(ido2db_idi *idi, void ** break; case IDO2DB_DBSERVER_PGSQL: - asprintf(&query1, "UPDATE %s SET instance_id=%lu, service_object_id=%lu, status_update_time=%s, output=E'%s', long_output=E'%s', perfdata=E'%s', current_state=%d, has_been_checked=%d, should_be_scheduled=%d, current_check_attempt=%d, max_check_attempts=%d, last_check=%s, next_check=%s, check_type=%d, last_state_change=%s, last_hard_state_change=%s, last_hard_state=%d, last_time_ok=%s, last_time_warning=%s, last_time_unknown=%s, last_time_critical=%s, state_type=%d, last_notification=%s, next_notification=%s, no_more_notifications=%d, notifications_enabled=%d, problem_has_been_acknowledged=%d, acknowledgement_type=%d, current_notification_number=%d, passive_checks_enabled=%d, active_checks_enabled=%d, event_handler_enabled=%d, flap_detection_enabled=%d, is_flapping=%d, percent_state_change='%lf', latency='%lf', execution_time='%lf', scheduled_downtime_depth=%d, failure_prediction_enabled=%d, process_performance_data=%d, obsess_over_service=%d, modified_service_attributes=%lu, event_handler=E'%s', check_command=E'%s', normal_check_interval='%lf', retry_check_interval='%lf', check_timeperiod_object_id=%lu, check_source=E'%s' WHERE service_object_id=%lu", + asprintf(&query1, "UPDATE %s SET instance_id=%lu, service_object_id=%lu, status_update_time=%s, output=E'%s', long_output=E'%s', perfdata=E'%s', current_state=%d, has_been_checked=%d, should_be_scheduled=%d, current_check_attempt=%d, max_check_attempts=%d, last_check=%s, next_check=%s, check_type=%d, last_state_change=%s, last_hard_state_change=%s, last_hard_state=%d, last_time_ok=%s, last_time_warning=%s, last_time_unknown=%s, last_time_critical=%s, state_type=%d, last_notification=%s, next_notification=%s, no_more_notifications=%d, notifications_enabled=%d, problem_has_been_acknowledged=%d, acknowledgement_type=%d, current_notification_number=%d, passive_checks_enabled=%d, active_checks_enabled=%d, event_handler_enabled=%d, flap_detection_enabled=%d, is_flapping=%d, percent_state_change='%lf', latency='%lf', execution_time='%lf', scheduled_downtime_depth=%d, failure_prediction_enabled=%d, process_performance_data=%d, obsess_over_service=%d, modified_service_attributes=%lu, event_handler=E'%s', check_command=E'%s', normal_check_interval='%lf', retry_check_interval='%lf', check_timeperiod_object_id=%lu WHERE service_object_id=%lu", ido2db_db_tablenames[IDO2DB_DBTABLE_SERVICESTATUS], *(unsigned long *) data[0], /* update start */ *(unsigned long *) data[1], @@ -4159,8 +4144,7 @@ int ido2db_query_insert_or_update_servicestatusdata_add(ido2db_idi *idi, void ** *(char **) data[43], *(double *) data[44], *(double *) data[45], - *(unsigned long *) data[46], - *(char **) data[58], /* update end */ + *(unsigned long *) data[46], /* update end */ *(unsigned long *) data[1] /* unique constraint start/end */ ); @@ -4174,7 +4158,7 @@ int ido2db_query_insert_or_update_servicestatusdata_add(ido2db_idi *idi, void ** idi->dbinfo.dbi_result = NULL; /* try insert instead */ - asprintf(&query2, "INSERT INTO %s (instance_id, service_object_id, status_update_time, output, long_output, perfdata, current_state, has_been_checked, should_be_scheduled, current_check_attempt, max_check_attempts, last_check, next_check, check_type, last_state_change, last_hard_state_change, last_hard_state, last_time_ok, last_time_warning, last_time_unknown, last_time_critical, state_type, last_notification, next_notification, no_more_notifications, notifications_enabled, problem_has_been_acknowledged, acknowledgement_type, current_notification_number, passive_checks_enabled, active_checks_enabled, event_handler_enabled, flap_detection_enabled, is_flapping, 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, check_source) VALUES (%lu, %lu, %s, E'%s', E'%s', E'%s', %d, %d, %d, %d, %d, %s, %s, %d, %s, %s, %d, %s, %s, %s, %s, %d, %s, %s, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d, '%lf', '%lf', '%lf', %d, %d, %d, %d, %lu, E'%s', E'%s', '%lf', '%lf', %lu, E'%s')", + asprintf(&query2, "INSERT INTO %s (instance_id, service_object_id, status_update_time, output, long_output, perfdata, current_state, has_been_checked, should_be_scheduled, current_check_attempt, max_check_attempts, last_check, next_check, check_type, last_state_change, last_hard_state_change, last_hard_state, last_time_ok, last_time_warning, last_time_unknown, last_time_critical, state_type, last_notification, next_notification, no_more_notifications, notifications_enabled, problem_has_been_acknowledged, acknowledgement_type, current_notification_number, passive_checks_enabled, active_checks_enabled, event_handler_enabled, flap_detection_enabled, is_flapping, 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) VALUES (%lu, %lu, %s, E'%s', E'%s', E'%s', %d, %d, %d, %d, %d, %s, %s, %d, %s, %s, %d, %s, %s, %s, %s, %d, %s, %s, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d, '%lf', '%lf', '%lf', %d, %d, %d, %d, %lu, E'%s', E'%s', '%lf', '%lf', %lu)", ido2db_db_tablenames[IDO2DB_DBTABLE_SERVICESTATUS], *(unsigned long *) data[0], /* insert start */ *(unsigned long *) data[1], @@ -4222,8 +4206,7 @@ int ido2db_query_insert_or_update_servicestatusdata_add(ido2db_idi *idi, void ** *(char **) data[43], *(double *) data[44], *(double *) data[45], - *(unsigned long *) data[46], - *(char **) data[58] /* insert end */ + *(unsigned long *) data[46] /* insert end */ ); /* send query to db */ result = ido2db_db_query(idi, query2); @@ -4394,15 +4377,6 @@ int ido2db_query_insert_or_update_servicestatusdata_add(ido2db_idi *idi, void ** if (!OCI_BindUnsignedInt(idi->dbinfo.oci_statement_servicestatus, MT(":X47"), (uint *) data[46])) { return IDO_ERROR; } - if (*(char **) data[58] == NULL) { - if (ido2db_oci_prepared_statement_bind_null_param(idi->dbinfo.oci_statement_servicestatus, ":X48") == IDO_ERROR) { - return IDO_ERROR; - } - } else { - if (!OCI_BindString(idi->dbinfo.oci_statement_servicestatus, MT(":X48"), *(char **) data[58], 0)) { - return IDO_ERROR; - } - } //bind clob 2 times,once for update, once for insert to make oracle happy and avoid ora-600 because of double binding lob_oi = OCI_LobCreate(idi->dbinfo.oci_connection, OCI_CLOB); lob_ou = OCI_LobCreate(idi->dbinfo.oci_connection, OCI_CLOB); diff --git a/module/idoutils/src/ido2db.c b/module/idoutils/src/ido2db.c index 5128b63..220f40e 100644 --- a/module/idoutils/src/ido2db.c +++ b/module/idoutils/src/ido2db.c @@ -2250,8 +2250,6 @@ int ido2db_add_input_data_item(ido2db_idi *idi, int type, char *buf) { case IDO_DATA_CUSTOMVARIABLE: case IDO_DATA_CONTACT: - case IDO_DATA_CHECKSOURCE: - /* strings are escaped when they arrive */ if (buf == NULL) newbuf = strdup(""); diff --git a/module/idoutils/src/idomod.c b/module/idoutils/src/idomod.c index 17cbbef..230cf22 100644 --- a/module/idoutils/src/idomod.c +++ b/module/idoutils/src/idomod.c @@ -2098,7 +2098,6 @@ int idomod_broker_data(int event_type, void *data) { es[4] = ido_escape_buffer(temp_host->event_handler); es[5] = ido_escape_buffer(temp_host->host_check_command); es[6] = ido_escape_buffer(temp_host->check_period); - es[7] = ido_escape_buffer(temp_host->check_source); if(es[2] != NULL) { if(strlen(es[2]) > IDOMOD_MAX_TEXT_LEN) { @@ -2115,7 +2114,7 @@ int idomod_broker_data(int event_type, void *data) { retry_interval = temp_host->retry_interval; snprintf(temp_buffer, IDOMOD_MAX_BUFLEN - 1 - , "\n%d:\n%d=%d\n%d=%d\n%d=%d\n%d=%ld.%ld\n%d=%s\n%d=%s\n%d=%s\n%d=%s\n%d=%d\n%d=%d\n%d=%d\n%d=%d\n%d=%d\n%d=%lu\n%d=%lu\n%d=%d\n%d=%lu\n%d=%lu\n%d=%d\n%d=%lu\n%d=%lu\n%d=%lu\n%d=%d\n%d=%lu\n%d=%lu\n%d=%d\n%d=%d\n%d=%d\n%d=%d\n%d=%d\n%d=%d\n%d=%d\n%d=%d\n%d=%d\n%d=%d\n%d=%.5lf\n%d=%.5lf\n%d=%.5lf\n%d=%d\n%d=%d\n%d=%d\n%d=%d\n%d=%lu\n%d=%s\n%d=%s\n%d=%lf\n%d=%lf\n%d=%s\n%d=%s\n" + , "\n%d:\n%d=%d\n%d=%d\n%d=%d\n%d=%ld.%ld\n%d=%s\n%d=%s\n%d=%s\n%d=%s\n%d=%d\n%d=%d\n%d=%d\n%d=%d\n%d=%d\n%d=%lu\n%d=%lu\n%d=%d\n%d=%lu\n%d=%lu\n%d=%d\n%d=%lu\n%d=%lu\n%d=%lu\n%d=%d\n%d=%lu\n%d=%lu\n%d=%d\n%d=%d\n%d=%d\n%d=%d\n%d=%d\n%d=%d\n%d=%d\n%d=%d\n%d=%d\n%d=%d\n%d=%.5lf\n%d=%.5lf\n%d=%.5lf\n%d=%d\n%d=%d\n%d=%d\n%d=%d\n%d=%lu\n%d=%s\n%d=%s\n%d=%lf\n%d=%lf\n%d=%s\n" , IDO_API_HOSTSTATUSDATA , IDO_DATA_TYPE , hsdata->type @@ -2215,8 +2214,6 @@ int idomod_broker_data(int event_type, void *data) { , (double)retry_interval , IDO_DATA_HOSTCHECKPERIOD , (es[6] == NULL) ? "" : es[6] - , IDO_DATA_CHECKSOURCE - , (es[7] == NULL) ? "" : es[7] ); temp_buffer[IDOMOD_MAX_BUFLEN-1] = '\x0'; @@ -2274,7 +2271,6 @@ int idomod_broker_data(int event_type, void *data) { es[5] = ido_escape_buffer(temp_service->event_handler); es[6] = ido_escape_buffer(temp_service->service_check_command); es[7] = ido_escape_buffer(temp_service->check_period); - es[8] = ido_escape_buffer(temp_service->check_source); if(es[3] != NULL) { if(strlen(es[3]) > IDOMOD_MAX_TEXT_LEN) { @@ -2289,7 +2285,7 @@ int idomod_broker_data(int event_type, void *data) { } snprintf(temp_buffer, IDOMOD_MAX_BUFLEN - 1 - , "\n%d:\n%d=%d\n%d=%d\n%d=%d\n%d=%ld.%ld\n%d=%s\n%d=%s\n%d=%s\n%d=%s\n%d=%s\n%d=%d\n%d=%d\n%d=%d\n%d=%d\n%d=%d\n%d=%lu\n%d=%lu\n%d=%d\n%d=%lu\n%d=%lu\n%d=%d\n%d=%lu\n%d=%lu\n%d=%lu\n%d=%lu\n%d=%d\n%d=%lu\n%d=%lu\n%d=%d\n%d=%d\n%d=%d\n%d=%d\n%d=%d\n%d=%d\n%d=%d\n%d=%d\n%d=%d\n%d=%d\n%d=%.5lf\n%d=%.5lf\n%d=%.5lf\n%d=%d\n%d=%d\n%d=%d\n%d=%d\n%d=%lu\n%d=%s\n%d=%s\n%d=%lf\n%d=%lf\n%d=%s\n%d=%s\n" + , "\n%d:\n%d=%d\n%d=%d\n%d=%d\n%d=%ld.%ld\n%d=%s\n%d=%s\n%d=%s\n%d=%s\n%d=%s\n%d=%d\n%d=%d\n%d=%d\n%d=%d\n%d=%d\n%d=%lu\n%d=%lu\n%d=%d\n%d=%lu\n%d=%lu\n%d=%d\n%d=%lu\n%d=%lu\n%d=%lu\n%d=%lu\n%d=%d\n%d=%lu\n%d=%lu\n%d=%d\n%d=%d\n%d=%d\n%d=%d\n%d=%d\n%d=%d\n%d=%d\n%d=%d\n%d=%d\n%d=%d\n%d=%.5lf\n%d=%.5lf\n%d=%.5lf\n%d=%d\n%d=%d\n%d=%d\n%d=%d\n%d=%lu\n%d=%s\n%d=%s\n%d=%lf\n%d=%lf\n%d=%s\n" , IDO_API_SERVICESTATUSDATA , IDO_DATA_TYPE , ssdata->type @@ -2393,8 +2389,6 @@ int idomod_broker_data(int event_type, void *data) { , (double)temp_service->retry_interval , IDO_DATA_SERVICECHECKPERIOD , (es[7] == NULL) ? "" : es[7] - , IDO_DATA_CHECKSOURCE - , (es[8] == NULL) ? "" : es[8] ); temp_buffer[IDOMOD_MAX_BUFLEN-1] = '\x0'; diff --git a/xdata/xsddefault.c b/xdata/xsddefault.c index 5d1c32d..90edc4d 100644 --- a/xdata/xsddefault.c +++ b/xdata/xsddefault.c @@ -444,7 +444,6 @@ int xsddefault_save_status_data(void) { fprintf(fp, "\tplugin_output=%s\n", (temp_host->plugin_output == NULL) ? "" : temp_host->plugin_output); fprintf(fp, "\tlong_plugin_output=%s\n", (temp_host->long_plugin_output == NULL) ? "" : temp_host->long_plugin_output); fprintf(fp, "\tperformance_data=%s\n", (temp_host->perf_data == NULL) ? "" : temp_host->perf_data); - fprintf(fp, "\tcheck_source=%s\n", (temp_host->check_source == NULL) ? "" : temp_host->check_source); fprintf(fp, "\tlast_check=%lu\n", temp_host->last_check); fprintf(fp, "\tnext_check=%lu\n", temp_host->next_check); fprintf(fp, "\tcheck_options=%d\n", temp_host->check_options); @@ -532,7 +531,6 @@ int xsddefault_save_status_data(void) { fprintf(fp, "\tplugin_output=%s\n", (temp_service->plugin_output == NULL) ? "" : temp_service->plugin_output); fprintf(fp, "\tlong_plugin_output=%s\n", (temp_service->long_plugin_output == NULL) ? "" : temp_service->long_plugin_output); fprintf(fp, "\tperformance_data=%s\n", (temp_service->perf_data == NULL) ? "" : temp_service->perf_data); - fprintf(fp, "\tcheck_source=%s\n", (temp_service->check_source == NULL) ? "" : temp_service->check_source); fprintf(fp, "\tlast_check=%lu\n", temp_service->last_check); fprintf(fp, "\tnext_check=%lu\n", temp_service->next_check); fprintf(fp, "\tcheck_options=%d\n", temp_service->check_options);