[Nagiosplug-checkins] CVS: nagiosplug/plugins check_swap.c,1.26,1.27

Karl DeBisschop kdebisschop at users.sourceforge.net
Wed Feb 25 00:20:07 CET 2004


Update of /cvsroot/nagiosplug/nagiosplug/plugins
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv22902/plugins

Modified Files:
	check_swap.c 
Log Message:
change some datatypes to llu for very large swaps

Index: check_swap.c
===================================================================
RCS file: /cvsroot/nagiosplug/nagiosplug/plugins/check_swap.c,v
retrieving revision 1.26
retrieving revision 1.27
diff -C2 -r1.26 -r1.27
*** check_swap.c	20 Feb 2004 01:05:02 -0000	1.26
--- check_swap.c	25 Feb 2004 08:12:56 -0000	1.27
***************
*** 43,48 ****
  int warn_percent = 0;
  int crit_percent = 0;
! long unsigned int warn_size = 0;
! long unsigned int crit_size = 0;
  int verbose;
  int allswaps;
--- 43,48 ----
  int warn_percent = 0;
  int crit_percent = 0;
! unsigned long long warn_size = 0;
! unsigned long long crit_size = 0;
  int verbose;
  int allswaps;
***************
*** 52,57 ****
  {
  	int percent_used, percent;
! 	long unsigned int total_swap = 0, used_swap = 0, free_swap = 0;
! 	long unsigned int dsktotal, dskused, dskfree;
  	int result = STATE_OK;
  	char input_buffer[MAX_INPUT_BUFFER];
--- 52,57 ----
  {
  	int percent_used, percent;
! 	unsigned long long total_swap = 0, used_swap = 0, free_swap = 0;
! 	unsigned long long dsktotal, dskused, dskfree;
  	int result = STATE_OK;
  	char input_buffer[MAX_INPUT_BUFFER];
***************
*** 83,87 ****
  	fp = fopen (PROC_MEMINFO, "r");
  	while (fgets (input_buffer, MAX_INPUT_BUFFER - 1, fp)) {
! 		if (sscanf (input_buffer, " %s %lu %lu %lu", str, &dsktotal, &dskused, &dskfree) == 4 &&
  		    strstr (str, "Swap")) {
  			dsktotal = dsktotal / 1048576;
--- 83,87 ----
  	fp = fopen (PROC_MEMINFO, "r");
  	while (fgets (input_buffer, MAX_INPUT_BUFFER - 1, fp)) {
! 		if (sscanf (input_buffer, " %s %llu %llu %llu", str, &dsktotal, &dskused, &dskfree) == 4 &&
  		    strstr (str, "Swap")) {
  			dsktotal = dsktotal / 1048576;
***************
*** 95,99 ****
  				result = max_state (result, check_swap (percent, dskfree));
  				if (verbose)
! 					asprintf (&status, "%s [%lu (%d%%)]", status, dskfree, 100 - percent);
  			}
  		}
--- 95,99 ----
  				result = max_state (result, check_swap (percent, dskfree));
  				if (verbose)
! 					asprintf (&status, "%s [%llu (%d%%)]", status, dskfree, 100 - percent);
  			}
  		}
***************
*** 196,200 ****
  				result = max_state (result, check_swap (percent, dskfree));
  				if (verbose)
! 					asprintf (&status, "%s [%lu (%d%%)]", status, dskfree, 100 - percent);
  			}
  		}
--- 196,200 ----
  				result = max_state (result, check_swap (percent, dskfree));
  				if (verbose)
! 					asprintf (&status, "%s [%llu (%d%%)]", status, dskfree, 100 - percent);
  			}
  		}
***************
*** 222,226 ****
  	percent_used = 100 * ((double) used_swap) / ((double) total_swap);
  	result = max_state (result, check_swap (percent_used, free_swap));
! 	asprintf (&status, _(" %d%% free (%lu MB out of %lu MB)%s"),
  						(100 - percent_used), free_swap, total_swap, status);
  
--- 222,226 ----
  	percent_used = 100 * ((double) used_swap) / ((double) total_swap);
  	result = max_state (result, check_swap (percent_used, free_swap));
! 	asprintf (&status, _(" %d%% free (%llu MB out of %llu MB)%s"),
  						(100 - percent_used), free_swap, total_swap, status);
  
***************
*** 290,294 ****
  			else if (strstr (optarg, ",") &&
  							 strstr (optarg, "%") &&
! 							 sscanf (optarg, "%lu,%d%%", &warn_size, &warn_percent) == 2) {
  				break;
  			}
--- 290,294 ----
  			else if (strstr (optarg, ",") &&
  							 strstr (optarg, "%") &&
! 							 sscanf (optarg, "%llu,%d%%", &warn_size, &warn_percent) == 2) {
  				break;
  			}
***************
*** 307,311 ****
  			else if (strstr (optarg, ",") &&
  							 strstr (optarg, "%") &&
! 							 sscanf (optarg, "%lu,%d%%", &crit_size, &crit_percent) == 2) {
  				break;
  			}
--- 307,311 ----
  			else if (strstr (optarg, ",") &&
  							 strstr (optarg, "%") &&
! 							 sscanf (optarg, "%llu,%d%%", &crit_size, &crit_percent) == 2) {
  				break;
  			}





More information about the Commits mailing list