Kaynağa Gözat

Multiline plugin output (1KB) support, new version prep

Ethan Galstad 19 yıl önce
ebeveyn
işleme
353aa5ae77
9 değiştirilmiş dosya ile 29 ekleme ve 27 silme
  1. 5 0
      Changelog
  2. 2 2
      configure
  3. 2 2
      configure.in
  4. 3 3
      include/common.h
  5. 6 6
      include/dh.h
  6. 1 1
      nrpe.spec
  7. 1 1
      src/check_nrpe.c
  8. 7 10
      src/nrpe.c
  9. 2 2
      update-version

+ 5 - 0
Changelog

@@ -3,6 +3,11 @@ NRPE Changelog
 **************
 
 
+2.8 - 05/08/2007
+---------------
+- Added support for multiline plugin output (limited to 1KB at the moment) (Matthias Flacke)
+
+
 2.8b1 - 03/14/2007
 -----------------
 - Changes to sample config files

+ 2 - 2
configure

@@ -1296,9 +1296,9 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu
 
 
 PKG_NAME=nrpe
-PKG_VERSION="2.8b1"
+PKG_VERSION="2.8"
 PKG_HOME_URL="http://www.nagios.org/"
-PKG_REL_DATE="03-14-2007"
+PKG_REL_DATE="05-08-2007"
 
 ac_aux_dir=
 for ac_dir in $srcdir $srcdir/.. $srcdir/../..; do

+ 2 - 2
configure.in

@@ -9,9 +9,9 @@ AC_CONFIG_HEADER(include/config.h)
 AC_PREFIX_DEFAULT(/usr/local/nagios)
 
 PKG_NAME=nrpe
-PKG_VERSION="2.8b1"
+PKG_VERSION="2.8"
 PKG_HOME_URL="http://www.nagios.org/"
-PKG_REL_DATE="03-14-2007"
+PKG_REL_DATE="05-08-2007"
 
 dnl Figure out how to invoke "install" and what install options to use.
 AC_PROG_INSTALL

+ 3 - 3
include/common.h

@@ -2,7 +2,7 @@
  *
  * COMMON.H - NRPE Common Include File
  * Copyright (c) 1999-2006 Ethan Galstad (nagios@nagios.org)
- * Last Modified: 03-14-2007
+ * Last Modified: 05-08-2007
  *
  * License:
  *
@@ -23,8 +23,8 @@
 
 #include "config.h"
 
-#define PROGRAM_VERSION "2.8b1"
-#define MODIFICATION_DATE "03-14-2007"
+#define PROGRAM_VERSION "2.8"
+#define MODIFICATION_DATE "05-08-2007"
 
 #define OK		0
 #define ERROR		-1

+ 6 - 6
include/dh.h

@@ -4,12 +4,12 @@
 DH *get_dh512()
 	{
 	static unsigned char dh512_p[]={
-		0x84,0x4C,0xF3,0x18,0x54,0x6A,0x8A,0xEA,0xC6,0x87,0x69,0xA0,
-		0x1C,0x59,0x32,0x2A,0x4B,0xF7,0xD9,0x33,0xCC,0xDC,0xFD,0xF0,
-		0x8D,0xC4,0xBD,0x8A,0xA5,0xB3,0xE3,0xBD,0x68,0xFD,0xED,0x78,
-		0x24,0x17,0x73,0x3A,0x5D,0x7A,0x1F,0x99,0xF6,0x41,0x5B,0x49,
-		0xE3,0xA2,0xD9,0x30,0xB1,0x98,0xCA,0xB4,0xB6,0x5F,0x91,0xCE,
-		0x09,0x62,0xFD,0x4B,
+		0xE3,0x60,0x78,0x76,0x5A,0x20,0x1C,0xA0,0x67,0xDA,0x93,0x59,
+		0x38,0x9D,0x0F,0x79,0x39,0x34,0x94,0xF7,0xBC,0xD2,0x40,0xA1,
+		0xE9,0x2C,0x72,0x9D,0x8E,0xD2,0xA8,0xCE,0xC9,0x01,0xD8,0x7E,
+		0x18,0xD4,0x55,0xFF,0x91,0xAF,0x9D,0x13,0x0C,0xBB,0x0F,0xBF,
+		0x8C,0x28,0x6B,0x06,0xF4,0xED,0x42,0x0A,0x62,0xF1,0x45,0x65,
+		0xD6,0x98,0x40,0x63,
 		};
 	static unsigned char dh512_g[]={
 		0x02,

+ 1 - 1
nrpe.spec

@@ -1,5 +1,5 @@
 %define name nrpe
-%define version 2.8b1
+%define version 2.8
 %define release 1
 %define nsusr nagios
 %define nsgrp nagios

+ 1 - 1
src/check_nrpe.c

@@ -4,7 +4,7 @@
  * Copyright (c) 1999-2007 Ethan Galstad (nagios@nagios.org)
  * License: GPL
  *
- * Last Modified: 03-14-2007
+ * Last Modified: 05-08-2007
  *
  * Command line: CHECK_NRPE -H <host_address> [-p port] [-c command] [-to to_sec]
  *

+ 7 - 10
src/nrpe.c

@@ -4,7 +4,7 @@
  * Copyright (c) 1999-2007 Ethan Galstad (nagios@nagios.org)
  * License: GPL
  *
- * Last Modified: 03-14-2007
+ * Last Modified: 05-08-2007
  *
  * Command line: nrpe -c <config_file> [--inetd | --daemon]
  *
@@ -1322,13 +1322,12 @@ int my_system(char *command,int timeout,int *early_timeout,char *output,int outp
 		        }
 		else{
 
-			/* read in the first line of output from the command */
-			strcpy(buffer,"");
-			fgets(buffer,sizeof(buffer)-1,fp);
+			/* read all lines of output - supports Nagios 3.x multiline output */
+			while((bytes_read=fread(buffer,1,sizeof(buffer)-1,fp))>0){
 
-			/* ADDED 01/19/2004 */
-			/* ignore any additional lines of output */
-			while(fgets(temp_buffer,sizeof(temp_buffer)-1,fp));
+				/* write the output back to the parent process */
+				write(fd[1],buffer,bytes_read);
+				}
 
 			/* close the command and get termination status */
 			status=pclose(fp);
@@ -1338,9 +1337,6 @@ int my_system(char *command,int timeout,int *early_timeout,char *output,int outp
 				result=STATE_CRITICAL;
 			else
 				result=WEXITSTATUS(status);
-
-			/* write the output back to the parent process */
-			write(fd[1],buffer,strlen(buffer)+1);
 		        }
 
 		/* close pipe for writing */
@@ -1349,6 +1345,7 @@ int my_system(char *command,int timeout,int *early_timeout,char *output,int outp
 		/* reset the alarm */
 		alarm(0);
 
+		/* return plugin exit code to parent process */
 		exit(result);
 	        }
 

+ 2 - 2
update-version

@@ -10,10 +10,10 @@ else
 fi
 
 # Current version number
-CURRENTVERSION=2.8b1
+CURRENTVERSION=2.8
 
 # Last date
-LASTDATE=03-14-2007
+LASTDATE=05-08-2007
 
 if [ "x$1" = "x" ]
 then