Title: [opsview-base] [228] Also unescape backslashes
Revision
228
Author
tvoon
Date
2013-03-22 17:19:19 +0000 (Fri, 22 Mar 2013)

Log Message

Also unescape backslashes

Modified Paths


Modified: trunk/Makefile
===================================================================
--- trunk/Makefile	2013-03-22 16:25:48 UTC (rev 227)
+++ trunk/Makefile	2013-03-22 17:19:19 UTC (rev 228)
@@ -605,7 +605,9 @@
 	cd ${NAGIOS} && patch -p1 < ../patches/nagios_reentrant_localtime.patch
 	cd ${NAGIOS} && patch -p1 < ../patches/nagios_fix_multiple_log_rotations.patch
 	# Patch below to test that results from slaves get linefeeds converted correctly
-	# Test with: perl -e 'print "opsview\tHTTP\t3\thelp\\nwith single \\ and\\n double \\\\ for all",$/' | send_nrd -c /usr/local/nagios/etc/send_nrd.cfg
+	# Test with: perl -e 'print "opsview\tHTTP\t3\thelp\\nwith single \\\\ and\\n double \\\\\\\\ for all",$/' | send_nrd -c /usr/local/nagios/etc/send_nrd.cfg
+	# Single backslashes are converted by Nagios into a double backslash in SERVICEOUTPUT, which then gets passed to NRD
+	# NRD will just send data as is
 	cd ${NAGIOS} && patch -p1 < ../patches/nagios_convert_to_linefeeds_from_checkresults.patch
 	if [ $(KERNEL_NAME) = Linux ] ; then \
 		cd ${NAGIOS} && CFLAGS="${CFLAGS}" ./configure --with-nagios-user=$(NAGIOS_USER) --with-nagios-group=$(NAGIOS_GROUP) --with-command-group=$(NAGIOS_GROUP) --with-cgiurl=/cgi-bin --with-htmurl=/ --enable-libtap ; \

Modified: trunk/patches/nagios_convert_to_linefeeds_from_checkresults.patch
===================================================================
--- trunk/patches/nagios_convert_to_linefeeds_from_checkresults.patch	2013-03-22 16:25:48 UTC (rev 227)
+++ trunk/patches/nagios_convert_to_linefeeds_from_checkresults.patch	2013-03-22 17:19:19 UTC (rev 228)
@@ -1,8 +1,7 @@
-Binary files nagios-4.0.20130107.original/base/nagios and nagios-4.0.20130107/base/nagios differ
-diff -ur nagios-4.0.20130107.original/base/utils.c nagios-4.0.20130107/base/utils.c
---- nagios-4.0.20130107.original/base/utils.c	2013-03-22 15:54:58.000000000 +0000
-+++ nagios-4.0.20130107/base/utils.c	2013-03-22 16:21:26.000000000 +0000
-@@ -2256,8 +2256,26 @@
+diff -ur nagios-4.0.20130107.orig/base/utils.c nagios-4.0.20130107/base/utils.c
+--- nagios-4.0.20130107.orig/base/utils.c	2013-03-22 17:10:38.000000000 +0000
++++ nagios-4.0.20130107/base/utils.c	2013-03-22 17:13:48.000000000 +0000
+@@ -2256,8 +2256,30 @@
  				cr.exited_ok = atoi(val);
  			else if(!strcmp(var, "return_code"))
  				cr.return_code = atoi(val);
@@ -12,8 +11,8 @@
 +
 +				// Opsview patch: The checkresults dir is only for NRD type data now
 +				// We convert \n to actual linefeeds, because the subsequent parse_check_result
-+				// expects linefeeds in the stream
-+				// This wasn't required in Nagios 3 but processing has changed somewhere in 4
++				// expects linefeeds in the stream. We also convert \\ to a single backslash
++				// This is mirrored with the output from SERVICEOUTPUT on a slave system. There was a change somewhere in Nagios 4
 +				int x,y;
 +				char *buf = cr.output;
 +				for(x=0,y=0;buf[x]!='\x0';x++){
@@ -21,6 +20,10 @@
 +						x++;
 +						buf[y++]='\n';
 +						}
++					else if (buf[x]=='\\' && buf[x+1]=='\\'){
++						x++;
++						buf[y++]='\\';
++						}
 +					else
 +						buf[y++]=buf[x];
 +					}
@@ -30,4 +33,3 @@
  			}
  		}
  
-Binary files nagios-4.0.20130107.original/base/utils.o and nagios-4.0.20130107/base/utils.o differ

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

Reply via email to