summaryrefslogtreecommitdiffstats
path: root/plugins/check_mrtg.c
diff options
context:
space:
mode:
authorKarl DeBisschop <kdebisschop@users.sourceforge.net>2003-08-09 06:01:03 (GMT)
committerKarl DeBisschop <kdebisschop@users.sourceforge.net>2003-08-09 06:01:03 (GMT)
commita228492c4bea15a3e6e7bdbfd6631611c97fe92c (patch)
tree0d21d5c54a2ab5ec3f4171fab668d390ea09bbaa /plugins/check_mrtg.c
parent024751bac56791b7ae5347404274046e8ba58ccb (diff)
downloadmonitoring-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.c165
1 files changed, 91 insertions, 74 deletions
diff --git a/plugins/check_mrtg.c b/plugins/check_mrtg.c
index 2a9958d..21efac2 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
30void
31print_usage (void)
32{
33 printf (_("\
34Usage: %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
39void
40print_help (void)
41{
42 print_revision (progname, revision);
43
44 printf (_(COPYRIGHT), copyright, email);
45
46 printf(_("\
47This plugin will check either the average or maximum value of one of the\n\
48two 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 (_("\
76If the value exceeds the <vwl> threshold, a WARNING status is returned. If\n\
77the value exceeds the <vcl> threshold, a CRITICAL status is returned. If\n\
78the data in the log file is older than <expire_minutes> old, a WARNING\n\
79status 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\
82bandwidth usage. (Use the check_mrtgtraf plugin for monitoring bandwidth).\n\
83It can be used to monitor any kind of data that MRTG is monitoring - errors,\n\
84packets/sec, etc. I use MRTG in conjuction with the Novell NLM that allows\n\
85me to track processor utilization, user connections, drive space, etc and\n\
86this 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
99int process_arguments (int, char **); 27int process_arguments (int, char **);
100int validate_arguments (void); 28int validate_arguments (void);
29void print_help (void);
30void print_usage (void);
101 31
102char *log_file = NULL; 32char *log_file = NULL;
103int expire_minutes = 0; 33int expire_minutes = 0;
@@ -105,8 +35,8 @@ int use_average = TRUE;
105int variable_number = -1; 35int variable_number = -1;
106unsigned long value_warning_threshold = 0L; 36unsigned long value_warning_threshold = 0L;
107unsigned long value_critical_threshold = 0L; 37unsigned long value_critical_threshold = 0L;
108char *value_label = ""; 38char *value_label;
109char *units_label = ""; 39char *units_label;
110 40
111int 41int
112main (int argc, char **argv) 42main (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
298void
299print_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(_("\
307This plugin will check either the average or maximum value of one of the\n\
308two 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 (_("\
336If the value exceeds the <vwl> threshold, a WARNING status is returned. If\n\
337the value exceeds the <vcl> threshold, a CRITICAL status is returned. If\n\
338the data in the log file is older than <expire_minutes> old, a WARNING\n\
339status 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\
342bandwidth usage. (Use the check_mrtgtraf plugin for monitoring bandwidth).\n\
343It can be used to monitor any kind of data that MRTG is monitoring - errors,\n\
344packets/sec, etc. I use MRTG in conjuction with the Novell NLM that allows\n\
345me to track processor utilization, user connections, drive space, etc and\n\
346this 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
365void
366print_usage (void)
367{
368 printf (_("\
369Usage: %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}