diff options
Diffstat (limited to 'web/attachments/412453-check_disk.diff')
-rw-r--r-- | web/attachments/412453-check_disk.diff | 59 |
1 files changed, 59 insertions, 0 deletions
diff --git a/web/attachments/412453-check_disk.diff b/web/attachments/412453-check_disk.diff new file mode 100644 index 0000000..0d72272 --- /dev/null +++ b/web/attachments/412453-check_disk.diff | |||
@@ -0,0 +1,59 @@ | |||
1 | commit 81feafc3746e7e63d9dea923d56b327b7d134f3b | ||
2 | Author: Alex Dehnert <adehnert@mit.edu> | ||
3 | Date: Mon May 23 03:50:26 2011 -0400 | ||
4 | |||
5 | check_disk: Use multiline output format | ||
6 | |||
7 | diff --git a/plugins/check_disk.c b/plugins/check_disk.c | ||
8 | index f889764..f6e9e5b 100644 | ||
9 | --- a/plugins/check_disk.c | ||
10 | +++ b/plugins/check_disk.c | ||
11 | @@ -159,6 +159,8 @@ main (int argc, char **argv) | ||
12 | int result = STATE_UNKNOWN; | ||
13 | int disk_result = STATE_UNKNOWN; | ||
14 | char *output; | ||
15 | + char *output_long; | ||
16 | + char *line; | ||
17 | char *details; | ||
18 | char *perf; | ||
19 | char *preamble; | ||
20 | @@ -173,6 +175,7 @@ main (int argc, char **argv) | ||
21 | |||
22 | preamble = strdup (" - free space:"); | ||
23 | output = strdup (""); | ||
24 | + output_long = strdup (""); | ||
25 | details = strdup (""); | ||
26 | perf = strdup (""); | ||
27 | stat_buf = malloc(sizeof *stat_buf); | ||
28 | @@ -331,17 +334,19 @@ main (int argc, char **argv) | ||
29 | if (disk_result==STATE_OK && erronly && !verbose) | ||
30 | continue; | ||
31 | |||
32 | - asprintf (&output, "%s %s %.0f %s (%.0f%%", | ||
33 | - output, | ||
34 | + line = strdup (""); | ||
35 | + asprintf (&line, "%s %.0f %s (%.0f%%", | ||
36 | (!strcmp(me->me_mountdir, "none") || display_mntp) ? me->me_devname : me->me_mountdir, | ||
37 | path->dfree_units, | ||
38 | units, | ||
39 | path->dfree_pct); | ||
40 | if (path->dused_inodes_percent < 0) { | ||
41 | - asprintf(&output, "%s inode=-);", output); | ||
42 | + asprintf(&line, "%s inode=-)", line); | ||
43 | } else { | ||
44 | - asprintf(&output, "%s inode=%.0f%%);", output, path->dfree_inodes_percent ); | ||
45 | + asprintf(&line, "%s inode=%.0f%%)", line, path->dfree_inodes_percent ); | ||
46 | } | ||
47 | + asprintf(&output, "%s %s:", output, line); | ||
48 | + asprintf(&output_long, "%s%s\n", output_long, line); | ||
49 | |||
50 | /* TODO: Need to do a similar debug line | ||
51 | asprintf (&details, _("%s\n\ | ||
52 | @@ -360,6 +365,7 @@ main (int argc, char **argv) | ||
53 | |||
54 | |||
55 | printf ("DISK %s%s%s|%s\n", state_text (result), (erronly && result==STATE_OK) ? "" : preamble, output, perf); | ||
56 | + printf ("%s", output_long); | ||
57 | return result; | ||
58 | } | ||
59 | |||