[Nagiosplug-checkins] nagiosplug/plugins check_disk.c,1.44,1.45

Matthew Kent mattkent at users.sourceforge.net
Mon Nov 22 21:50:08 CET 2004


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

Modified Files:
	check_disk.c 
Log Message:
Fix integer warning and critical options. Take values from current unit instead of always KB.


Index: check_disk.c
===================================================================
RCS file: /cvsroot/nagiosplug/nagiosplug/plugins/check_disk.c,v
retrieving revision 1.44
retrieving revision 1.45
diff -u -d -r1.44 -r1.45
--- check_disk.c	12 Nov 2004 00:49:51 -0000	1.44
+++ check_disk.c	23 Nov 2004 05:49:11 -0000	1.45
@@ -112,7 +112,7 @@
 int process_arguments (int, char **);
 void print_path (const char *mypath);
 int validate_arguments (uintmax_t, uintmax_t, double, double, char *);
-int check_disk (double usp, uintmax_t free_disk);
+int check_disk (double usp, double free_disk);
 int walk_name_list (struct name_list *list, const char *name);
 void print_help (void);
 void print_usage (void);
@@ -187,7 +187,7 @@
 
 		if (fsp.fsu_blocks && strcmp ("none", me->me_mountdir)) {
 			usp = (double)(fsp.fsu_blocks - fsp.fsu_bavail) * 100 / fsp.fsu_blocks;
-			disk_result = check_disk (usp, fsp.fsu_bavail * fsp.fsu_blocksize);
+			disk_result = check_disk (usp, (double)(fsp.fsu_bavail * fsp.fsu_blocksize / mult));
 			result = max_state (disk_result, result);
 			psize = fsp.fsu_blocks*fsp.fsu_blocksize/mult;
 			asprintf (&perf, "%s %s", perf,
@@ -525,7 +525,7 @@
 
 
 int
-check_disk (double usp, uintmax_t free_disk)
+check_disk (double usp, double free_disk)
 {
 	int result = STATE_UNKNOWN;
 	/* check the percent used space against thresholds */
@@ -585,11 +585,11 @@
 
 	printf (_("\
  -w, --warning=INTEGER\n\
-   Exit with WARNING status if less than INTEGER kilobytes of disk are free\n\
+   Exit with WARNING status if less than INTEGER --units of disk are free\n\
  -w, --warning=PERCENT%%\n\
    Exit with WARNING status if less than PERCENT of disk space is free\n\
  -c, --critical=INTEGER\n\
-   Exit with CRITICAL status if less than INTEGER kilobytes of disk are free\n\
+   Exit with CRITICAL status if less than INTEGER --units of disk are free\n\
  -c, --critical=PERCENT%%\n\
    Exit with CRITCAL status if less than PERCENT of disk space is free\n\
  -C, --clear\n\





More information about the Commits mailing list