diff options
author | Karl DeBisschop <kdebisschop@users.sourceforge.net> | 2003-08-09 06:01:03 +0000 |
---|---|---|
committer | Karl DeBisschop <kdebisschop@users.sourceforge.net> | 2003-08-09 06:01:03 +0000 |
commit | a228492c4bea15a3e6e7bdbfd6631611c97fe92c (patch) | |
tree | 0d21d5c54a2ab5ec3f4171fab668d390ea09bbaa /plugins/check_mrtg.c | |
parent | 024751bac56791b7ae5347404274046e8ba58ccb (diff) | |
download | monitoring-plugins-a228492c4bea15a3e6e7bdbfd6631611c97fe92c.tar.gz |
more pedantic compiler warns
git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/trunk@672 f882894a-f735-0410-b71e-b25c423dba1c
Diffstat (limited to 'plugins/check_mrtg.c')
-rw-r--r-- | plugins/check_mrtg.c | 165 |
1 files changed, 91 insertions, 74 deletions
diff --git a/plugins/check_mrtg.c b/plugins/check_mrtg.c index 2a9958d0..21efac2e 100644 --- a/plugins/check_mrtg.c +++ b/plugins/check_mrtg.c | |||
@@ -24,80 +24,10 @@ const char *email = "nagiosplug-devel@lists.sourceforge.net"; | |||
24 | #include "common.h" | 24 | #include "common.h" |
25 | #include "utils.h" | 25 | #include "utils.h" |
26 | 26 | ||
27 | /* original command line: | ||
28 | <log_file> <expire_minutes> <AVG|MAX> <variable> <vwl> <vcl> <label> [units] */ | ||
29 | |||
30 | void | ||
31 | print_usage (void) | ||
32 | { | ||
33 | printf (_("\ | ||
34 | Usage: %s -F log_file -a <AVG | MAX> -v variable -w warning -c critical\n\ | ||
35 | [-l label] [-u units] [-e expire_minutes] [-t timeout] [-v]\n"), progname); | ||
36 | printf (_(UT_HLP_VRS), progname, progname); | ||
37 | } | ||
38 | |||
39 | void | ||
40 | print_help (void) | ||
41 | { | ||
42 | print_revision (progname, revision); | ||
43 | |||
44 | printf (_(COPYRIGHT), copyright, email); | ||
45 | |||
46 | printf(_("\ | ||
47 | This plugin will check either the average or maximum value of one of the\n\ | ||
48 | two variables recorded in an MRTG log file.\n")); | ||
49 | |||
50 | print_usage (); | ||
51 | |||
52 | printf (_(UT_HELP_VRSN)); | ||
53 | |||
54 | printf (_("\ | ||
55 | -F, --logfile=FILE\n\ | ||
56 | The MRTG log file containing the data you want to monitor\n\ | ||
57 | -e, --expires=MINUTES\n\ | ||
58 | Minutes before MRTG data is considered to be too old\n\ | ||
59 | -a, --aggregation=AVG|MAX\n\ | ||
60 | Should we check average or maximum values?\n\ | ||
61 | -v, --variable=INTEGER\n\ | ||
62 | Which variable set should we inspect? (1 or 2)\n\ | ||
63 | -w, --warning=INTEGER\n\ | ||
64 | Threshold value for data to result in WARNING status\n\ | ||
65 | -c, --critical=INTEGER\n\ | ||
66 | Threshold value for data to result in CRITICAL status\n")); | ||
67 | |||
68 | printf (_("\ | ||
69 | -l, --label=STRING\n\ | ||
70 | Type label for data (Examples: Conns, \"Processor Load\", In, Out)\n\ | ||
71 | -u, --units=STRING\n\ | ||
72 | Option units label for data (Example: Packets/Sec, Errors/Sec, \n\ | ||
73 | \"Bytes Per Second\", \"%% Utilization\")\n")); | ||
74 | |||
75 | printf (_("\ | ||
76 | If the value exceeds the <vwl> threshold, a WARNING status is returned. If\n\ | ||
77 | the value exceeds the <vcl> threshold, a CRITICAL status is returned. If\n\ | ||
78 | the data in the log file is older than <expire_minutes> old, a WARNING\n\ | ||
79 | status is returned and a warning message is printed.\n\n")); | ||
80 | |||
81 | printf(_("This plugin is useful for monitoring MRTG data that does not correspond to\n\ | ||
82 | bandwidth usage. (Use the check_mrtgtraf plugin for monitoring bandwidth).\n\ | ||
83 | It can be used to monitor any kind of data that MRTG is monitoring - errors,\n\ | ||
84 | packets/sec, etc. I use MRTG in conjuction with the Novell NLM that allows\n\ | ||
85 | me to track processor utilization, user connections, drive space, etc and\n\ | ||
86 | this plugin works well for monitoring that kind of data as well.\n\n")); | ||
87 | |||
88 | printf (_("Notes:\n\ | ||
89 | - This plugin only monitors one of the two variables stored in the MRTG log\n\ | ||
90 | file. If you want to monitor both values you will have to define two\n\ | ||
91 | commands with different values for the <variable> argument. Of course,\n\ | ||
92 | you can always hack the code to make this plugin work for you...\n\ | ||
93 | - MRTG stands for the Multi Router Traffic Grapher. It can be downloaded from\n\ | ||
94 | http://ee-staff.ethz.ch/~oetiker/webtools/mrtg/mrtg.html\n")); | ||
95 | |||
96 | printf (_(UT_SUPPORT)); | ||
97 | } | ||
98 | |||
99 | int process_arguments (int, char **); | 27 | int process_arguments (int, char **); |
100 | int validate_arguments (void); | 28 | int validate_arguments (void); |
29 | void print_help (void); | ||
30 | void print_usage (void); | ||
101 | 31 | ||
102 | char *log_file = NULL; | 32 | char *log_file = NULL; |
103 | int expire_minutes = 0; | 33 | int expire_minutes = 0; |
@@ -105,8 +35,8 @@ int use_average = TRUE; | |||
105 | int variable_number = -1; | 35 | int variable_number = -1; |
106 | unsigned long value_warning_threshold = 0L; | 36 | unsigned long value_warning_threshold = 0L; |
107 | unsigned long value_critical_threshold = 0L; | 37 | unsigned long value_critical_threshold = 0L; |
108 | char *value_label = ""; | 38 | char *value_label; |
109 | char *units_label = ""; | 39 | char *units_label; |
110 | 40 | ||
111 | int | 41 | int |
112 | main (int argc, char **argv) | 42 | main (int argc, char **argv) |
@@ -351,5 +281,92 @@ validate_arguments (void) | |||
351 | if (variable_number == -1) | 281 | if (variable_number == -1) |
352 | usage (_("You must supply the variable number\n")); | 282 | usage (_("You must supply the variable number\n")); |
353 | 283 | ||
284 | if (value_label == NULL) | ||
285 | value_label = strdup (""); | ||
286 | |||
287 | if (units_label == NULL) | ||
288 | units_label = strdup (""); | ||
289 | |||
354 | return OK; | 290 | return OK; |
355 | } | 291 | } |
292 | |||
293 | |||
294 | |||
295 | |||
296 | |||
297 | |||
298 | void | ||
299 | print_help (void) | ||
300 | { | ||
301 | print_revision (progname, revision); | ||
302 | |||
303 | printf (_("Copyright (c) 1999 Ethan Galstad <nagios@nagios.org>\n")); | ||
304 | printf (_(COPYRIGHT), copyright, email); | ||
305 | |||
306 | printf(_("\ | ||
307 | This plugin will check either the average or maximum value of one of the\n\ | ||
308 | two variables recorded in an MRTG log file.\n")); | ||
309 | |||
310 | print_usage (); | ||
311 | |||
312 | printf (_(UT_HELP_VRSN)); | ||
313 | |||
314 | printf (_("\ | ||
315 | -F, --logfile=FILE\n\ | ||
316 | The MRTG log file containing the data you want to monitor\n\ | ||
317 | -e, --expires=MINUTES\n\ | ||
318 | Minutes before MRTG data is considered to be too old\n\ | ||
319 | -a, --aggregation=AVG|MAX\n\ | ||
320 | Should we check average or maximum values?\n\ | ||
321 | -v, --variable=INTEGER\n\ | ||
322 | Which variable set should we inspect? (1 or 2)\n\ | ||
323 | -w, --warning=INTEGER\n\ | ||
324 | Threshold value for data to result in WARNING status\n\ | ||
325 | -c, --critical=INTEGER\n\ | ||
326 | Threshold value for data to result in CRITICAL status\n")); | ||
327 | |||
328 | printf (_("\ | ||
329 | -l, --label=STRING\n\ | ||
330 | Type label for data (Examples: Conns, \"Processor Load\", In, Out)\n\ | ||
331 | -u, --units=STRING\n\ | ||
332 | Option units label for data (Example: Packets/Sec, Errors/Sec, \n\ | ||
333 | \"Bytes Per Second\", \"%% Utilization\")\n")); | ||
334 | |||
335 | printf (_("\ | ||
336 | If the value exceeds the <vwl> threshold, a WARNING status is returned. If\n\ | ||
337 | the value exceeds the <vcl> threshold, a CRITICAL status is returned. If\n\ | ||
338 | the data in the log file is older than <expire_minutes> old, a WARNING\n\ | ||
339 | status is returned and a warning message is printed.\n\n")); | ||
340 | |||
341 | printf(_("This plugin is useful for monitoring MRTG data that does not correspond to\n\ | ||
342 | bandwidth usage. (Use the check_mrtgtraf plugin for monitoring bandwidth).\n\ | ||
343 | It can be used to monitor any kind of data that MRTG is monitoring - errors,\n\ | ||
344 | packets/sec, etc. I use MRTG in conjuction with the Novell NLM that allows\n\ | ||
345 | me to track processor utilization, user connections, drive space, etc and\n\ | ||
346 | this plugin works well for monitoring that kind of data as well.\n\n")); | ||
347 | |||
348 | printf (_("Notes:\n\ | ||
349 | - This plugin only monitors one of the two variables stored in the MRTG log\n\ | ||
350 | file. If you want to monitor both values you will have to define two\n\ | ||
351 | commands with different values for the <variable> argument. Of course,\n\ | ||
352 | you can always hack the code to make this plugin work for you...\n\ | ||
353 | - MRTG stands for the Multi Router Traffic Grapher. It can be downloaded from\n\ | ||
354 | http://ee-staff.ethz.ch/~oetiker/webtools/mrtg/mrtg.html\n")); | ||
355 | |||
356 | printf (_(UT_SUPPORT)); | ||
357 | } | ||
358 | |||
359 | |||
360 | |||
361 | |||
362 | /* original command line: | ||
363 | <log_file> <expire_minutes> <AVG|MAX> <variable> <vwl> <vcl> <label> [units] */ | ||
364 | |||
365 | void | ||
366 | print_usage (void) | ||
367 | { | ||
368 | printf (_("\ | ||
369 | Usage: %s -F log_file -a <AVG | MAX> -v variable -w warning -c critical\n\ | ||
370 | [-l label] [-u units] [-e expire_minutes] [-t timeout] [-v]\n"), progname); | ||
371 | printf (_(UT_HLP_VRS), progname, progname); | ||
372 | } | ||