Title: [opsview-base] [320] Minor changes to patches for readability
Revision
320
Author
tvoon
Date
2013-08-05 23:44:09 +0100 (Mon, 05 Aug 2013)

Log Message

Minor changes to patches for readability

Modified Paths


Modified: trunk/patches/nagios_passive_host_svc_checks_and_host_svc_event_handlers.patch
===================================================================
--- trunk/patches/nagios_passive_host_svc_checks_and_host_svc_event_handlers.patch	2013-07-25 07:58:50 UTC (rev 319)
+++ trunk/patches/nagios_passive_host_svc_checks_and_host_svc_event_handlers.patch	2013-08-05 22:44:09 UTC (rev 320)
@@ -81,8 +81,6 @@
  		case CMD_START_OBSESSING_OVER_HOST:
  			start_obsessing_over_host(temp_host);
  			break;
-Binary files nagios-4.0.20130107.original//base/commands.o and nagios-4.0.20130107/base/commands.o differ
-Binary files nagios-4.0.20130107.original//base/nagios and nagios-4.0.20130107/base/nagios differ
 diff -ur nagios-4.0.20130107.original//include/common.h nagios-4.0.20130107/include/common.h
 --- nagios-4.0.20130107.original//include/common.h	2013-06-11 12:13:32.000000000 +0000
 +++ nagios-4.0.20130107/include/common.h	2013-06-11 12:42:20.000000000 +0000
@@ -100,4 +98,3 @@
  /* custom command introduced in Nagios 3.x */
  #define CMD_CUSTOM_COMMAND                              999
  
-Only in nagios-4.0.20130107/include: .common.h.swp

Modified: trunk/patches/nagios_sync_retention_file.patch
===================================================================
--- trunk/patches/nagios_sync_retention_file.patch	2013-07-25 07:58:50 UTC (rev 319)
+++ trunk/patches/nagios_sync_retention_file.patch	2013-08-05 22:44:09 UTC (rev 320)
@@ -1,6 +1,6 @@
-diff -ur -x Makefile -x config.log -x config.status -x libtool nagios-4.0.20121116.orig_with_new_patches/base/commands.c nagios-4.0.20121116/base/commands.c
---- nagios-4.0.20121116.orig_with_new_patches/base/commands.c	2012-11-20 10:54:19.000000000 +0000
-+++ nagios-4.0.20121116/base/commands.c	2012-11-20 12:52:34.000000000 +0000
+diff -wur nagios-4.0.20130107.original/base/commands.c nagios-4.0.20130107/base/commands.c
+--- nagios-4.0.20130107.original/base/commands.c	2012-12-24 15:29:58.000000000 +0000
++++ nagios-4.0.20130107/base/commands.c	2013-06-25 01:25:25.000000000 +0000
 @@ -411,6 +411,8 @@
  		command_type = CMD_SAVE_STATE_INFORMATION;
  	else if(!strcmp(command_id, "READ_STATE_INFORMATION"))
@@ -21,10 +21,10 @@
  		case CMD_ENABLE_NOTIFICATIONS:
  			enable_all_notifications();
  			break;
-diff -ur -x Makefile -x config.log -x config.status -x libtool nagios-4.0.20121116.orig_with_new_patches/base/config.c nagios-4.0.20121116/base/config.c
---- nagios-4.0.20121116.orig_with_new_patches/base/config.c	2012-11-20 10:54:19.000000000 +0000
-+++ nagios-4.0.20121116/base/config.c	2012-11-20 12:52:34.000000000 +0000
-@@ -1133,6 +1133,8 @@
+diff -wur nagios-4.0.20130107.original/base/config.c nagios-4.0.20130107/base/config.c
+--- nagios-4.0.20130107.original/base/config.c	2013-06-25 01:24:57.000000000 +0000
++++ nagios-4.0.20130107/base/config.c	2013-06-25 01:25:25.000000000 +0000
+@@ -1151,6 +1151,8 @@
  			continue;
  		else if(strstr(input, "state_retention_file=") == input)
  			continue;
@@ -33,10 +33,10 @@
  		else if(strstr(input, "object_cache_file=") == input) {
  			my_free(object_cache_file);
  			object_cache_file = nspath_absolute(value, config_file_dir);
-diff -ur -x Makefile -x config.log -x config.status -x libtool nagios-4.0.20121116.orig_with_new_patches/base/nagios.c nagios-4.0.20121116/base/nagios.c
---- nagios-4.0.20121116.orig_with_new_patches/base/nagios.c	2012-11-20 10:54:19.000000000 +0000
-+++ nagios-4.0.20121116/base/nagios.c	2012-11-20 12:52:34.000000000 +0000
-@@ -623,6 +623,8 @@
+diff -wur nagios-4.0.20130107.original/base/nagios.c nagios-4.0.20130107/base/nagios.c
+--- nagios-4.0.20130107.original/base/nagios.c	2012-12-24 15:29:58.000000000 +0000
++++ nagios-4.0.20130107/base/nagios.c	2013-06-25 01:25:25.000000000 +0000
+@@ -625,6 +625,8 @@
  			timing_point("Retention data initialized\n");
  			read_initial_state_information();
  			timing_point("Initial state information read\n");
@@ -45,9 +45,9 @@
  
  			/* initialize comment data */
  			initialize_comment_data(config_file);
-diff -ur -x Makefile -x config.log -x config.status -x libtool nagios-4.0.20121116.orig_with_new_patches/base/sretention.c nagios-4.0.20121116/base/sretention.c
---- nagios-4.0.20121116.orig_with_new_patches/base/sretention.c	2012-11-20 10:54:19.000000000 +0000
-+++ nagios-4.0.20121116/base/sretention.c	2012-11-20 12:52:34.000000000 +0000
+diff -wur nagios-4.0.20130107.original/base/sretention.c nagios-4.0.20130107/base/sretention.c
+--- nagios-4.0.20130107.original/base/sretention.c	2012-12-24 15:29:58.000000000 +0000
++++ nagios-4.0.20130107/base/sretention.c	2013-06-25 01:25:25.000000000 +0000
 @@ -136,5 +136,21 @@
  	return OK;
  	}
@@ -59,7 +59,7 @@
  
 +	if(retain_state_information == FALSE)
 +		return OK;
- 
++
 +/********* IMPLEMENTATION-SPECIFIC INPUT FUNCTION ********/
 +#ifdef USE_XRDDEFAULT
 +	result = xrddefault_sync_state_information();
@@ -67,12 +67,12 @@
 +
 +	if(result == ERROR)
 +		return ERROR;
-+
+ 
 +	return OK;
 +	}
-diff -ur -x Makefile -x config.log -x config.status -x libtool nagios-4.0.20121116.orig_with_new_patches/common/comments.c nagios-4.0.20121116/common/comments.c
---- nagios-4.0.20121116.orig_with_new_patches/common/comments.c	2012-11-20 10:54:19.000000000 +0000
-+++ nagios-4.0.20121116/common/comments.c	2012-11-20 12:52:34.000000000 +0000
+diff -wur nagios-4.0.20130107.original/common/comments.c nagios-4.0.20130107/common/comments.c
+--- nagios-4.0.20130107.original/common/comments.c	2012-12-24 15:29:43.000000000 +0000
++++ nagios-4.0.20130107/common/comments.c	2013-06-25 01:25:25.000000000 +0000
 @@ -681,14 +681,26 @@
  	comment *temp_comment = NULL;
  
@@ -87,14 +87,13 @@
  	return NULL;
  	}
  
--
--
--
--
 +/* find a comment by comment_type, host_name, service_desc (NULL if hostcomment), entry_time, author, comment_data */
 +comment *find_comment_by_similar_content(int comment_type, char *hostname, char *service_description, char *author, char *comment_data) {
 +    comment *temp_comment = NULL;
-+
+ 
+-
+-
+-
 +    for(temp_comment=comment_list; temp_comment != NULL; temp_comment=temp_comment->next) {
 +        if(temp_comment->comment_type==comment_type
 +            && strcmp(temp_comment->host_name,hostname) == 0
@@ -105,201 +104,9 @@
 +            }
 +    return NULL;
 +    }
-diff -ur -x Makefile -x config.log -x config.status -x libtool nagios-4.0.20121116.orig_with_new_patches/common/downtime.c nagios-4.0.20121116/common/downtime.c
---- nagios-4.0.20121116.orig_with_new_patches/common/downtime.c	2012-11-20 10:54:19.000000000 +0000
-+++ nagios-4.0.20121116/common/downtime.c	2012-11-20 12:55:52.000000000 +0000
-@@ -246,7 +246,7 @@
- 	unsigned long *new_downtime_id = NULL;
- 	int was_in_effect = FALSE;
- 
--	log_debug_info(DEBUGL_FUNCTIONS, 0, "register_downtime( %d, %lu)\n", type, 
-+	log_debug_info(DEBUGL_FUNCTIONS, 0, "register_downtime( %d, %lu)\n", type,
- 			downtime_id);
- 
- 	/* find the downtime entry in memory */
-@@ -259,17 +259,17 @@
- 	/* find the host or service associated with this downtime */
- 	if(temp_downtime->type == HOST_DOWNTIME) {
- 		if((hst = find_host(temp_downtime->host_name)) == NULL) {
--			log_debug_info(DEBUGL_DOWNTIME, 1, 
--					"Cannot find host (%s) for downtime ID: %lu\n", 
-+			log_debug_info(DEBUGL_DOWNTIME, 1,
-+					"Cannot find host (%s) for downtime ID: %lu\n",
- 					temp_downtime->host_name, downtime_id);
- 			return ERROR;
- 			}
- 		}
- 	else {
- 		if((svc = find_service(temp_downtime->host_name, temp_downtime->service_description)) == NULL) {
--			log_debug_info(DEBUGL_DOWNTIME, 1, 
--					"Cannot find service (%s) for host (%s) for downtime ID: %lu\n", 
--					temp_downtime->service_description, temp_downtime->host_name, 
-+			log_debug_info(DEBUGL_DOWNTIME, 1,
-+					"Cannot find service (%s) for host (%s) for downtime ID: %lu\n",
-+					temp_downtime->service_description, temp_downtime->host_name,
- 					downtime_id);
- 			return ERROR;
- 			}
-@@ -322,22 +322,22 @@
- 	my_free(temp_buffer);
- 
- 	/* only non-triggered downtime is scheduled... */
--	if((temp_downtime->triggered_by == 0) && ((TRUE == temp_downtime->fixed) || 
--			((FALSE == temp_downtime->fixed) && 
-+	if((temp_downtime->triggered_by == 0) && ((TRUE == temp_downtime->fixed) ||
-+			((FALSE == temp_downtime->fixed) &&
- 			(TRUE == temp_downtime->is_in_effect)))) {
- 		/* If this is a fixed downtime, schedule the event to start it. If this
--			is a flexible downtime, normally we wait for one of the 
--			check_pending_flex_*_downtime() functions to start it, but if the 
--			downtime is already in effect, this means that we are restarting 
--			Nagios and the downtime was in effect when we last shutdown 
--			Nagios, so we should restart the flexible downtime now. This 
--			should work even if the downtime has ended because the 
--			handle_scheduled_dowtime() function will immediately schedule 
-+			is a flexible downtime, normally we wait for one of the
-+			check_pending_flex_*_downtime() functions to start it, but if the
-+			downtime is already in effect, this means that we are restarting
-+			Nagios and the downtime was in effect when we last shutdown
-+			Nagios, so we should restart the flexible downtime now. This
-+			should work even if the downtime has ended because the
-+			handle_scheduled_dowtime() function will immediately schedule
- 			another downtime event which will end the downtime. */
- 		if((new_downtime_id = (unsigned long *)malloc(sizeof(unsigned long *)))) {
- 			*new_downtime_id = downtime_id;
- 			temp_downtime->start_event = schedule_new_event(EVENT_SCHEDULED_DOWNTIME, TRUE, temp_downtime->start_time, FALSE, 0, NULL, FALSE, (void *)new_downtime_id, NULL, 0);
--			/* Turn off is_in_effect flag so handle_scheduled_downtime() will 
-+			/* Turn off is_in_effect flag so handle_scheduled_downtime() will
- 				handle it correctly */
- 			was_in_effect = temp_downtime->is_in_effect;
- 			temp_downtime->is_in_effect = FALSE;
-@@ -351,14 +351,14 @@
- 			else
- 				svc->pending_flex_downtime++;
- 			temp_downtime->incremented_pending_downtime = TRUE;
-- 
-+
- 			/* Since a flex downtime may never start, schedule an expiring event in
- 				case the event is never triggered. The expire event will NOT cancel
- 				a downtime event that is in effect */
- 			log_debug_info(DEBUGL_DOWNTIME, 1, "Scheduling downtime expire event in case flexible downtime is never triggered\n");
- 			temp_downtime->stop_event = schedule_new_event(EVENT_EXPIRE_DOWNTIME, TRUE, (temp_downtime->end_time + 1), FALSE, 0, NULL, FALSE, NULL, NULL, 0);
- 			}
-- 
-+
- #ifdef PROBABLY_NOT_NEEDED
- 	/*** FLEXIBLE DOWNTIME SANITY CHECK - ADDED 02/17/2008 ****/
- 
-@@ -382,18 +382,18 @@
- 	scheduled_downtime *temp_downtime = NULL;
- 
- 	log_debug_info(DEBUGL_FUNCTIONS, 0, "handle_scheduled_downtime_by_id()\n");
-- 
-+
- 	/* find the downtime entry */
- 	if((temp_downtime = find_downtime(ANY_DOWNTIME, downtime_id)) == NULL) {
--		log_debug_info(DEBUGL_DOWNTIME, 1, "Unable to find downtime id: %lu\n", 
-+		log_debug_info(DEBUGL_DOWNTIME, 1, "Unable to find downtime id: %lu\n",
- 				downtime_id);
- 		return ERROR;
- 		}
- 
--	/* NULL out this event's start time since the calling function, 
--		handle_timed_event(), will free the event, this will prevent 
-+	/* NULL out this event's start time since the calling function,
-+		handle_timed_event(), will free the event, this will prevent
- 		unschedule_downtime from freeing something that has already been
--		freed. The start event is not needed within 
-+		freed. The start event is not needed within
- 		handle_scheduled_downtime(). */
- 	temp_downtime->start_event = NULL;
- 
-@@ -559,7 +559,7 @@
- 
- 		/* schedule an event to end the downtime */
- 		if(temp_downtime->fixed == FALSE) {
--			event_time = (time_t)((unsigned long)temp_downtime->flex_downtime_start 
-+			event_time = (time_t)((unsigned long)temp_downtime->flex_downtime_start
- 					+ temp_downtime->duration);
- 			}
- 		else {
-@@ -779,7 +779,7 @@
- 	log_debug_info(DEBUGL_FUNCTIONS, 0, "add_new_service_downtime()\n");
- 
- 	if(host_name == NULL || service_description == NULL) {
--		log_debug_info(DEBUGL_DOWNTIME, 1, 
-+		log_debug_info(DEBUGL_DOWNTIME, 1,
- 				"Host name (%s) or service description (%s) is null\n",
- 				((NULL == host_name) ? "null" : host_name),
- 				((NULL == service_description) ? "null" : service_description));
-@@ -963,14 +963,14 @@
- 
- 	/* don't add triggered downtimes that don't have a valid parent */
- 	if(triggered_by > 0  && find_downtime(ANY_DOWNTIME, triggered_by) == NULL) {
--		log_debug_info(DEBUGL_DOWNTIME, 1, 
-+		log_debug_info(DEBUGL_DOWNTIME, 1,
- 				"Downtime is triggered, but has no valid parent\n");
- 		return ERROR;
- 		}
- 
- 	/* we don't have enough info */
- 	if(host_name == NULL || (downtime_type == SERVICE_DOWNTIME && svc_description == NULL)) {
--		log_debug_info(DEBUGL_DOWNTIME, 1, 
-+		log_debug_info(DEBUGL_DOWNTIME, 1,
- 				"Host name (%s) or service description (%s) is null\n",
- 				((NULL == host_name) ? "null" : host_name),
- 				((NULL == svc_description) ? "null" : svc_description));
-@@ -979,34 +979,34 @@
- 
- 	/* allocate memory for the downtime */
- 	if((new_downtime = (scheduled_downtime *)calloc(1, sizeof(scheduled_downtime))) == NULL) {
--		log_debug_info(DEBUGL_DOWNTIME, 1, 
-+		log_debug_info(DEBUGL_DOWNTIME, 1,
- 				"Unable to allocate memory for new downtime\n");
- 		return ERROR;
- 		}
- 
- 	/* duplicate vars */
- 	if((new_downtime->host_name = (char *)strdup(host_name)) == NULL) {
--		log_debug_info(DEBUGL_DOWNTIME, 1, 
-+		log_debug_info(DEBUGL_DOWNTIME, 1,
- 				"Unable to allocate memory for new downtime's host name\n");
- 		result = ERROR;
- 		}
- 	if(downtime_type == SERVICE_DOWNTIME) {
- 		if((new_downtime->service_description = (char *)strdup(svc_description)) == NULL) {
--			log_debug_info(DEBUGL_DOWNTIME, 1, 
-+			log_debug_info(DEBUGL_DOWNTIME, 1,
- 					"Unable to allocate memory for new downtime's service description\n");
- 			result = ERROR;
- 			}
- 		}
- 	if(author) {
- 		if((new_downtime->author = (char *)strdup(author)) == NULL) {
--			log_debug_info(DEBUGL_DOWNTIME, 1, 
-+			log_debug_info(DEBUGL_DOWNTIME, 1,
- 					"Unable to allocate memory for new downtime's author\n");
- 			result = ERROR;
- 			}
- 		}
- 	if(comment_data) {
- 		if((new_downtime->comment = (char *)strdup(comment_data)) == NULL) {
--			log_debug_info(DEBUGL_DOWNTIME, 1, 
-+			log_debug_info(DEBUGL_DOWNTIME, 1,
- 					"Unable to allocate memory for new downtime's comment\n");
- 			result = ERROR;
- 			}
-@@ -1131,8 +1131,8 @@
- 	log_debug_info(DEBUGL_FUNCTIONS, 0, "find_downtime()\n");
- 
- 	for(temp_downtime = scheduled_downtime_list; temp_downtime != NULL; temp_downtime = temp_downtime->next) {
--		log_debug_info(DEBUGL_DOWNTIME, 2, 
--				"find_downtime() looking at type %d, id: %lu\n", type, 
-+		log_debug_info(DEBUGL_DOWNTIME, 2,
-+				"find_downtime() looking at type %d, id: %lu\n", type,
- 				downtime_id);
- 		if(type != ANY_DOWNTIME && temp_downtime->type != type)
- 			continue;
+diff -wur nagios-4.0.20130107.original/common/downtime.c nagios-4.0.20130107/common/downtime.c
+--- nagios-4.0.20130107.original/common/downtime.c	2012-12-24 15:29:43.000000000 +0000
++++ nagios-4.0.20130107/common/downtime.c	2013-06-25 01:25:25.000000000 +0000
 @@ -1157,7 +1157,35 @@
  	return find_downtime(SERVICE_DOWNTIME, downtime_id);
  	}
@@ -336,9 +143,9 @@
  
  /******************************************************************/
  /********************* CLEANUP FUNCTIONS **************************/
-diff -ur -x Makefile -x config.log -x config.status -x libtool nagios-4.0.20121116.orig_with_new_patches/include/comments.h nagios-4.0.20121116/include/comments.h
---- nagios-4.0.20121116.orig_with_new_patches/include/comments.h	2012-11-20 10:54:19.000000000 +0000
-+++ nagios-4.0.20121116/include/comments.h	2012-11-20 12:52:34.000000000 +0000
+diff -wur nagios-4.0.20130107.original/include/comments.h nagios-4.0.20130107/include/comments.h
+--- nagios-4.0.20130107.original/include/comments.h	2012-12-24 15:29:29.000000000 +0000
++++ nagios-4.0.20130107/include/comments.h	2013-06-25 01:25:25.000000000 +0000
 @@ -38,6 +38,7 @@
  
  #define HOST_COMMENT			1
@@ -355,10 +162,10 @@
  
  struct comment *get_first_comment_by_host(char *);
  struct comment *get_next_comment_by_host(char *, struct comment *);
-diff -ur -x Makefile -x config.log -x config.status -x libtool nagios-4.0.20121116.orig_with_new_patches/include/common.h nagios-4.0.20121116/include/common.h
---- nagios-4.0.20121116.orig_with_new_patches/include/common.h	2012-11-20 10:54:19.000000000 +0000
-+++ nagios-4.0.20121116/include/common.h	2012-11-20 12:52:34.000000000 +0000
-@@ -345,6 +345,9 @@
+diff -wur nagios-4.0.20130107.original/include/common.h nagios-4.0.20130107/include/common.h
+--- nagios-4.0.20130107.original/include/common.h	2013-06-25 01:24:57.000000000 +0000
++++ nagios-4.0.20130107/include/common.h	2013-06-25 01:25:25.000000000 +0000
+@@ -347,6 +347,9 @@
  /* custom command introduced in Nagios 3.x */
  #define CMD_CUSTOM_COMMAND                              999
  
@@ -368,9 +175,9 @@
  
  /**************************** CHECK TYPES ********************************/
  
-diff -ur -x Makefile -x config.log -x config.status -x libtool nagios-4.0.20121116.orig_with_new_patches/include/downtime.h nagios-4.0.20121116/include/downtime.h
---- nagios-4.0.20121116.orig_with_new_patches/include/downtime.h	2012-11-20 10:54:19.000000000 +0000
-+++ nagios-4.0.20121116/include/downtime.h	2012-11-20 12:52:34.000000000 +0000
+diff -wur nagios-4.0.20130107.original/include/downtime.h nagios-4.0.20130107/include/downtime.h
+--- nagios-4.0.20130107.original/include/downtime.h	2012-12-24 15:29:29.000000000 +0000
++++ nagios-4.0.20130107/include/downtime.h	2013-06-25 01:25:25.000000000 +0000
 @@ -101,6 +101,7 @@
  struct scheduled_downtime *find_downtime(int, unsigned long);
  struct scheduled_downtime *find_host_downtime(unsigned long);
@@ -379,9 +186,9 @@
  
  void free_downtime_data(void);                                       /* frees memory allocated to scheduled downtime list */
  
-diff -ur -x Makefile -x config.log -x config.status -x libtool nagios-4.0.20121116.orig_with_new_patches/include/sretention.h nagios-4.0.20121116/include/sretention.h
---- nagios-4.0.20121116.orig_with_new_patches/include/sretention.h	2012-11-20 10:54:19.000000000 +0000
-+++ nagios-4.0.20121116/include/sretention.h	2012-11-20 12:52:34.000000000 +0000
+diff -wur nagios-4.0.20130107.original/include/sretention.h nagios-4.0.20130107/include/sretention.h
+--- nagios-4.0.20130107.original/include/sretention.h	2012-12-24 15:29:29.000000000 +0000
++++ nagios-4.0.20130107/include/sretention.h	2013-06-25 01:25:25.000000000 +0000
 @@ -27,5 +27,6 @@
  int cleanup_retention_data(char *);
  int save_state_information(int);                 /* saves all host and state information */
@@ -389,9 +196,9 @@
 +int sync_state_information(void);                /* syncs hosts and state information from sync file */
  
  NAGIOS_END_DECL
-diff -ur -x Makefile -x config.log -x config.status -x libtool nagios-4.0.20121116.orig_with_new_patches/xdata/xrddefault.c nagios-4.0.20121116/xdata/xrddefault.c
---- nagios-4.0.20121116.orig_with_new_patches/xdata/xrddefault.c	2012-11-20 10:54:19.000000000 +0000
-+++ nagios-4.0.20121116/xdata/xrddefault.c	2012-11-20 12:52:34.000000000 +0000
+diff -wur nagios-4.0.20130107.original/xdata/xrddefault.c nagios-4.0.20130107/xdata/xrddefault.c
+--- nagios-4.0.20130107.original/xdata/xrddefault.c	2012-12-24 15:29:10.000000000 +0000
++++ nagios-4.0.20130107/xdata/xrddefault.c	2013-06-25 01:25:25.000000000 +0000
 @@ -39,6 +39,7 @@
  #include "xrddefault.h"
  
@@ -496,39 +303,12 @@
  
  					my_free(host_name);
  					my_free(service_description);
-@@ -852,34 +863,54 @@
+@@ -852,6 +863,21 @@
  				case XRDDEFAULT_HOSTCOMMENT_DATA:
  				case XRDDEFAULT_SERVICECOMMENT_DATA:
  
--					/* add the comment */
--					add_comment((data_type == XRDDEFAULT_HOSTCOMMENT_DATA) ? HOST_COMMENT : SERVICE_COMMENT, entry_type, host_name, service_description, entry_time, author, comment_data, comment_id, persistent, expires, expire_time, source);
--
--					/* delete the comment if necessary */
--					/* it seems a bit backwards to add and then immediately delete the comment, but its necessary to track comment deletions in the event broker */
--					remove_comment = FALSE;
--					/* host no longer exists */
--					if((temp_host = find_host(host_name)) == NULL)
--						remove_comment = TRUE;
--					/* service no longer exists */
--					else if(data_type == XRDDEFAULT_SERVICECOMMENT_DATA && (temp_service = find_service(host_name, service_description)) == NULL)
--						remove_comment = TRUE;
--					/* acknowledgement comments get deleted if they're not persistent and the original problem is no longer acknowledged */
--					else if(entry_type == ACKNOWLEDGEMENT_COMMENT) {
--						ack = FALSE;
--						if(data_type == XRDDEFAULT_HOSTCOMMENT_DATA)
--							ack = temp_host->problem_has_been_acknowledged;
--						else
--							ack = temp_service->problem_has_been_acknowledged;
--						if(ack == FALSE && persistent == FALSE)
--							remove_comment = TRUE;
--						}
--					/* non-persistent comments don't last past restarts UNLESS they're acks (see above) */
--					else if(persistent == FALSE)
--						remove_comment = TRUE;
 +	                add_object = TRUE;
- 
--					if(remove_comment == TRUE)
--						delete_comment((data_type == XRDDEFAULT_HOSTCOMMENT_DATA) ? HOST_COMMENT : SERVICE_COMMENT, comment_id);
++
 +	                if(overwrite_data==FALSE) {
 +	                    /* search for comment. If exists, then drop. If doesn't exist, then flow through but need to get a comment_id */
 +	                    if(find_comment_by_similar_content((data_type==XRDDEFAULT_HOSTCOMMENT_DATA)?HOST_COMMENT:SERVICE_COMMENT,host_name,(data_type==XRDDEFAULT_HOSTCOMMENT_DATA?NULL:service_description),author,comment_data)!=NULL)
@@ -542,51 +322,25 @@
 +	                }
 +
 +	                if(add_object==TRUE) {
-+	                    /* add the comment */
-+	                    add_comment((data_type==XRDDEFAULT_HOSTCOMMENT_DATA)?HOST_COMMENT:SERVICE_COMMENT,entry_type,host_name,service_description,entry_time,author,comment_data,comment_id,persistent,expires,expire_time,source);
-+
-+	                    /* delete the comment if necessary */
-+	                    /* it seems a bit backwards to add and then immediately delete the comment, but its necessary to track comment deletions in the event broker */
-+	                    remove_comment=FALSE;
-+	                    /* host no longer exists */
-+	                    if((temp_host=find_host(host_name))==NULL)
-+	                        remove_comment=TRUE;
-+	                    /* service no longer exists */
-+	                    else if(data_type==XRDDEFAULT_SERVICECOMMENT_DATA && (temp_service=find_service(host_name,service_description))==NULL)
-+	                        remove_comment=TRUE;
-+	                    /* acknowledgement comments get deleted if they're not persistent and the original problem is no longer acknowledged */
-+	                    else if(entry_type==ACKNOWLEDGEMENT_COMMENT){
-+	                        ack=FALSE;
-+	                        if(data_type==XRDDEFAULT_HOSTCOMMENT_DATA)
-+	                            ack=temp_host->problem_has_been_acknowledged;
-+	                        else
-+	                            ack=temp_service->problem_has_been_acknowledged;
-+	                        if(ack==FALSE && persistent==FALSE)
-+	                            remove_comment=TRUE;
-+	                        }
-+	                    /* non-persistent comments don't last past restarts UNLESS they're acks (see above) */
-+	                    else if(persistent==FALSE)
-+	                        remove_comment=TRUE;
-+
-+	                    if(remove_comment==TRUE)
-+	                        delete_comment((data_type==XRDDEFAULT_HOSTCOMMENT_DATA)?HOST_COMMENT:SERVICE_COMMENT,comment_id);
-+
+ 					/* add the comment */
+ 					add_comment((data_type == XRDDEFAULT_HOSTCOMMENT_DATA) ? HOST_COMMENT : SERVICE_COMMENT, entry_type, host_name, service_description, entry_time, author, comment_data, comment_id, persistent, expires, expire_time, source);
+ 
+@@ -881,6 +907,11 @@
+ 					if(remove_comment == TRUE)
+ 						delete_comment((data_type == XRDDEFAULT_HOSTCOMMENT_DATA) ? HOST_COMMENT : SERVICE_COMMENT, comment_id);
+ 
 +	                    /* Reset any temporary pointers */
 +	                    temp_host=NULL;
 +	                    temp_service=NULL;
 +	                }
- 
++
  					/* free temp memory */
  					my_free(host_name);
+ 					my_free(service_description);
 @@ -901,14 +932,29 @@
  				case XRDDEFAULT_HOSTDOWNTIME_DATA:
  				case XRDDEFAULT_SERVICEDOWNTIME_DATA:
  
--					/* add the downtime */
--					if(data_type == XRDDEFAULT_HOSTDOWNTIME_DATA)
--						add_host_downtime(host_name, entry_time, author, comment_data, start_time, flex_downtime_start, end_time, fixed, triggered_by, duration, downtime_id, is_in_effect);
--					else
--						add_service_downtime(host_name, service_description, entry_time, author, comment_data, start_time, flex_downtime_start, end_time, fixed, triggered_by, duration, downtime_id, is_in_effect);
 +					add_object = TRUE;
 +
 +					if(overwrite_data==FALSE) {
@@ -600,17 +354,16 @@
 +							downtime_id=next_downtime_id;
 +						}
 +					}
- 
--					/* must register the downtime with Nagios so it can schedule it, add comments, etc. */
--					register_downtime((data_type == XRDDEFAULT_HOSTDOWNTIME_DATA) ? HOST_DOWNTIME : SERVICE_DOWNTIME, downtime_id);
++
 +					if (add_object==TRUE) {
-+						/* add the downtime */
-+						if(data_type==XRDDEFAULT_HOSTDOWNTIME_DATA)
-+							add_host_downtime(host_name, entry_time, author, comment_data, start_time, flex_downtime_start, end_time, fixed, triggered_by, duration, downtime_id, is_in_effect);
-+						else
-+							add_service_downtime(host_name, service_description, entry_time, author, comment_data, start_time, flex_downtime_start, end_time, fixed, triggered_by, duration, downtime_id, is_in_effect);
-+						/* must register the downtime with Nagios so it can schedule it, add comments, etc. */
-+						register_downtime((data_type==XRDDEFAULT_HOSTDOWNTIME_DATA)?HOST_DOWNTIME:SERVICE_DOWNTIME, downtime_id);
+ 					/* add the downtime */
+ 					if(data_type == XRDDEFAULT_HOSTDOWNTIME_DATA)
+ 						add_host_downtime(host_name, entry_time, author, comment_data, start_time, flex_downtime_start, end_time, fixed, triggered_by, duration, downtime_id, is_in_effect);
+ 					else
+ 						add_service_downtime(host_name, service_description, entry_time, author, comment_data, start_time, flex_downtime_start, end_time, fixed, triggered_by, duration, downtime_id, is_in_effect);
+-
+ 					/* must register the downtime with Nagios so it can schedule it, add comments, etc. */
+ 					register_downtime((data_type == XRDDEFAULT_HOSTDOWNTIME_DATA) ? HOST_DOWNTIME : SERVICE_DOWNTIME, downtime_id);
 +					}
  
  					/* free temp memory */
@@ -713,9 +466,9 @@
 +        result = xrddefault_read_retention_file_information(xrddefault_sync_retention_file, FALSE);
 +    return result;
 +}
-diff -ur -x Makefile -x config.log -x config.status -x libtool nagios-4.0.20121116.orig_with_new_patches/xdata/xrddefault.h nagios-4.0.20121116/xdata/xrddefault.h
---- nagios-4.0.20121116.orig_with_new_patches/xdata/xrddefault.h	2012-11-20 10:54:19.000000000 +0000
-+++ nagios-4.0.20121116/xdata/xrddefault.h	2012-11-20 12:52:34.000000000 +0000
+diff -wur nagios-4.0.20130107.original/xdata/xrddefault.h nagios-4.0.20130107/xdata/xrddefault.h
+--- nagios-4.0.20130107.original/xdata/xrddefault.h	2012-12-24 15:29:10.000000000 +0000
++++ nagios-4.0.20130107/xdata/xrddefault.h	2013-06-25 01:25:25.000000000 +0000
 @@ -41,5 +41,6 @@
  int xrddefault_grab_config_directives(char *);
  int xrddefault_save_state_information(void);        /* saves all host and service state information */

Modified: trunk/patches/nagios_time_jump_threshold.patch
===================================================================
--- trunk/patches/nagios_time_jump_threshold.patch	2013-07-25 07:58:50 UTC (rev 319)
+++ trunk/patches/nagios_time_jump_threshold.patch	2013-08-05 22:44:09 UTC (rev 320)
@@ -6,7 +6,7 @@
  
  		/* hey, wait a second...  we traveled back in time! */
 -		if(current_time < last_time)
-+		// take time change threashold into account
++		// take time change threshold into account
 +		if(current_time < (last_time - time_change_threshold))
  			compensate_for_system_time_change((unsigned long)last_time, (unsigned long)current_time);
  

_______________________________________________
Opsview-checkins mailing list
Opsview-checkins@lists.opsview.org
http://lists.opsview.org/lists/listinfo/opsview-checkins

Reply via email to