diff options
author | RincewindsHat <12514511+RincewindsHat@users.noreply.github.com> | 2024-10-31 11:15:15 (GMT) |
---|---|---|
committer | RincewindsHat <12514511+RincewindsHat@users.noreply.github.com> | 2024-10-31 11:15:15 (GMT) |
commit | cc45c9772b4a7df9cd2231fa8f36c33ca09495a7 (patch) | |
tree | dcb65780d96e967e4a79042c060d8e0ee1529f38 /plugins | |
parent | 4db8808a5120778004b8ade834f30d0f4b3db914 (diff) | |
download | monitoring-plugins-cc45c9772b4a7df9cd2231fa8f36c33ca09495a7.tar.gz |
check_mrtg: clang-format
Diffstat (limited to 'plugins')
-rw-r--r-- | plugins/check_mrtg.c | 379 |
1 files changed, 172 insertions, 207 deletions
diff --git a/plugins/check_mrtg.c b/plugins/check_mrtg.c index 826b77e..e4d3243 100644 --- a/plugins/check_mrtg.c +++ b/plugins/check_mrtg.c | |||
@@ -1,33 +1,33 @@ | |||
1 | /***************************************************************************** | 1 | /***************************************************************************** |
2 | * | 2 | * |
3 | * Monitoring check_mrtg plugin | 3 | * Monitoring check_mrtg plugin |
4 | * | 4 | * |
5 | * License: GPL | 5 | * License: GPL |
6 | * Copyright (c) 1999-2007 Monitoring Plugins Development Team | 6 | * Copyright (c) 1999-2007 Monitoring Plugins Development Team |
7 | * | 7 | * |
8 | * Description: | 8 | * Description: |
9 | * | 9 | * |
10 | * This file contains the check_mrtg plugin | 10 | * This file contains the check_mrtg plugin |
11 | * | 11 | * |
12 | * This plugin will check either the average or maximum value of one of the | 12 | * This plugin will check either the average or maximum value of one of the |
13 | * two variables recorded in an MRTG log file. | 13 | * two variables recorded in an MRTG log file. |
14 | * | 14 | * |
15 | * | 15 | * |
16 | * This program is free software: you can redistribute it and/or modify | 16 | * This program is free software: you can redistribute it and/or modify |
17 | * it under the terms of the GNU General Public License as published by | 17 | * it under the terms of the GNU General Public License as published by |
18 | * the Free Software Foundation, either version 3 of the License, or | 18 | * the Free Software Foundation, either version 3 of the License, or |
19 | * (at your option) any later version. | 19 | * (at your option) any later version. |
20 | * | 20 | * |
21 | * This program is distributed in the hope that it will be useful, | 21 | * This program is distributed in the hope that it will be useful, |
22 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | 22 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
23 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 23 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
24 | * GNU General Public License for more details. | 24 | * GNU General Public License for more details. |
25 | * | 25 | * |
26 | * You should have received a copy of the GNU General Public License | 26 | * You should have received a copy of the GNU General Public License |
27 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | 27 | * along with this program. If not, see <http://www.gnu.org/licenses/>. |
28 | * | 28 | * |
29 | * | 29 | * |
30 | *****************************************************************************/ | 30 | *****************************************************************************/ |
31 | 31 | ||
32 | const char *progname = "check_mrtg"; | 32 | const char *progname = "check_mrtg"; |
33 | const char *copyright = "1999-2007"; | 33 | const char *copyright = "1999-2007"; |
@@ -36,10 +36,10 @@ const char *email = "devel@monitoring-plugins.org"; | |||
36 | #include "common.h" | 36 | #include "common.h" |
37 | #include "utils.h" | 37 | #include "utils.h" |
38 | 38 | ||
39 | int process_arguments (int, char **); | 39 | int process_arguments(int, char **); |
40 | int validate_arguments (void); | 40 | int validate_arguments(void); |
41 | void print_help (void); | 41 | void print_help(void); |
42 | void print_usage (void); | 42 | void print_usage(void); |
43 | 43 | ||
44 | char *log_file = NULL; | 44 | char *log_file = NULL; |
45 | int expire_minutes = 0; | 45 | int expire_minutes = 0; |
@@ -50,9 +50,7 @@ unsigned long value_critical_threshold = 0L; | |||
50 | char *label; | 50 | char *label; |
51 | char *units; | 51 | char *units; |
52 | 52 | ||
53 | int | 53 | int main(int argc, char **argv) { |
54 | main (int argc, char **argv) | ||
55 | { | ||
56 | int result = STATE_OK; | 54 | int result = STATE_OK; |
57 | FILE *fp; | 55 | FILE *fp; |
58 | int line; | 56 | int line; |
@@ -64,25 +62,25 @@ main (int argc, char **argv) | |||
64 | unsigned long maximum_value_rate = 0L; | 62 | unsigned long maximum_value_rate = 0L; |
65 | unsigned long rate = 0L; | 63 | unsigned long rate = 0L; |
66 | 64 | ||
67 | setlocale (LC_ALL, ""); | 65 | setlocale(LC_ALL, ""); |
68 | bindtextdomain (PACKAGE, LOCALEDIR); | 66 | bindtextdomain(PACKAGE, LOCALEDIR); |
69 | textdomain (PACKAGE); | 67 | textdomain(PACKAGE); |
70 | 68 | ||
71 | /* Parse extra opts if any */ | 69 | /* Parse extra opts if any */ |
72 | argv=np_extra_opts (&argc, argv, progname); | 70 | argv = np_extra_opts(&argc, argv, progname); |
73 | 71 | ||
74 | if (process_arguments (argc, argv) == ERROR) | 72 | if (process_arguments(argc, argv) == ERROR) |
75 | usage4 (_("Could not parse arguments\n")); | 73 | usage4(_("Could not parse arguments\n")); |
76 | 74 | ||
77 | /* open the MRTG log file for reading */ | 75 | /* open the MRTG log file for reading */ |
78 | fp = fopen (log_file, "r"); | 76 | fp = fopen(log_file, "r"); |
79 | if (fp == NULL) { | 77 | if (fp == NULL) { |
80 | printf (_("Unable to open MRTG log file\n")); | 78 | printf(_("Unable to open MRTG log file\n")); |
81 | return STATE_UNKNOWN; | 79 | return STATE_UNKNOWN; |
82 | } | 80 | } |
83 | 81 | ||
84 | line = 0; | 82 | line = 0; |
85 | while (fgets (input_buffer, MAX_INPUT_BUFFER - 1, fp)) { | 83 | while (fgets(input_buffer, MAX_INPUT_BUFFER - 1, fp)) { |
86 | 84 | ||
87 | line++; | 85 | line++; |
88 | 86 | ||
@@ -95,45 +93,43 @@ main (int argc, char **argv) | |||
95 | break; | 93 | break; |
96 | 94 | ||
97 | /* grab the timestamp */ | 95 | /* grab the timestamp */ |
98 | temp_buffer = strtok (input_buffer, " "); | 96 | temp_buffer = strtok(input_buffer, " "); |
99 | timestamp = strtoul (temp_buffer, NULL, 10); | 97 | timestamp = strtoul(temp_buffer, NULL, 10); |
100 | 98 | ||
101 | /* grab the average value 1 rate */ | 99 | /* grab the average value 1 rate */ |
102 | temp_buffer = strtok (NULL, " "); | 100 | temp_buffer = strtok(NULL, " "); |
103 | if (variable_number == 1) | 101 | if (variable_number == 1) |
104 | average_value_rate = strtoul (temp_buffer, NULL, 10); | 102 | average_value_rate = strtoul(temp_buffer, NULL, 10); |
105 | 103 | ||
106 | /* grab the average value 2 rate */ | 104 | /* grab the average value 2 rate */ |
107 | temp_buffer = strtok (NULL, " "); | 105 | temp_buffer = strtok(NULL, " "); |
108 | if (variable_number == 2) | 106 | if (variable_number == 2) |
109 | average_value_rate = strtoul (temp_buffer, NULL, 10); | 107 | average_value_rate = strtoul(temp_buffer, NULL, 10); |
110 | 108 | ||
111 | /* grab the maximum value 1 rate */ | 109 | /* grab the maximum value 1 rate */ |
112 | temp_buffer = strtok (NULL, " "); | 110 | temp_buffer = strtok(NULL, " "); |
113 | if (variable_number == 1) | 111 | if (variable_number == 1) |
114 | maximum_value_rate = strtoul (temp_buffer, NULL, 10); | 112 | maximum_value_rate = strtoul(temp_buffer, NULL, 10); |
115 | 113 | ||
116 | /* grab the maximum value 2 rate */ | 114 | /* grab the maximum value 2 rate */ |
117 | temp_buffer = strtok (NULL, " "); | 115 | temp_buffer = strtok(NULL, " "); |
118 | if (variable_number == 2) | 116 | if (variable_number == 2) |
119 | maximum_value_rate = strtoul (temp_buffer, NULL, 10); | 117 | maximum_value_rate = strtoul(temp_buffer, NULL, 10); |
120 | } | 118 | } |
121 | 119 | ||
122 | /* close the log file */ | 120 | /* close the log file */ |
123 | fclose (fp); | 121 | fclose(fp); |
124 | 122 | ||
125 | /* if we couldn't read enough data, return an unknown error */ | 123 | /* if we couldn't read enough data, return an unknown error */ |
126 | if (line <= 2) { | 124 | if (line <= 2) { |
127 | printf (_("Unable to process MRTG log file\n")); | 125 | printf(_("Unable to process MRTG log file\n")); |
128 | return STATE_UNKNOWN; | 126 | return STATE_UNKNOWN; |
129 | } | 127 | } |
130 | 128 | ||
131 | /* make sure the MRTG data isn't too old */ | 129 | /* make sure the MRTG data isn't too old */ |
132 | time (¤t_time); | 130 | time(¤t_time); |
133 | if (expire_minutes > 0 | 131 | if (expire_minutes > 0 && (current_time - timestamp) > (expire_minutes * 60)) { |
134 | && (current_time - timestamp) > (expire_minutes * 60)) { | 132 | printf(_("MRTG data has expired (%d minutes old)\n"), (int)((current_time - timestamp) / 60)); |
135 | printf (_("MRTG data has expired (%d minutes old)\n"), | ||
136 | (int) ((current_time - timestamp) / 60)); | ||
137 | return STATE_WARNING; | 133 | return STATE_WARNING; |
138 | } | 134 | } |
139 | 135 | ||
@@ -148,98 +144,80 @@ main (int argc, char **argv) | |||
148 | else if (rate > value_warning_threshold) | 144 | else if (rate > value_warning_threshold) |
149 | result = STATE_WARNING; | 145 | result = STATE_WARNING; |
150 | 146 | ||
151 | printf("%s. %s = %lu %s|%s\n", | 147 | printf("%s. %s = %lu %s|%s\n", (use_average) ? _("Avg") : _("Max"), label, rate, units, |
152 | (use_average) ? _("Avg") : _("Max"), | 148 | perfdata(label, (long)rate, units, (int)value_warning_threshold, (long)value_warning_threshold, (int)value_critical_threshold, |
153 | label, rate, units, | 149 | (long)value_critical_threshold, 0, 0, 0, 0)); |
154 | perfdata(label, (long) rate, units, | ||
155 | (int) value_warning_threshold, (long) value_warning_threshold, | ||
156 | (int) value_critical_threshold, (long) value_critical_threshold, | ||
157 | 0, 0, 0, 0)); | ||
158 | 150 | ||
159 | return result; | 151 | return result; |
160 | } | 152 | } |
161 | 153 | ||
162 | |||
163 | |||
164 | /* process command-line arguments */ | 154 | /* process command-line arguments */ |
165 | int | 155 | int process_arguments(int argc, char **argv) { |
166 | process_arguments (int argc, char **argv) | ||
167 | { | ||
168 | int c; | 156 | int c; |
169 | 157 | ||
170 | int option = 0; | 158 | int option = 0; |
171 | static struct option longopts[] = { | 159 | static struct option longopts[] = { |
172 | {"logfile", required_argument, 0, 'F'}, | 160 | {"logfile", required_argument, 0, 'F'}, {"expires", required_argument, 0, 'e'}, {"aggregation", required_argument, 0, 'a'}, |
173 | {"expires", required_argument, 0, 'e'}, | 161 | {"variable", required_argument, 0, 'v'}, {"critical", required_argument, 0, 'c'}, {"warning", required_argument, 0, 'w'}, |
174 | {"aggregation", required_argument, 0, 'a'}, | 162 | {"label", required_argument, 0, 'l'}, {"units", required_argument, 0, 'u'}, {"variable", required_argument, 0, 'v'}, |
175 | {"variable", required_argument, 0, 'v'}, | 163 | {"version", no_argument, 0, 'V'}, {"help", no_argument, 0, 'h'}, {0, 0, 0, 0}}; |
176 | {"critical", required_argument, 0, 'c'}, | ||
177 | {"warning", required_argument, 0, 'w'}, | ||
178 | {"label", required_argument, 0, 'l'}, | ||
179 | {"units", required_argument, 0, 'u'}, | ||
180 | {"variable", required_argument, 0, 'v'}, | ||
181 | {"version", no_argument, 0, 'V'}, | ||
182 | {"help", no_argument, 0, 'h'}, | ||
183 | {0, 0, 0, 0} | ||
184 | }; | ||
185 | 164 | ||
186 | if (argc < 2) | 165 | if (argc < 2) |
187 | return ERROR; | 166 | return ERROR; |
188 | 167 | ||
189 | for (c = 1; c < argc; c++) { | 168 | for (c = 1; c < argc; c++) { |
190 | if (strcmp ("-to", argv[c]) == 0) | 169 | if (strcmp("-to", argv[c]) == 0) |
191 | strcpy (argv[c], "-t"); | 170 | strcpy(argv[c], "-t"); |
192 | else if (strcmp ("-wt", argv[c]) == 0) | 171 | else if (strcmp("-wt", argv[c]) == 0) |
193 | strcpy (argv[c], "-w"); | 172 | strcpy(argv[c], "-w"); |
194 | else if (strcmp ("-ct", argv[c]) == 0) | 173 | else if (strcmp("-ct", argv[c]) == 0) |
195 | strcpy (argv[c], "-c"); | 174 | strcpy(argv[c], "-c"); |
196 | } | 175 | } |
197 | 176 | ||
198 | while (1) { | 177 | while (1) { |
199 | c = getopt_long (argc, argv, "hVF:e:a:v:c:w:l:u:", longopts, | 178 | c = getopt_long(argc, argv, "hVF:e:a:v:c:w:l:u:", longopts, &option); |
200 | &option); | ||
201 | 179 | ||
202 | if (c == -1 || c == EOF) | 180 | if (c == -1 || c == EOF) |
203 | break; | 181 | break; |
204 | 182 | ||
205 | switch (c) { | 183 | switch (c) { |
206 | case 'F': /* input file */ | 184 | case 'F': /* input file */ |
207 | log_file = optarg; | 185 | log_file = optarg; |
208 | break; | 186 | break; |
209 | case 'e': /* ups name */ | 187 | case 'e': /* ups name */ |
210 | expire_minutes = atoi (optarg); | 188 | expire_minutes = atoi(optarg); |
211 | break; | 189 | break; |
212 | case 'a': /* port */ | 190 | case 'a': /* port */ |
213 | if (!strcmp (optarg, "MAX")) | 191 | if (!strcmp(optarg, "MAX")) |
214 | use_average = false; | 192 | use_average = false; |
215 | else | 193 | else |
216 | use_average = true; | 194 | use_average = true; |
217 | break; | 195 | break; |
218 | case 'v': | 196 | case 'v': |
219 | variable_number = atoi (optarg); | 197 | variable_number = atoi(optarg); |
220 | if (variable_number < 1 || variable_number > 2) | 198 | if (variable_number < 1 || variable_number > 2) |
221 | usage4 (_("Invalid variable number")); | 199 | usage4(_("Invalid variable number")); |
222 | break; | 200 | break; |
223 | case 'w': /* critical time threshold */ | 201 | case 'w': /* critical time threshold */ |
224 | value_warning_threshold = strtoul (optarg, NULL, 10); | 202 | value_warning_threshold = strtoul(optarg, NULL, 10); |
225 | break; | 203 | break; |
226 | case 'c': /* warning time threshold */ | 204 | case 'c': /* warning time threshold */ |
227 | value_critical_threshold = strtoul (optarg, NULL, 10); | 205 | value_critical_threshold = strtoul(optarg, NULL, 10); |
228 | break; | 206 | break; |
229 | case 'l': /* label */ | 207 | case 'l': /* label */ |
230 | label = optarg; | 208 | label = optarg; |
231 | break; | 209 | break; |
232 | case 'u': /* timeout */ | 210 | case 'u': /* timeout */ |
233 | units = optarg; | 211 | units = optarg; |
234 | break; | 212 | break; |
235 | case 'V': /* version */ | 213 | case 'V': /* version */ |
236 | print_revision (progname, NP_VERSION); | 214 | print_revision(progname, NP_VERSION); |
237 | exit (STATE_UNKNOWN); | 215 | exit(STATE_UNKNOWN); |
238 | case 'h': /* help */ | 216 | case 'h': /* help */ |
239 | print_help (); | 217 | print_help(); |
240 | exit (STATE_UNKNOWN); | 218 | exit(STATE_UNKNOWN); |
241 | case '?': /* help */ | 219 | case '?': /* help */ |
242 | usage5 (); | 220 | usage5(); |
243 | } | 221 | } |
244 | } | 222 | } |
245 | 223 | ||
@@ -249,137 +227,124 @@ process_arguments (int argc, char **argv) | |||
249 | } | 227 | } |
250 | 228 | ||
251 | if (expire_minutes <= 0 && argc > c) { | 229 | if (expire_minutes <= 0 && argc > c) { |
252 | if (is_intpos (argv[c])) | 230 | if (is_intpos(argv[c])) |
253 | expire_minutes = atoi (argv[c++]); | 231 | expire_minutes = atoi(argv[c++]); |
254 | else | 232 | else |
255 | die (STATE_UNKNOWN, | 233 | die(STATE_UNKNOWN, _("%s is not a valid expiration time\nUse '%s -h' for additional help\n"), argv[c], progname); |
256 | _("%s is not a valid expiration time\nUse '%s -h' for additional help\n"), | ||
257 | argv[c], progname); | ||
258 | } | 234 | } |
259 | 235 | ||
260 | if (argc > c && strcmp (argv[c], "MAX") == 0) { | 236 | if (argc > c && strcmp(argv[c], "MAX") == 0) { |
261 | use_average = false; | 237 | use_average = false; |
262 | c++; | 238 | c++; |
263 | } | 239 | } else if (argc > c && strcmp(argv[c], "AVG") == 0) { |
264 | else if (argc > c && strcmp (argv[c], "AVG") == 0) { | ||
265 | use_average = true; | 240 | use_average = true; |
266 | c++; | 241 | c++; |
267 | } | 242 | } |
268 | 243 | ||
269 | if (argc > c && variable_number == -1) { | 244 | if (argc > c && variable_number == -1) { |
270 | variable_number = atoi (argv[c++]); | 245 | variable_number = atoi(argv[c++]); |
271 | if (variable_number < 1 || variable_number > 2) { | 246 | if (variable_number < 1 || variable_number > 2) { |
272 | printf ("%s :", argv[c]); | 247 | printf("%s :", argv[c]); |
273 | usage (_("Invalid variable number\n")); | 248 | usage(_("Invalid variable number\n")); |
274 | } | 249 | } |
275 | } | 250 | } |
276 | 251 | ||
277 | if (argc > c && value_warning_threshold == 0) { | 252 | if (argc > c && value_warning_threshold == 0) { |
278 | value_warning_threshold = strtoul (argv[c++], NULL, 10); | 253 | value_warning_threshold = strtoul(argv[c++], NULL, 10); |
279 | } | 254 | } |
280 | 255 | ||
281 | if (argc > c && value_critical_threshold == 0) { | 256 | if (argc > c && value_critical_threshold == 0) { |
282 | value_critical_threshold = strtoul (argv[c++], NULL, 10); | 257 | value_critical_threshold = strtoul(argv[c++], NULL, 10); |
283 | } | 258 | } |
284 | 259 | ||
285 | if (argc > c && strlen (label) == 0) { | 260 | if (argc > c && strlen(label) == 0) { |
286 | label = argv[c++]; | 261 | label = argv[c++]; |
287 | } | 262 | } |
288 | 263 | ||
289 | if (argc > c && strlen (units) == 0) { | 264 | if (argc > c && strlen(units) == 0) { |
290 | units = argv[c++]; | 265 | units = argv[c++]; |
291 | } | 266 | } |
292 | 267 | ||
293 | return validate_arguments (); | 268 | return validate_arguments(); |
294 | } | 269 | } |
295 | 270 | ||
296 | int | 271 | int validate_arguments(void) { |
297 | validate_arguments (void) | ||
298 | { | ||
299 | if (variable_number == -1) | 272 | if (variable_number == -1) |
300 | usage4 (_("You must supply the variable number")); | 273 | usage4(_("You must supply the variable number")); |
301 | 274 | ||
302 | if (label == NULL) | 275 | if (label == NULL) |
303 | label = strdup ("value"); | 276 | label = strdup("value"); |
304 | 277 | ||
305 | if (units == NULL) | 278 | if (units == NULL) |
306 | units = strdup (""); | 279 | units = strdup(""); |
307 | 280 | ||
308 | return OK; | 281 | return OK; |
309 | } | 282 | } |
310 | 283 | ||
311 | 284 | void print_help(void) { | |
312 | 285 | print_revision(progname, NP_VERSION); | |
313 | void | 286 | |
314 | print_help (void) | 287 | printf("Copyright (c) 1999 Ethan Galstad <nagios@nagios.org>\n"); |
315 | { | 288 | printf(COPYRIGHT, copyright, email); |
316 | print_revision (progname, NP_VERSION); | 289 | |
317 | 290 | printf("%s\n", _("This plugin will check either the average or maximum value of one of the")); | |
318 | printf ("Copyright (c) 1999 Ethan Galstad <nagios@nagios.org>\n"); | 291 | printf("%s\n", _("two variables recorded in an MRTG log file.")); |
319 | printf (COPYRIGHT, copyright, email); | 292 | |
320 | 293 | printf("\n\n"); | |
321 | printf ("%s\n", _("This plugin will check either the average or maximum value of one of the")); | 294 | |
322 | printf ("%s\n", _("two variables recorded in an MRTG log file.")); | 295 | print_usage(); |
323 | 296 | ||
324 | printf ("\n\n"); | 297 | printf(UT_HELP_VRSN); |
325 | 298 | printf(UT_EXTRA_OPTS); | |
326 | print_usage (); | 299 | |
327 | 300 | printf(" %s\n", "-F, --logfile=FILE"); | |
328 | printf (UT_HELP_VRSN); | 301 | printf(" %s\n", _("The MRTG log file containing the data you want to monitor")); |
329 | printf (UT_EXTRA_OPTS); | 302 | printf(" %s\n", "-e, --expires=MINUTES"); |
330 | 303 | printf(" %s\n", _("Minutes before MRTG data is considered to be too old")); | |
331 | printf (" %s\n", "-F, --logfile=FILE"); | 304 | printf(" %s\n", "-a, --aggregation=AVG|MAX"); |
332 | printf (" %s\n", _("The MRTG log file containing the data you want to monitor")); | 305 | printf(" %s\n", _("Should we check average or maximum values?")); |
333 | printf (" %s\n", "-e, --expires=MINUTES"); | 306 | printf(" %s\n", "-v, --variable=INTEGER"); |
334 | printf (" %s\n", _("Minutes before MRTG data is considered to be too old")); | 307 | printf(" %s\n", _("Which variable set should we inspect? (1 or 2)")); |
335 | printf (" %s\n", "-a, --aggregation=AVG|MAX"); | 308 | printf(" %s\n", "-w, --warning=INTEGER"); |
336 | printf (" %s\n", _("Should we check average or maximum values?")); | 309 | printf(" %s\n", _("Threshold value for data to result in WARNING status")); |
337 | printf (" %s\n", "-v, --variable=INTEGER"); | 310 | printf(" %s\n", "-c, --critical=INTEGER"); |
338 | printf (" %s\n", _("Which variable set should we inspect? (1 or 2)")); | 311 | printf(" %s\n", _("Threshold value for data to result in CRITICAL status")); |
339 | printf (" %s\n", "-w, --warning=INTEGER"); | 312 | printf(" %s\n", "-l, --label=STRING"); |
340 | printf (" %s\n", _("Threshold value for data to result in WARNING status")); | 313 | printf(" %s\n", _("Type label for data (Examples: Conns, \"Processor Load\", In, Out)")); |
341 | printf (" %s\n", "-c, --critical=INTEGER"); | 314 | printf(" %s\n", "-u, --units=STRING"); |
342 | printf (" %s\n", _("Threshold value for data to result in CRITICAL status")); | 315 | printf(" %s\n", _("Option units label for data (Example: Packets/Sec, Errors/Sec,")); |
343 | printf (" %s\n", "-l, --label=STRING"); | 316 | printf(" %s\n", _("\"Bytes Per Second\", \"%% Utilization\")")); |
344 | printf (" %s\n", _("Type label for data (Examples: Conns, \"Processor Load\", In, Out)")); | 317 | |
345 | printf (" %s\n", "-u, --units=STRING"); | 318 | printf("\n"); |
346 | printf (" %s\n", _("Option units label for data (Example: Packets/Sec, Errors/Sec,")); | 319 | printf(" %s\n", _("If the value exceeds the <vwl> threshold, a WARNING status is returned. If")); |
347 | printf (" %s\n", _("\"Bytes Per Second\", \"%% Utilization\")")); | 320 | printf(" %s\n", _("the value exceeds the <vcl> threshold, a CRITICAL status is returned. If")); |
348 | 321 | printf(" %s\n", _("the data in the log file is older than <expire_minutes> old, a WARNING")); | |
349 | printf ("\n"); | 322 | printf(" %s\n", _("status is returned and a warning message is printed.")); |
350 | printf (" %s\n", _("If the value exceeds the <vwl> threshold, a WARNING status is returned. If")); | 323 | |
351 | printf (" %s\n", _("the value exceeds the <vcl> threshold, a CRITICAL status is returned. If")); | 324 | printf("\n"); |
352 | printf (" %s\n", _("the data in the log file is older than <expire_minutes> old, a WARNING")); | 325 | printf(" %s\n", _("This plugin is useful for monitoring MRTG data that does not correspond to")); |
353 | printf (" %s\n", _("status is returned and a warning message is printed.")); | 326 | printf(" %s\n", _("bandwidth usage. (Use the check_mrtgtraf plugin for monitoring bandwidth).")); |
354 | 327 | printf(" %s\n", _("It can be used to monitor any kind of data that MRTG is monitoring - errors,")); | |
355 | printf ("\n"); | 328 | printf(" %s\n", _("packets/sec, etc. I use MRTG in conjunction with the Novell NLM that allows")); |
356 | printf (" %s\n", _("This plugin is useful for monitoring MRTG data that does not correspond to")); | 329 | printf(" %s\n", _("me to track processor utilization, user connections, drive space, etc and")); |
357 | printf (" %s\n", _("bandwidth usage. (Use the check_mrtgtraf plugin for monitoring bandwidth).")); | 330 | printf(" %s\n\n", _("this plugin works well for monitoring that kind of data as well.")); |
358 | printf (" %s\n", _("It can be used to monitor any kind of data that MRTG is monitoring - errors,")); | 331 | |
359 | printf (" %s\n", _("packets/sec, etc. I use MRTG in conjunction with the Novell NLM that allows")); | 332 | printf("%s\n", _("Notes:")); |
360 | printf (" %s\n", _("me to track processor utilization, user connections, drive space, etc and")); | 333 | printf(" %s\n", _("- This plugin only monitors one of the two variables stored in the MRTG log")); |
361 | printf (" %s\n\n", _("this plugin works well for monitoring that kind of data as well.")); | 334 | printf(" %s\n", _("file. If you want to monitor both values you will have to define two")); |
362 | 335 | printf(" %s\n", _("commands with different values for the <variable> argument. Of course,")); | |
363 | printf ("%s\n", _("Notes:")); | 336 | printf(" %s\n", _("you can always hack the code to make this plugin work for you...")); |
364 | printf (" %s\n", _("- This plugin only monitors one of the two variables stored in the MRTG log")); | 337 | printf(" %s\n", _("- MRTG stands for the Multi Router Traffic Grapher. It can be downloaded from")); |
365 | printf (" %s\n", _("file. If you want to monitor both values you will have to define two")); | 338 | printf(" %s\n", "http://ee-staff.ethz.ch/~oetiker/webtools/mrtg/mrtg.html"); |
366 | printf (" %s\n", _("commands with different values for the <variable> argument. Of course,")); | 339 | |
367 | printf (" %s\n", _("you can always hack the code to make this plugin work for you...")); | 340 | printf(UT_SUPPORT); |
368 | printf (" %s\n", _("- MRTG stands for the Multi Router Traffic Grapher. It can be downloaded from")); | ||
369 | printf (" %s\n", "http://ee-staff.ethz.ch/~oetiker/webtools/mrtg/mrtg.html"); | ||
370 | |||
371 | printf (UT_SUPPORT); | ||
372 | } | 341 | } |
373 | 342 | ||
374 | |||
375 | |||
376 | /* original command line: | 343 | /* original command line: |
377 | <log_file> <expire_minutes> <AVG|MAX> <variable> <vwl> <vcl> <label> [units] */ | 344 | <log_file> <expire_minutes> <AVG|MAX> <variable> <vwl> <vcl> <label> [units] */ |
378 | 345 | ||
379 | void | 346 | void print_usage(void) { |
380 | print_usage (void) | 347 | printf("%s\n", _("Usage:")); |
381 | { | 348 | printf("%s -F log_file -a <AVG | MAX> -v variable -w warning -c critical\n", progname); |
382 | printf ("%s\n", _("Usage:")); | 349 | printf("[-l label] [-u units] [-e expire_minutes] [-t timeout] [-v]\n"); |
383 | printf ("%s -F log_file -a <AVG | MAX> -v variable -w warning -c critical\n",progname); | ||
384 | printf ("[-l label] [-u units] [-e expire_minutes] [-t timeout] [-v]\n"); | ||
385 | } | 350 | } |