[Nagiosplug-checkins] CVS: nagiosplug/plugins check_disk.c,1.37,1.38
Karl DeBisschop
kdebisschop at users.sourceforge.net
Wed Aug 27 20:23:32 CEST 2003
Update of /cvsroot/nagiosplug/nagiosplug/plugins
In directory sc8-pr-cvs1:/tmp/cvs-serv9578
Modified Files:
check_disk.c
Log Message:
add perf data
Index: check_disk.c
===================================================================
RCS file: /cvsroot/nagiosplug/nagiosplug/plugins/check_disk.c,v
retrieving revision 1.37
retrieving revision 1.38
diff -C2 -r1.37 -r1.38
*** check_disk.c 22 Aug 2003 06:22:37 -0000 1.37
--- check_disk.c 28 Aug 2003 03:22:01 -0000 1.38
***************
*** 143,146 ****
--- 143,148 ----
char *output;
char *details;
+ char *perf;
+ uintmax_t psize;
float free_space, free_space_pct, total_space;
***************
*** 149,154 ****
struct name_list *temp_list;
! output = strdup ("");
details = strdup ("");
setlocale (LC_ALL, "");
--- 151,157 ----
struct name_list *temp_list;
! output = strdup (" - free space:");
details = strdup ("");
+ perf = strdup ("");
setlocale (LC_ALL, "");
***************
*** 186,189 ****
--- 189,200 ----
disk_result = check_disk (usp, fsp.fsu_bavail);
result = max_state (disk_result, result);
+ psize = fsp.fsu_blocks*fsp.fsu_blocksize/mult;
+ asprintf (&perf, "%s %s", perf,
+ perfdata ((!strcmp(file_system, "none") || display_mntp) ? me->me_devname : me->me_mountdir,
+ fsp.fsu_bavail*fsp.fsu_blocksize/mult, units,
+ TRUE, min ((uintmax_t)psize-(uintmax_t)w_df, (uintmax_t)((1.0-w_dfp/100.0)*psize)),
+ TRUE, min ((uintmax_t)psize-(uintmax_t)c_df, (uintmax_t)((1.0-c_dfp/100.0)*psize)),
+ TRUE, 0,
+ TRUE, psize));
if (disk_result==STATE_OK && erronly && !verbose)
continue;
***************
*** 193,202 ****
total_space = (float)fsp.fsu_blocks*fsp.fsu_blocksize/mult;
if (disk_result!=STATE_OK || verbose>=0)
! asprintf (&output, ("%s [%.0f %s (%.0f%%) free on %s]"),
output,
free_space,
units,
! free_space_pct,
! (!strcmp(file_system, "none") || display_mntp) ? me->me_devname : me->me_mountdir);
asprintf (&details, _("%s\n\
%.0f of %.0f %s (%.0f%%) free on %s (type %s mounted on %s) warn:%lu crit:%lu warn%%:%.0f%% crit%%:%.0f%%"),
--- 204,213 ----
total_space = (float)fsp.fsu_blocks*fsp.fsu_blocksize/mult;
if (disk_result!=STATE_OK || verbose>=0)
! asprintf (&output, ("%s %s %.0f %s (%.0f%%);"),
output,
+ (!strcmp(file_system, "none") || display_mntp) ? me->me_devname : me->me_mountdir,
free_space,
units,
! free_space_pct);
asprintf (&details, _("%s\n\
%.0f of %.0f %s (%.0f%%) free on %s (type %s mounted on %s) warn:%lu crit:%lu warn%%:%.0f%% crit%%:%.0f%%"),
***************
*** 208,211 ****
--- 219,224 ----
}
+ asprintf (&output, "%s|%s", output, perf);
+
if (verbose > 2)
asprintf (&output, "%s%s", output, details);
***************
*** 221,226 ****
}
! die (result, "DISK %s%s%s\n", state_text (result), output, details);
! return STATE_UNKNOWN;
}
--- 234,239 ----
}
! printf ("DISK %s%s\n", state_text (result), output);
! return result;
}
***************
*** 508,516 ****
int result = STATE_UNKNOWN;
/* check the percent used space against thresholds */
! if (usp >= 0.0 && usp >= (100.0 - c_dfp))
result = STATE_CRITICAL;
else if (c_df > 0 && free_disk <= c_df)
result = STATE_CRITICAL;
! else if (usp >= 0.0 && usp >= (100.0 - w_dfp))
result = STATE_WARNING;
else if (w_df > 0 && free_disk <= w_df)
--- 521,529 ----
int result = STATE_UNKNOWN;
/* check the percent used space against thresholds */
! if (usp >= 0.0 && c_dfp >=0.0 && usp >= (100.0 - c_dfp))
result = STATE_CRITICAL;
else if (c_df > 0 && free_disk <= c_df)
result = STATE_CRITICAL;
! else if (usp >= 0.0 && w_dfp >=0.0 && usp >= (100.0 - w_dfp))
result = STATE_WARNING;
else if (w_df > 0 && free_disk <= w_df)
More information about the Commits
mailing list