[Nagiosplug-checkins] CVS: nagiosplug/plugins check_disk.c,1.4,1.5

Karl DeBisschop kdebisschop at projects.sourceforge.net
Mon Nov 18 06:41:02 CET 2002


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

Modified Files:
	check_disk.c 
Log Message:
failed to handle multple disks

Index: check_disk.c
===================================================================
RCS file: /cvsroot/nagiosplug/nagiosplug/plugins/check_disk.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -r1.4 -r1.5
*** check_disk.c	13 Nov 2002 11:50:54 -0000	1.4
--- check_disk.c	18 Nov 2002 07:23:15 -0000	1.5
***************
*** 70,74 ****
  	char mntp[MAX_INPUT_BUFFER] = "";
  	char outbuf[MAX_INPUT_BUFFER] = "";
! 	char *output = NULL;
  
  	if (process_arguments (argc, argv) != OK)
--- 70,74 ----
  	char mntp[MAX_INPUT_BUFFER] = "";
  	char outbuf[MAX_INPUT_BUFFER] = "";
! 	char *output = "";
  
  	if (process_arguments (argc, argv) != OK)
***************
*** 101,141 ****
  				|| sscanf (input_buffer, "%s %*s %d %d %d %d%% %s", file_system,
  				 &total_disk, &used_disk, &free_disk, &usp, &mntp) == 6) {
! 
! 			/* cannot use max now that STATE_UNKNOWN is greater than STATE_CRITICAL
! 			result = max (result, check_disk (usp, free_disk)); */
! 			temp_result = check_disk (usp, free_disk) ;
! 
! 					
! 			if ( temp_result == STATE_CRITICAL ) {
! 				result = STATE_CRITICAL;
! 			}
! 			else if (temp_result == STATE_WARNING) {
! 				if ( !( result == STATE_CRITICAL) ) {
! 					result = STATE_WARNING;
! 				}
! 			}
! 			else if (temp_result == STATE_OK) {
! 				if ( ! ( result == STATE_CRITICAL || result == STATE_WARNING) ){
! 					result = STATE_OK;
! 				}
! 			}
! 			else if (temp_result == STATE_UNKNOWN) {
! 				if ( ! ( result == STATE_CRITICAL || result == STATE_WARNING || result == STATE_OK) ){
! 					result = STATE_UNKNOWN;
! 				}
! 			}
! 			else {
! 				/* don't have a match with the return value from check_disk() */
! 				result = STATE_UNKNOWN;
! 			}
! 				
! 
! 				
! 			len =
! 				snprintf (outbuf, MAX_INPUT_BUFFER - 1,
! 									" [%d kB (%d%%) free on %s]", free_disk, 100 - usp,
! 									display_mntp ? mntp : file_system);
! 			outbuf[len] = 0;
! 			output = strscat (output, outbuf);
  		}
  		else {
--- 101,107 ----
  				|| sscanf (input_buffer, "%s %*s %d %d %d %d%% %s", file_system,
  				 &total_disk, &used_disk, &free_disk, &usp, &mntp) == 6) {
! 			asprintf (&output, "%s [%d kB (%d%%) free on %s]", output, free_disk,
! 			          100 - usp, display_mntp ? mntp : file_system);
! 			result = max_state (result, check_disk (usp, free_disk));
  		}
  		else {
***************
*** 143,146 ****
--- 109,113 ----
  			return result;
  		}
+ 
  	}
  





More information about the Commits mailing list