diff options
Diffstat (limited to 'plugins/t')
0 files changed, 0 insertions, 0 deletions
diff --git a/plugins/check_disk.c b/plugins/check_disk.c index d0431d9..62858b5 100644 --- a/plugins/check_disk.c +++ b/plugins/check_disk.c | |||
@@ -47,8 +47,8 @@ const char *options = "\ | |||
47 | Same as '--units MB'\n\ | 47 | Same as '--units MB'\n\ |
48 | -l, --local\n\ | 48 | -l, --local\n\ |
49 | Only check local filesystems\n\ | 49 | Only check local filesystems\n\ |
50 | -p, --path=PATH, --partition=PARTTION\n\ | 50 | -p, --path=PATH, --partition=PARTITION\n\ |
51 | Path or partition (may be repeated)\n\ | 51 | Path or partition (may be repeated)\n\ |
52 | -x, --exclude_device=PATH <STRING>\n\ | 52 | -x, --exclude_device=PATH <STRING>\n\ |
53 | Ignore device (only works if -p unspecified)\n\ | 53 | Ignore device (only works if -p unspecified)\n\ |
54 | -X, --exclude-type=TYPE <STRING>\n\ | 54 | -X, --exclude-type=TYPE <STRING>\n\ |
@@ -186,8 +186,9 @@ main (int argc, char **argv) | |||
186 | char mntp[MAX_INPUT_BUFFER]; | 186 | char mntp[MAX_INPUT_BUFFER]; |
187 | char *output = ""; | 187 | char *output = ""; |
188 | char *details = ""; | 188 | char *details = ""; |
189 | float free_space, free_space_pct, total_space; | ||
189 | 190 | ||
190 | struct mount_entry *me; | 191 | struct mount_entry *me; |
191 | struct fs_usage fsp; | 192 | struct fs_usage fsp; |
192 | char *disk; | 193 | char *disk; |
193 | 194 | ||
@@ -196,7 +197,7 @@ main (int argc, char **argv) | |||
196 | if (process_arguments (argc, argv) != OK) | 197 | if (process_arguments (argc, argv) != OK) |
197 | usage ("Could not parse arguments\n"); | 198 | usage ("Could not parse arguments\n"); |
198 | 199 | ||
199 | for (me = mount_list; me; me = me->me_next) { | 200 | for (me = mount_list; me; me = me->me_next) { |
200 | 201 | ||
201 | if ((dev_select_list && | 202 | if ((dev_select_list && |
202 | walk_name_list (dev_select_list, me->me_devname)) || | 203 | walk_name_list (dev_select_list, me->me_devname)) || |
@@ -225,19 +226,22 @@ main (int argc, char **argv) | |||
225 | if (disk_result==STATE_OK && erronly && !verbose) | 226 | if (disk_result==STATE_OK && erronly && !verbose) |
226 | continue; | 227 | continue; |
227 | 228 | ||
228 | if (disk_result!=STATE_OK || verbose>=0) | 229 | free_space = (float)fsp.fsu_bavail*fsp.fsu_blocksize/mult; |
229 | asprintf (&output, "%s [%llu %s (%2.0f%%) free on %s]", | 230 | free_space_pct = (float)fsp.fsu_bavail*100/fsp.fsu_blocks; |
231 | total_space = (float)fsp.fsu_blocks*fsp.fsu_blocksize/mult; | ||
232 | if (disk_result!=STATE_OK || verbose>=0) | ||
233 | asprintf (&output, "%s [%.0f %s (%2.0f%%) free on %s]", | ||
230 | output, | 234 | output, |
231 | fsp.fsu_bavail*fsp.fsu_blocksize/mult, | 235 | free_space, |
232 | units, | 236 | units, |
233 | (double)fsp.fsu_bavail*100/fsp.fsu_blocks, | 237 | free_space_pct, |
234 | (!strcmp(file_system, "none") || display_mntp) ? me->me_devname : me->me_mountdir); | 238 | (!strcmp(file_system, "none") || display_mntp) ? me->me_devname : me->me_mountdir); |
235 | asprintf (&details, "%s\n%llu of %llu %s (%2.0f%%) free on %s (type %s mounted on %s)", | 239 | asprintf (&details, "%s\n%.0f of %.0f %s (%2.0f%%) free on %s (type %s mounted on %s)", |
236 | details, | 240 | details, |
237 | fsp.fsu_bavail*fsp.fsu_blocksize/mult, | 241 | free_space, |
238 | fsp.fsu_blocks*fsp.fsu_blocksize/mult, | 242 | total_space, |
239 | units, | 243 | units, |
240 | (double)fsp.fsu_bavail*100/fsp.fsu_blocks, | 244 | free_space_pct, |
241 | me->me_devname, | 245 | me->me_devname, |
242 | me->me_type, | 246 | me->me_type, |
243 | me->me_mountdir); | 247 | me->me_mountdir); |