10c10 < * $Id: check_disk.c,v 1.3 2002/06/19 03:09:10 sghosh Exp $ --- > * $Id: check_disk.c,v 1.2 2002/06/06 04:15:49 sghosh Exp $ 53d52 < char *exclude_device = NULL; 56d54 < int display_errors_only = FALSE; 67d64 < int temp_result = STATE_UNKNOWN; 105,156c102,106 < /* 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 (exclude_device && !strcmp(exclude_device,file_system)) { < if (verbose) < printf ("ignoring %s.", file_system); < temp_result = STATE_OK; < } < < 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; < } < < < if (display_errors_only) { < if (temp_result != STATE_OK) { < len = < snprintf (outbuf, MAX_INPUT_BUFFER - 1, < " [%d kB (%d%%) free on %s]", free_disk, 100 - usp, < display_mntp ? mntp : file_system); < } < else { < len = 0; < } < } < else { < len = < snprintf (outbuf, MAX_INPUT_BUFFER - 1, < " [%d kB (%d%%) free on %s]", free_disk, 100 - usp, < display_mntp ? mntp : file_system); < } < --- > result = max (result, check_disk (usp, free_disk)); > len = > snprintf (outbuf, MAX_INPUT_BUFFER - 1, > " [%d kB (%d%%) free on %s]", free_disk, 100 - usp, > display_mntp ? mntp : file_system); 161,162c111,112 < printf ("Unable to read output:\n%s\n%s\n", command_line, input_buffer); < return result; --- > printf ("Unable to read output:\n%s\n%s\n", command_line, input_buffer); > return result; 168,171c118 < /*result = max (result, STATE_WARNING); */ < if( !( result == STATE_CRITICAL) ) { < result = STATE_WARNING; < } --- > result = max (result, STATE_WARNING); 178,181c125,126 < /*result = max (result, STATE_WARNING); */ < if( !( result == STATE_CRITICAL) ) { < result = STATE_WARNING; < } --- > result = max (result, STATE_WARNING); > 241d185 < {"exclude_device", required_argument, 0, 'x'}, 246d189 < {"errors-only", no_argument, 0, 'e'}, 254c197 < getopt_long (argc, argv, "+?Vehvt:c:w:p:x:m", long_options, &option_index); --- > getopt_long (argc, argv, "+?Vhvt:c:w:p:m", long_options, &option_index); 256c199 < c = getopt (argc, argv, "+?Vehvt:c:w:p:x:m"); --- > c = getopt (argc, argv, "+?Vhvt:c:w:p:m"); 269d211 < case 'x': 317,319d258 < case 'x': /* exclude path or partition */ < exclude_device = optarg; < break; 326,328d264 < case 'e': /* only display paths with error conditions */ < display_errors_only = TRUE; < break; 330c266 < print_revision (my_basename (argv[0]), "$Revision: 1.3 $"); --- > print_revision (my_basename (argv[0]), "$Revision: 1.2 $"); 390c326 < print_revision (PROGNAME, "$Revision: 1.3 $"); --- > print_revision (PROGNAME, "$Revision: 1.2 $"); 409,410d344 < " -x, --exclude_device=PATH\n" < " Ignore device (only works if -p unspecified)\n" 413,414d346 < " -e, --errors-only\n" < " Display only devices/mountpoints with errors\n" 427c359 < ("Usage: %s -w limit -c limit [-p path | -x device] [-t timeout] [-m] [-e] [--verbose]\n" --- > ("Usage: %s -w limit -c limit [-p path] [-t timeout] [-m] [--verbose]\n"