summaryrefslogtreecommitdiffstats
path: root/web/attachments/382256-nagios-plugins-check_disk_usage.patch
diff options
context:
space:
mode:
Diffstat (limited to 'web/attachments/382256-nagios-plugins-check_disk_usage.patch')
-rw-r--r--web/attachments/382256-nagios-plugins-check_disk_usage.patch89
1 files changed, 89 insertions, 0 deletions
diff --git a/web/attachments/382256-nagios-plugins-check_disk_usage.patch b/web/attachments/382256-nagios-plugins-check_disk_usage.patch
new file mode 100644
index 0000000..8beefc1
--- /dev/null
+++ b/web/attachments/382256-nagios-plugins-check_disk_usage.patch
@@ -0,0 +1,89 @@
1diff -urN nagios-plugins-1.4.15/plugins/check_disk.c nagios-plugins-1.4.15.new/plugins/check_disk.c
2--- nagios-plugins-1.4.15/plugins/check_disk.c 2010-07-27 22:47:16.000000000 +0200
3+++ nagios-plugins-1.4.15.new/plugins/check_disk.c 2010-08-04 13:49:46.000000000 +0200
4@@ -148,6 +148,7 @@
5 int path_selected = FALSE;
6 char *group = NULL;
7 struct stat *stat_buf;
8+int output_usage = FALSE;
9
10
11 int
12@@ -173,7 +174,6 @@
13 struct parameter_list *temp_list, *path;
14 struct name_list *seen = NULL;
15
16- preamble = strdup (" - free space:");
17 output = strdup ("");
18 details = strdup ("");
19 perf = strdup ("");
20@@ -191,6 +191,12 @@
21 if (process_arguments (argc, argv) == ERROR)
22 usage4 (_("Could not parse arguments"));
23
24+ if (output_usage) {
25+ preamble = strdup (" - used space:");
26+ } else {
27+ preamble = strdup (" - free space:");
28+ }
29+
30 /* If a list of paths has not been selected, find entire
31 mount list and create list of paths
32 */
33@@ -392,9 +398,9 @@
34 asprintf (&output, "%s %s %.0f %s (%.0f%%",
35 output,
36 (!strcmp(me->me_mountdir, "none") || display_mntp) ? me->me_devname : me->me_mountdir,
37- dfree_units,
38+ output_usage ? dused_units : dfree_units,
39 units,
40- dfree_pct);
41+ output_usage ? 100-dfree_pct : dfree_pct);
42 if (dused_inodes_percent < 0) {
43 asprintf(&output, "%s inode=-);", output);
44 } else {
45@@ -495,6 +501,7 @@
46 {"verbose", no_argument, 0, 'v'},
47 {"quiet", no_argument, 0, 'q'},
48 {"clear", no_argument, 0, 'C'},
49+ {"usage", no_argument, 0, 'U'},
50 {"version", no_argument, 0, 'V'},
51 {"help", no_argument, 0, 'h'},
52 {0, 0, 0, 0}
53@@ -510,7 +517,7 @@
54 strcpy (argv[c], "-t");
55
56 while (1) {
57- c = getopt_long (argc, argv, "+?VqhveCt:c:w:K:W:u:p:x:X:mklLg:R:r:i:I:MEA", longopts, &option);
58+ c = getopt_long (argc, argv, "+?VqhveUCt:c:w:K:W:u:p:x:X:mklLg:R:r:i:I:MEA", longopts, &option);
59
60 if (c == -1 || c == EOF)
61 break;
62@@ -782,6 +789,9 @@
63 path_selected = FALSE;
64 group = NULL;
65 break;
66+ case 'U': /* display used space */
67+ output_usage = TRUE;
68+ break;
69 case 'V': /* version */
70 print_revision (progname, NP_VERSION);
71 exit (STATE_OK);
72@@ -958,6 +968,8 @@
73 printf (UT_VERBOSE);
74 printf (" %s\n", "-X, --exclude-type=TYPE");
75 printf (" %s\n", _("Ignore all filesystems of indicated type (may be repeated)"));
76+ printf (" %s\n", "-U, --usage");
77+ printf (" %s\n", _("Output used space not free space"));
78
79 printf ("\n");
80 printf ("%s\n", _("Examples:"));
81@@ -980,7 +992,7 @@
82 printf ("%s\n", _("Usage:"));
83 printf (" %s -w limit -c limit [-W limit] [-K limit] {-p path | -x device}\n", progname);
84 printf ("[-C] [-E] [-e] [-g group ] [-k] [-l] [-M] [-m] [-R path ] [-r path ]\n");
85- printf ("[-t timeout] [-u unit] [-v] [-X type]\n");
86+ printf ("[-t timeout] [-u unit] [-v] [-X type] [-U]\n");
87 }
88
89 void