[Nagiosplug-checkins] CVS: nagiosplug/plugins check_hpjd.c,1.11,1.12

Subhendu Ghosh sghosh at users.sourceforge.net
Fri Apr 11 11:45:13 CEST 2003


Update of /cvsroot/nagiosplug/nagiosplug/plugins
In directory sc8-pr-cvs1:/tmp/cvs-serv29338/plugins

Modified Files:
	check_hpjd.c 
Log Message:
patch 698384 - order of args to snmpget + print a bit of stderr

Index: check_hpjd.c
===================================================================
RCS file: /cvsroot/nagiosplug/nagiosplug/plugins/check_hpjd.c,v
retrieving revision 1.11
retrieving revision 1.12
diff -C2 -r1.11 -r1.12
*** check_hpjd.c	9 Apr 2003 03:46:26 -0000	1.11
--- check_hpjd.c	11 Apr 2003 18:44:50 -0000	1.12
***************
*** 113,118 ****
  
  	/* get the command to run */
! 	sprintf (command_line, "%s -m : -v 1 %s -c %s %s", PATH_TO_SNMPGET, address,
! 					 community, query_string);
  
  	/* run the command */
--- 113,118 ----
  
  	/* get the command to run */
! 	sprintf (command_line, "%s -m : -v 1 -c %s %s %s", PATH_TO_SNMPGET, community, 
! 									address, query_string);
  
  	/* run the command */
***************
*** 262,268 ****
  
  	/* WARNING if output found on stderr */
! 	if (fgets (input_buffer, MAX_INPUT_BUFFER - 1, child_stderr))
  		result = max_state (result, STATE_WARNING);
  
  	/* close stderr */
  	(void) fclose (child_stderr);
--- 262,274 ----
  
  	/* WARNING if output found on stderr */
! 	if (fgets (input_buffer, MAX_INPUT_BUFFER - 1, child_stderr)) {
  		result = max_state (result, STATE_WARNING);
+ 		/* remove CRLF */
+ 		if (input_buffer[strlen (input_buffer) - 1] == '\n')
+ 			input_buffer[strlen (input_buffer) - 1] = 0;
+ 		sprintf (error_message, "%s", input_buffer );
  
+ 	}
+ 	
  	/* close stderr */
  	(void) fclose (child_stderr);
***************
*** 282,286 ****
  		/* might not be the problem, but most likely is.. */
  		result = STATE_UNKNOWN;
! 		sprintf (error_message, "Timeout: No response from %s\n", address);
  	}
  
--- 288,295 ----
  		/* might not be the problem, but most likely is.. */
  		result = STATE_UNKNOWN;
! 		char *temp ;
! 		asprintf (&temp, error_message);
! 		sprintf (error_message, "%s : Timeout from host %s\n", temp, address );
! 		 
  	}
  





More information about the Commits mailing list