diff options
Diffstat (limited to 'plugins/check_mrtgtraf.c')
| -rw-r--r-- | plugins/check_mrtgtraf.c | 119 |
1 files changed, 67 insertions, 52 deletions
diff --git a/plugins/check_mrtgtraf.c b/plugins/check_mrtgtraf.c index ce9ab191..be2f562e 100644 --- a/plugins/check_mrtgtraf.c +++ b/plugins/check_mrtgtraf.c | |||
| @@ -24,60 +24,10 @@ const char *revision = "$Revision$"; | |||
| 24 | const char *copyright = "1999-2003"; | 24 | const char *copyright = "1999-2003"; |
| 25 | const char *email = "nagiosplug-devel@lists.sourceforge.net"; | 25 | const char *email = "nagiosplug-devel@lists.sourceforge.net"; |
| 26 | 26 | ||
| 27 | void | ||
| 28 | print_usage (void) | ||
| 29 | { | ||
| 30 | printf (_("\ | ||
| 31 | Usage: %s -F <log_file> -a <AVG | MAX> -v <variable> -w <warning_pair> -c <critical_pair>\n\ | ||
| 32 | [-e expire_minutes] [-t timeout] [-v]\n"), progname); | ||
| 33 | printf (_(UT_HLP_VRS), progname, progname); | ||
| 34 | } | ||
| 35 | |||
| 36 | void | ||
| 37 | print_help (void) | ||
| 38 | { | ||
| 39 | print_revision (progname, revision); | ||
| 40 | |||
| 41 | printf (_(COPYRIGHT), copyright, email); | ||
| 42 | |||
| 43 | print_usage (); | ||
| 44 | |||
| 45 | printf (_(UT_HELP_VRSN)); | ||
| 46 | |||
| 47 | printf (_("\ | ||
| 48 | -F, --filename=STRING\n\ | ||
| 49 | File to read log from\n\ | ||
| 50 | -e, --expires=INTEGER\n\ | ||
| 51 | Minutes after which log expires\n\ | ||
| 52 | -a, --aggregation=(AVG|MAX)\n\ | ||
| 53 | Test average or maximum\n\ | ||
| 54 | -w, --warning\n\ | ||
| 55 | Warning threshold pair \"<incoming>,<outgoing>\"\n\ | ||
| 56 | -c, --critical\n\ | ||
| 57 | Critical threshold pair \"<incoming>,<outgoing>\"\n")); | ||
| 58 | |||
| 59 | printf (_("\n\ | ||
| 60 | This plugin will check the incoming/outgoing transfer rates of a router,\n\ | ||
| 61 | switch, etc recorded in an MRTG log. If the newest log entry is older\n\ | ||
| 62 | than <expire_minutes>, a WARNING status is returned. If either the\n\ | ||
| 63 | incoming or outgoing rates exceed the <icl> or <ocl> thresholds (in\n\ | ||
| 64 | Bytes/sec), a CRITICAL status results. If either of the rates exceed\n\ | ||
| 65 | the <iwl> or <owl> thresholds (in Bytes/sec), a WARNING status results.\n\n")); | ||
| 66 | |||
| 67 | printf (_("Notes:\n\ | ||
| 68 | - MRTG stands for Multi Router Traffic Grapher. It can be downloaded from\n\ | ||
| 69 | http://ee-staff.ethz.ch/~oetiker/webtools/mrtg/mrtg.html\n\ | ||
| 70 | - While MRTG can monitor things other than traffic rates, this\n\ | ||
| 71 | plugin probably won't work with much else without modification.\n\ | ||
| 72 | - The calculated i/o rates are a little off from what MRTG actually\n\ | ||
| 73 | reports. I'm not sure why this is right now, but will look into it\n\ | ||
| 74 | for future enhancements of this plugin.\n")); | ||
| 75 | |||
| 76 | printf (_(UT_SUPPORT)); | ||
| 77 | } | ||
| 78 | |||
| 79 | int process_arguments (int, char **); | 27 | int process_arguments (int, char **); |
| 80 | int validate_arguments (void); | 28 | int validate_arguments (void); |
| 29 | void print_help(void); | ||
| 30 | void print_usage(void); | ||
| 81 | 31 | ||
| 82 | char *log_file = NULL; | 32 | char *log_file = NULL; |
| 83 | int expire_minutes = -1; | 33 | int expire_minutes = -1; |
| @@ -87,6 +37,10 @@ unsigned long incoming_critical_threshold = 0L; | |||
| 87 | unsigned long outgoing_warning_threshold = 0L; | 37 | unsigned long outgoing_warning_threshold = 0L; |
| 88 | unsigned long outgoing_critical_threshold = 0L; | 38 | unsigned long outgoing_critical_threshold = 0L; |
| 89 | 39 | ||
| 40 | |||
| 41 | |||
| 42 | |||
| 43 | |||
| 90 | int | 44 | int |
| 91 | main (int argc, char **argv) | 45 | main (int argc, char **argv) |
| 92 | { | 46 | { |
| @@ -357,3 +311,64 @@ validate_arguments (void) | |||
| 357 | { | 311 | { |
| 358 | return OK; | 312 | return OK; |
| 359 | } | 313 | } |
| 314 | |||
| 315 | |||
| 316 | |||
| 317 | |||
| 318 | |||
| 319 | |||
| 320 | void | ||
| 321 | print_help (void) | ||
| 322 | { | ||
| 323 | print_revision (progname, revision); | ||
| 324 | |||
| 325 | printf (_("Copyright (c) 1999 Ethan Galstad <nagios@nagios.org>\n")); | ||
| 326 | printf (_(COPYRIGHT), copyright, email); | ||
| 327 | |||
| 328 | print_usage (); | ||
| 329 | |||
| 330 | printf (_(UT_HELP_VRSN)); | ||
| 331 | |||
| 332 | printf (_("\ | ||
| 333 | -F, --filename=STRING\n\ | ||
| 334 | File to read log from\n\ | ||
| 335 | -e, --expires=INTEGER\n\ | ||
| 336 | Minutes after which log expires\n\ | ||
| 337 | -a, --aggregation=(AVG|MAX)\n\ | ||
| 338 | Test average or maximum\n\ | ||
| 339 | -w, --warning\n\ | ||
| 340 | Warning threshold pair \"<incoming>,<outgoing>\"\n\ | ||
| 341 | -c, --critical\n\ | ||
| 342 | Critical threshold pair \"<incoming>,<outgoing>\"\n")); | ||
| 343 | |||
| 344 | printf (_("\n\ | ||
| 345 | This plugin will check the incoming/outgoing transfer rates of a router,\n\ | ||
| 346 | switch, etc recorded in an MRTG log. If the newest log entry is older\n\ | ||
| 347 | than <expire_minutes>, a WARNING status is returned. If either the\n\ | ||
| 348 | incoming or outgoing rates exceed the <icl> or <ocl> thresholds (in\n\ | ||
| 349 | Bytes/sec), a CRITICAL status results. If either of the rates exceed\n\ | ||
| 350 | the <iwl> or <owl> thresholds (in Bytes/sec), a WARNING status results.\n\n")); | ||
| 351 | |||
| 352 | printf (_("Notes:\n\ | ||
| 353 | - MRTG stands for Multi Router Traffic Grapher. It can be downloaded from\n\ | ||
| 354 | http://ee-staff.ethz.ch/~oetiker/webtools/mrtg/mrtg.html\n\ | ||
| 355 | - While MRTG can monitor things other than traffic rates, this\n\ | ||
| 356 | plugin probably won't work with much else without modification.\n\ | ||
| 357 | - The calculated i/o rates are a little off from what MRTG actually\n\ | ||
| 358 | reports. I'm not sure why this is right now, but will look into it\n\ | ||
| 359 | for future enhancements of this plugin.\n")); | ||
| 360 | |||
| 361 | printf (_(UT_SUPPORT)); | ||
| 362 | } | ||
| 363 | |||
| 364 | |||
| 365 | |||
| 366 | |||
| 367 | void | ||
| 368 | print_usage (void) | ||
| 369 | { | ||
| 370 | printf (_("\ | ||
| 371 | Usage: %s -F <log_file> -a <AVG | MAX> -v <variable> -w <warning_pair> -c <critical_pair>\n\ | ||
| 372 | [-e expire_minutes] [-t timeout] [-v]\n"), progname); | ||
| 373 | printf (_(UT_HLP_VRS), progname, progname); | ||
| 374 | } | ||
