Title: [opsview-base] [157] Added in Opsview patches required for Nagios object file to be in sync
Revision
157
Author
tvoon
Date
2012-12-19 13:54:18 +0000 (Wed, 19 Dec 2012)

Log Message

Added in Opsview patches required for Nagios object file to be in sync
between Nagios 4 + NDO utils 2

Modified Paths

Modified: trunk/Makefile
===================================================================
--- trunk/Makefile	2012-12-19 11:21:30 UTC (rev 156)
+++ trunk/Makefile	2012-12-19 13:54:18 UTC (rev 157)
@@ -761,11 +761,11 @@
 	cd ${NDOUTILS} && patch -p1 < ../patches/ndoutils_sync_nagios_4_object.h.patch
 	cd ${NDOUTILS} && patch -p1 < ../patches/ndoutils_pk.patch
 	cd ${NDOUTILS} && patch -p1 < ../patches/ndoutils_pk2.patch
-	# cd ${NDOUTILS} && patch -p1 < ../patches/ndoutils_no_unique_key_on_hostchecks.patch
+	cd ${NDOUTILS} && patch -p1 < ../patches/ndoutils_no_unique_key_on_hostchecks.patch
 	# cd ${NDOUTILS} && patch -p1 < ../patches/ndoutils_downtimes_do_not_update_start_times.patch
 	# cd ${NDOUTILS} && patch -p1 < ../patches/ndoutils_hide_db_connection_messages.patch
 	# cd ${NDOUTILS} && patch -p1 < ../patches/ndoutils_fix_memory_leak_multiple_hellos.patch
-	# cd ${NDOUTILS} && patch -p1 < ../patches/ndoutils_statedata_with_acks_downtime.patch
+	cd ${NDOUTILS} && patch -p1 < ../patches/ndoutils_statedata_with_acks_downtime.patch
 	# cd ${NDOUTILS} && patch -p1 < ../patches/ndoutils_performance_improvement_for_object_lookup.patch
 	# cd ${NDOUTILS} && aclocal -I m4 && autoconf
 	# #cp patches/ndoutils_upgradedb.pl ${NDOUTILS}/db/upgradedb.pl

Modified: trunk/patches/ndoutils_no_unique_key_on_hostchecks.patch
===================================================================
--- trunk/patches/ndoutils_no_unique_key_on_hostchecks.patch	2012-12-19 11:21:30 UTC (rev 156)
+++ trunk/patches/ndoutils_no_unique_key_on_hostchecks.patch	2012-12-19 13:54:18 UTC (rev 157)
@@ -1,18 +1,18 @@
-diff -ur ndoutils-1.4b7.original/include/nagios-3x/objects.h ndoutils-1.4b7/include/nagios-3x/objects.h
---- ndoutils-1.4b7.original/include/nagios-3x/objects.h	2011-02-01 05:50:52.347070161 +0000
-+++ ndoutils-1.4b7/include/nagios-3x/objects.h	2011-02-01 05:51:09.107159755 +0000
-@@ -335,6 +335,7 @@
+diff -ur ndoutils-2-0.original//include/nagios-4x/objects.h ndoutils-2-0/include/nagios-4x/objects.h
+--- ndoutils-2-0.original//include/nagios-4x/objects.h	2012-12-19 13:37:37.000000000 +0000
++++ ndoutils-2-0/include/nagios-4x/objects.h	2012-12-19 13:39:37.000000000 +0000
+@@ -484,6 +484,7 @@
  	char	*plugin_output;
  	char    *long_plugin_output;
  	char    *perf_data;
 +	char    *processed_command;
-         int     state_type;
+ 	int     state_type;
  	int     current_attempt;
  	unsigned long current_event_id;
-diff -ur ndoutils-1.4b7.original/src/dbhandlers.c ndoutils-1.4b7/src/dbhandlers.c
---- ndoutils-1.4b7.original/src/dbhandlers.c	2011-02-01 05:50:52.351060245 +0000
-+++ ndoutils-1.4b7/src/dbhandlers.c	2011-02-01 05:51:09.111086450 +0000
-@@ -1569,10 +1569,8 @@
+diff -ur ndoutils-2-0.original//src/dbhandlers.c ndoutils-2-0/src/dbhandlers.c
+--- ndoutils-2-0.original//src/dbhandlers.c	2012-12-19 13:37:37.000000000 +0000
++++ ndoutils-2-0/src/dbhandlers.c	2012-12-19 13:38:33.000000000 +0000
+@@ -1575,10 +1575,8 @@
  	result=ndo2db_convert_standard_data_elements(idi,&type,&flags,&attr,&tstamp);
  
  	/* only process finished host checks... */
@@ -21,9 +21,9 @@
  		return NDO_OK;
 -	*/
  
- #ifdef BUILD_NAGIOS_3X
+ #if ( defined( BUILD_NAGIOS_3X) || defined( BUILD_NAGIOS_4X))
  	/* skip precheck events - they aren't useful to us */
-@@ -1641,6 +1639,8 @@
+@@ -1648,6 +1646,8 @@
  		   )==-1)
  		buf1=NULL;
  
@@ -32,7 +32,7 @@
  	if(asprintf(&buf,"INSERT INTO %s SET %s, command_object_id='%lu', command_args='%s', command_line='%s' ON DUPLICATE KEY UPDATE %s"
  		    ,ndo2db_db_tablenames[NDO2DB_DBTABLE_HOSTCHECKS]
  		    ,buf1
-@@ -1650,6 +1650,15 @@
+@@ -1657,6 +1657,15 @@
  		    ,buf1
  		   )==-1)
  		buf=NULL;
@@ -48,18 +48,3 @@
  
  	result=ndo2db_db_query(idi,buf);
  	free(buf);
-diff -ur ndoutils-1.4b7.original/src/ndomod.c ndoutils-1.4b7/src/ndomod.c
---- ndoutils-1.4b7.original/src/ndomod.c	2011-02-01 05:50:52.351060245 +0000
-+++ ndoutils-1.4b7/src/ndomod.c	2011-02-01 05:52:17.373121615 +0000
-@@ -1735,6 +1735,11 @@
- 
- 		hcdata=(nebstruct_host_check_data *)data;
- 
-+		/* Opsview patch: Only allow NEBTYPE_HOSTCHECK_PROCESSED to pass through */
-+		/* As will be ignored at dbhandlers.c anyway */
-+		if(hcdata->type!=NEBTYPE_HOSTCHECK_PROCESSED)
-+			break;
-+
- 		es[0]=ndo_escape_buffer(hcdata->host_name);
- 		es[1]=ndo_escape_buffer(hcdata->command_name);
- 		es[2]=ndo_escape_buffer(hcdata->command_args);

Modified: trunk/patches/ndoutils_statedata_with_acks_downtime.patch
===================================================================
--- trunk/patches/ndoutils_statedata_with_acks_downtime.patch	2012-12-19 11:21:30 UTC (rev 156)
+++ trunk/patches/ndoutils_statedata_with_acks_downtime.patch	2012-12-19 13:54:18 UTC (rev 157)
@@ -1,7 +1,7 @@
-diff -ur ndoutils-1.4b7.original/include/nagios-3x/nebstructs.h ndoutils-1.4b7/include/nagios-3x/nebstructs.h
---- ndoutils-1.4b7.original/include/nagios-3x/nebstructs.h	2012-06-12 15:44:33.000000000 +0000
-+++ ndoutils-1.4b7/include/nagios-3x/nebstructs.h	2012-06-12 15:44:53.000000000 +0000
-@@ -521,6 +521,10 @@
+diff -ur ndoutils-2-0.original//include/nagios-3x/nebstructs.h ndoutils-2-0/include/nagios-3x/nebstructs.h
+--- ndoutils-2-0.original//include/nagios-4x/nebstructs.h	2012-09-24 22:29:40.000000000 +0000
++++ ndoutils-2-0/include/nagios-4x/nebstructs.h	2012-12-19 13:16:38.000000000 +0000
+@@ -520,6 +520,10 @@
  	int             state_type;
  	int             current_attempt;
  	int             max_attempts;
@@ -12,9 +12,9 @@
  	char            *output;
  
  	void            *object_ptr;
-diff -ur ndoutils-1.4b7.original/include/protoapi.h ndoutils-1.4b7/include/protoapi.h
---- ndoutils-1.4b7.original/include/protoapi.h	2007-09-27 17:20:30.000000000 +0000
-+++ ndoutils-1.4b7/include/protoapi.h	2012-06-12 15:44:53.000000000 +0000
+diff -ur ndoutils-2-0.original//include/protoapi.h ndoutils-2-0/include/protoapi.h
+--- ndoutils-2-0.original//include/protoapi.h	2012-09-24 22:29:40.000000000 +0000
++++ ndoutils-2-0/include/protoapi.h	2012-12-19 13:16:38.000000000 +0000
 @@ -107,7 +107,7 @@
  
  /************** COMMON DATA ATTRIBUTES **************/
@@ -24,7 +24,7 @@
  
  #define NDO_DATA_NONE                                0
  
-@@ -385,4 +385,8 @@
+@@ -386,4 +386,8 @@
  #define NDO_DATA_CONTACT                             264
  #define NDO_DATA_LASTSTATE                           265
  
@@ -33,12 +33,12 @@
 +#define NDO_DATA_HOSTSTATETYPE                       401
 +
  #endif
-diff -ur ndoutils-1.4b7.original/src/dbhandlers.c ndoutils-1.4b7/src/dbhandlers.c
---- ndoutils-1.4b7.original/src/dbhandlers.c	2012-06-12 15:44:34.000000000 +0000
-+++ ndoutils-1.4b7/src/dbhandlers.c	2012-06-12 15:44:53.000000000 +0000
-@@ -3086,6 +3086,10 @@
+diff -ur ndoutils-2-0.original//src/dbhandlers.c ndoutils-2-0/src/dbhandlers.c
+--- ndoutils-2-0.original//src/dbhandlers.c	2012-12-19 13:16:15.000000000 +0000
++++ ndoutils-2-0/src/dbhandlers.c	2012-12-19 13:22:03.000000000 +0000
+@@ -2928,6 +2928,10 @@
  	char *ts[1];
- 	char *es[1];
+ 	char *es[2];
  	char *buf=NULL;
 +    char *buf2=NULL;
 +    int scheduled_downtime_depth,downtime_id,problem_has_been_acknowledged,eventtype,host_state,host_state_type;
@@ -47,7 +47,7 @@
  
  	if(idi==NULL)
  		return NDO_ERROR;
-@@ -3097,6 +3101,62 @@
+@@ -2939,6 +2943,62 @@
  	if(type!=NEBTYPE_STATECHANGE_END)
  		return NDO_OK;
  
@@ -110,22 +110,18 @@
  	/* convert vars */
  	result=ndo2db_convert_string_to_int(idi->buffered_input[NDO_DATA_STATECHANGETYPE],&statechange_type);
  	result=ndo2db_convert_string_to_int(idi->buffered_input[NDO_DATA_STATECHANGE],&state_change_occurred);
-@@ -3106,10 +3166,10 @@
- 	result=ndo2db_convert_string_to_int(idi->buffered_input[NDO_DATA_MAXCHECKATTEMPTS],&max_attempts);
+@@ -2949,19 +3009,30 @@
  	result=ndo2db_convert_string_to_int(idi->buffered_input[NDO_DATA_LASTHARDSTATE],&last_hard_state);
  	result=ndo2db_convert_string_to_int(idi->buffered_input[NDO_DATA_LASTSTATE],&last_state);
--
+ 
 -	es[0]=ndo2db_db_escape_string(idi,idi->buffered_input[NDO_DATA_OUTPUT]);
+-	es[1]=ndo2db_db_escape_string(idi,idi->buffered_input[NDO_DATA_LONGOUTPUT]);
 -
 -	ts[0]=ndo2db_db_timet_to_sql(idi,tstamp.tv_sec);
-+	result=ndo2db_convert_string_to_int(idi->buffered_input[NDO_DATA_SCHEDULEDDOWNTIMEDEPTH],&scheduled_downtime_depth);
-+	result=ndo2db_convert_string_to_int(idi->buffered_input[NDO_DATA_PROBLEMHASBEENACKNOWLEDGED],&problem_has_been_acknowledged);
-+	result=ndo2db_convert_string_to_int(idi->buffered_input[NDO_DATA_HOSTSTATE],&host_state);
-+	result=ndo2db_convert_string_to_int(idi->buffered_input[NDO_DATA_HOSTSTATETYPE],&host_state_type);
- 
+-
  	/* get the object id */
  	if(statechange_type==SERVICE_STATECHANGE)
-@@ -3117,8 +3177,18 @@
+ 		result=ndo2db_get_object_id_with_insert(idi,NDO2DB_OBJECTTYPE_SERVICE,idi->buffered_input[NDO_DATA_HOST],idi->buffered_input[NDO_DATA_SERVICE],&object_id);
  	else
  		result=ndo2db_get_object_id_with_insert(idi,NDO2DB_OBJECTTYPE_HOST,idi->buffered_input[NDO_DATA_HOST],NULL,&object_id);
  
@@ -136,16 +132,22 @@
 +    }
 +
 +	es[0]=ndo2db_db_escape_string(idi,idi->buffered_input[NDO_DATA_OUTPUT]);
++	es[1]=strdup("dummy"); // Need this dummy so free() below doesn't segfault
 +
 +	ts[0]=ndo2db_db_timet_to_sql(idi,tstamp.tv_sec);
 +
++	result=ndo2db_convert_string_to_int(idi->buffered_input[NDO_DATA_SCHEDULEDDOWNTIMEDEPTH],&scheduled_downtime_depth);
++	result=ndo2db_convert_string_to_int(idi->buffered_input[NDO_DATA_PROBLEMHASBEENACKNOWLEDGED],&problem_has_been_acknowledged);
++	result=ndo2db_convert_string_to_int(idi->buffered_input[NDO_DATA_HOSTSTATE],&host_state);
++	result=ndo2db_convert_string_to_int(idi->buffered_input[NDO_DATA_HOSTSTATETYPE],&host_state_type);
++
  	/* save entry to db */
 -	if(asprintf(&buf,"INSERT INTO %s SET instance_id='%lu', state_time=%s, state_time_usec='%lu', object_id='%lu', state_change='%d', state='%d', state_type='%d', current_check_attempt='%d', max_check_attempts='%d', last_state='%d', last_hard_state='%d', output='%s'"
 +	if(asprintf(&buf,"INSERT INTO %s SET instance_id='%lu', state_time=%s, state_time_usec='%lu', object_id='%lu', state_change='%d', state='%d', state_type='%d', current_check_attempt='%d', max_check_attempts='%d', last_state='%d', last_hard_state='%d', output='%s', scheduled_downtime_depth='%d', downtimehistory_id=%s, problem_has_been_acknowledged='%d', eventtype='%d', host_state='%d', host_state_type='%d'"
  		    ,ndo2db_db_tablenames[NDO2DB_DBTABLE_STATEHISTORY]
  		    ,idi->dbinfo.instance_id
  		    ,ts[0]
-@@ -3132,6 +3202,12 @@
+@@ -2975,11 +3046,18 @@
  		    ,last_state
  		    ,last_hard_state
  		    ,es[0]
@@ -158,27 +160,25 @@
  		   )==-1)
  		buf=NULL;
  
-@@ -3139,6 +3215,7 @@
+ 	result=ndo2db_db_query(idi,buf);
  	free(buf);
++	free(buf2);
  
- 	/* free memory */
-+    free(buf2);
- 	free(ts[0]);
- 	free(es[0]);
- 
-diff -ur ndoutils-1.4b7.original/src/ndomod.c ndoutils-1.4b7/src/ndomod.c
---- ndoutils-1.4b7.original/src/ndomod.c	2012-06-12 15:44:34.000000000 +0000
-+++ ndoutils-1.4b7/src/ndomod.c	2012-06-12 15:44:53.000000000 +0000
-@@ -1161,6 +1161,8 @@
+         /* free memory */
+ 	for (x = 0; x < NAGIOS_SIZEOF_ARRAY(ts); x++)
+diff -ur ndoutils-2-0.original//src/ndomod.c ndoutils-2-0/src/ndomod.c
+--- ndoutils-2-0.original//src/ndomod.c	2012-12-19 13:16:15.000000000 +0000
++++ ndoutils-2-0/src/ndomod.c	2012-12-19 13:25:13.000000000 +0000
+@@ -1347,6 +1347,8 @@
  	double retry_interval=0.0;
  	int last_state=-1;
  	int last_hard_state=-1;
-+    int host_state=-1;
-+    int host_state_type=-1;
- #ifdef BUILD_NAGIOS_3X
++	int host_state=-1;
++	int host_state_type=-1;
+ #if ( defined( BUILD_NAGIOS_3X) || defined( BUILD_NAGIOS_4X))
  	customvariablesmember *temp_customvar=NULL;
  #endif
-@@ -2908,6 +2910,8 @@
+@@ -3236,6 +3238,8 @@
  				}
  			last_state=temp_host->last_state;
  			last_state=temp_host->last_hard_state;
@@ -187,7 +187,7 @@
  			}
  		else{
  			if((temp_service=(service *)schangedata->object_ptr)==NULL){
-@@ -2916,6 +2920,8 @@
+@@ -3244,6 +3248,8 @@
  				}
  			last_state=temp_service->last_state;
  			last_hard_state=temp_service->last_hard_state;
@@ -196,16 +196,16 @@
  			}
  #endif
  
-@@ -2924,7 +2930,7 @@
- 		es[2]=ndo_escape_buffer(schangedata->output);
+@@ -3254,7 +3260,7 @@
+ 		es[3]=ndo_escape_buffer(schangedata->output);
  
  		snprintf(temp_buffer,sizeof(temp_buffer)-1
--			 ,"\n%d:\n%d=%d\n%d=%d\n%d=%d\n%d=%ld.%ld\n%d=%d\n%d=%s\n%d=%s\n%d=%d\n%d=%d\n%d=%d\n%d=%d\n%d=%d\n%d=%d\n%d=%d\n%d=%s\n%d\n\n"
-+			 ,"\n%d:\n%d=%d\n%d=%d\n%d=%d\n%d=%ld.%ld\n%d=%d\n%d=%s\n%d=%s\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=%d\n%d=%d\n%d=%d\n%d=%s\n%d\n\n"
+-			 ,"\n%d:\n%d=%d\n%d=%d\n%d=%d\n%d=%ld.%ld\n%d=%d\n%d=%s\n%d=%s\n%d=%d\n%d=%d\n%d=%d\n%d=%d\n%d=%d\n%d=%d\n%d=%d\n%d=%s\n%d=%s\n%d\n\n"
++			 ,"\n%d:\n%d=%d\n%d=%d\n%d=%d\n%d=%ld.%ld\n%d=%d\n%d=%s\n%d=%s\n%d=%d\n%d=%d\n%d=%d\n%d=%d\n%d=%d\n%d=%d\n%d=%d\n%d=%s\n%d=%s\n%d=%d\n%d=%d\n%d=%d\n%d=%d\n%d=%d\n%d=%s\n%d\n\n"
  			 ,NDO_API_STATECHANGEDATA
  			 ,NDO_DATA_TYPE
  			 ,schangedata->type
-@@ -2955,6 +2961,18 @@
+@@ -3285,6 +3291,18 @@
  			 ,last_state
  			 ,NDO_DATA_LASTHARDSTATE
  			 ,last_hard_state
@@ -223,4 +223,4 @@
 +             ,host_state_type
  			 ,NDO_DATA_OUTPUT
  			 ,es[2]
- 			 ,NDO_API_ENDDATA
+ 			 ,NDO_DATA_LONGOUTPUT

_______________________________________________
Opsview-checkins mailing list
[email protected]
http://lists.opsview.org/lists/listinfo/opsview-checkins

Reply via email to