summaryrefslogtreecommitdiffstats
path: root/plugins/check_mrtg.c
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/check_mrtg.c')
-rw-r--r--plugins/check_mrtg.c531
1 files changed, 257 insertions, 274 deletions
diff --git a/plugins/check_mrtg.c b/plugins/check_mrtg.c
index 826b77e9..5bd276dc 100644
--- a/plugins/check_mrtg.c
+++ b/plugins/check_mrtg.c
@@ -1,385 +1,368 @@
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-2024 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
32const char *progname = "check_mrtg"; 32const char *progname = "check_mrtg";
33const char *copyright = "1999-2007"; 33const char *copyright = "1999-2024";
34const char *email = "devel@monitoring-plugins.org"; 34const char *email = "devel@monitoring-plugins.org";
35 35
36#include "common.h" 36#include "common.h"
37#include "utils.h" 37#include "utils.h"
38#include "check_mrtg.d/config.h"
38 39
39int process_arguments (int, char **); 40typedef struct {
40int validate_arguments (void); 41 int errorcode;
41void print_help (void); 42 check_mrtg_config config;
42void print_usage (void); 43} check_mrtg_config_wrapper;
43 44static check_mrtg_config_wrapper process_arguments(int /*argc*/, char ** /*argv*/);
44char *log_file = NULL; 45static check_mrtg_config_wrapper validate_arguments(check_mrtg_config_wrapper /*config_wrapper*/);
45int expire_minutes = 0; 46
46bool use_average = true; 47static void print_help(void);
47int variable_number = -1; 48void print_usage(void);
48unsigned long value_warning_threshold = 0L;
49unsigned long value_critical_threshold = 0L;
50char *label;
51char *units;
52
53int
54main (int argc, char **argv)
55{
56 int result = STATE_OK;
57 FILE *fp;
58 int line;
59 char input_buffer[MAX_INPUT_BUFFER];
60 char *temp_buffer;
61 time_t current_time;
62 time_t timestamp = 0L;
63 unsigned long average_value_rate = 0L;
64 unsigned long maximum_value_rate = 0L;
65 unsigned long rate = 0L;
66 49
67 setlocale (LC_ALL, ""); 50int main(int argc, char **argv) {
68 bindtextdomain (PACKAGE, LOCALEDIR); 51 setlocale(LC_ALL, "");
69 textdomain (PACKAGE); 52 bindtextdomain(PACKAGE, LOCALEDIR);
53 textdomain(PACKAGE);
70 54
71 /* Parse extra opts if any */ 55 /* Parse extra opts if any */
72 argv=np_extra_opts (&argc, argv, progname); 56 argv = np_extra_opts(&argc, argv, progname);
73 57
74 if (process_arguments (argc, argv) == ERROR) 58 check_mrtg_config_wrapper tmp_config = process_arguments(argc, argv);
75 usage4 (_("Could not parse arguments\n")); 59 if (tmp_config.errorcode == ERROR) {
60 usage4(_("Could not parse arguments\n"));
61 }
62
63 const check_mrtg_config config = tmp_config.config;
76 64
77 /* open the MRTG log file for reading */ 65 /* open the MRTG log file for reading */
78 fp = fopen (log_file, "r"); 66 FILE *mtrg_log_file = fopen(config.log_file, "r");
79 if (fp == NULL) { 67 if (mtrg_log_file == NULL) {
80 printf (_("Unable to open MRTG log file\n")); 68 printf(_("Unable to open MRTG log file\n"));
81 return STATE_UNKNOWN; 69 return STATE_UNKNOWN;
82 } 70 }
83 71
84 line = 0; 72 time_t timestamp = 0;
85 while (fgets (input_buffer, MAX_INPUT_BUFFER - 1, fp)) { 73 unsigned long average_value_rate = 0;
86 74 unsigned long maximum_value_rate = 0;
75 char input_buffer[MAX_INPUT_BUFFER];
76 int line = 0;
77 while (fgets(input_buffer, MAX_INPUT_BUFFER - 1, mtrg_log_file)) {
87 line++; 78 line++;
88 79
89 /* skip the first line of the log file */ 80 /* skip the first line of the log file */
90 if (line == 1) 81 if (line == 1) {
91 continue; 82 continue;
83 }
92 84
93 /* break out of read loop if we've passed the number of entries we want to read */ 85 /* break out of read loop if we've passed the number of entries we want to read */
94 if (line > 2) 86 if (line > 2) {
95 break; 87 break;
88 }
96 89
97 /* grab the timestamp */ 90 /* grab the timestamp */
98 temp_buffer = strtok (input_buffer, " "); 91 char *temp_buffer = strtok(input_buffer, " ");
99 timestamp = strtoul (temp_buffer, NULL, 10); 92 timestamp = strtoul(temp_buffer, NULL, 10);
100 93
101 /* grab the average value 1 rate */ 94 /* grab the average value 1 rate */
102 temp_buffer = strtok (NULL, " "); 95 temp_buffer = strtok(NULL, " ");
103 if (variable_number == 1) 96 if (config.variable_number == 1) {
104 average_value_rate = strtoul (temp_buffer, NULL, 10); 97 average_value_rate = strtoul(temp_buffer, NULL, 10);
98 }
105 99
106 /* grab the average value 2 rate */ 100 /* grab the average value 2 rate */
107 temp_buffer = strtok (NULL, " "); 101 temp_buffer = strtok(NULL, " ");
108 if (variable_number == 2) 102 if (config.variable_number == 2) {
109 average_value_rate = strtoul (temp_buffer, NULL, 10); 103 average_value_rate = strtoul(temp_buffer, NULL, 10);
104 }
110 105
111 /* grab the maximum value 1 rate */ 106 /* grab the maximum value 1 rate */
112 temp_buffer = strtok (NULL, " "); 107 temp_buffer = strtok(NULL, " ");
113 if (variable_number == 1) 108 if (config.variable_number == 1) {
114 maximum_value_rate = strtoul (temp_buffer, NULL, 10); 109 maximum_value_rate = strtoul(temp_buffer, NULL, 10);
110 }
115 111
116 /* grab the maximum value 2 rate */ 112 /* grab the maximum value 2 rate */
117 temp_buffer = strtok (NULL, " "); 113 temp_buffer = strtok(NULL, " ");
118 if (variable_number == 2) 114 if (config.variable_number == 2) {
119 maximum_value_rate = strtoul (temp_buffer, NULL, 10); 115 maximum_value_rate = strtoul(temp_buffer, NULL, 10);
116 }
120 } 117 }
121 118
122 /* close the log file */ 119 /* close the log file */
123 fclose (fp); 120 fclose(mtrg_log_file);
124 121
125 /* if we couldn't read enough data, return an unknown error */ 122 /* if we couldn't read enough data, return an unknown error */
126 if (line <= 2) { 123 if (line <= 2) {
127 printf (_("Unable to process MRTG log file\n")); 124 printf(_("Unable to process MRTG log file\n"));
128 return STATE_UNKNOWN; 125 return STATE_UNKNOWN;
129 } 126 }
130 127
131 /* make sure the MRTG data isn't too old */ 128 /* make sure the MRTG data isn't too old */
132 time (&current_time); 129 time_t current_time;
133 if (expire_minutes > 0 130 time(&current_time);
134 && (current_time - timestamp) > (expire_minutes * 60)) { 131 if (config.expire_minutes > 0 && (current_time - timestamp) > (config.expire_minutes * 60)) {
135 printf (_("MRTG data has expired (%d minutes old)\n"), 132 printf(_("MRTG data has expired (%d minutes old)\n"), (int)((current_time - timestamp) / 60));
136 (int) ((current_time - timestamp) / 60));
137 return STATE_WARNING; 133 return STATE_WARNING;
138 } 134 }
139 135
136 unsigned long rate = 0L;
140 /* else check the incoming/outgoing rates */ 137 /* else check the incoming/outgoing rates */
141 if (use_average) 138 if (config.use_average) {
142 rate = average_value_rate; 139 rate = average_value_rate;
143 else 140 } else {
144 rate = maximum_value_rate; 141 rate = maximum_value_rate;
142 }
145 143
146 if (rate > value_critical_threshold) 144 int result = STATE_OK;
145 if (config.value_critical_threshold_set && rate > config.value_critical_threshold) {
147 result = STATE_CRITICAL; 146 result = STATE_CRITICAL;
148 else if (rate > value_warning_threshold) 147 } else if (config.value_warning_threshold_set && rate > config.value_warning_threshold) {
149 result = STATE_WARNING; 148 result = STATE_WARNING;
149 }
150 150
151 printf("%s. %s = %lu %s|%s\n", 151 printf("%s. %s = %lu %s|%s\n", (config.use_average) ? _("Avg") : _("Max"), config.label, rate, config.units,
152 (use_average) ? _("Avg") : _("Max"), 152 perfdata(config.label, (long)rate, config.units, config.value_warning_threshold_set, (long)config.value_warning_threshold,
153 label, rate, units, 153 config.value_critical_threshold_set, (long)config.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 154
159 return result; 155 return result;
160} 156}
161 157
162
163
164/* process command-line arguments */ 158/* process command-line arguments */
165int 159check_mrtg_config_wrapper process_arguments(int argc, char **argv) {
166process_arguments (int argc, char **argv)
167{
168 int c;
169
170 int option = 0;
171 static struct option longopts[] = { 160 static struct option longopts[] = {
172 {"logfile", required_argument, 0, 'F'}, 161 {"logfile", required_argument, 0, 'F'}, {"expires", required_argument, 0, 'e'}, {"aggregation", required_argument, 0, 'a'},
173 {"expires", required_argument, 0, 'e'}, 162 {"variable", required_argument, 0, 'v'}, {"critical", required_argument, 0, 'c'}, {"warning", required_argument, 0, 'w'},
174 {"aggregation", required_argument, 0, 'a'}, 163 {"label", required_argument, 0, 'l'}, {"units", required_argument, 0, 'u'}, {"variable", required_argument, 0, 'v'},
175 {"variable", required_argument, 0, 'v'}, 164 {"version", no_argument, 0, 'V'}, {"help", no_argument, 0, 'h'}, {0, 0, 0, 0}};
176 {"critical", required_argument, 0, 'c'}, 165
177 {"warning", required_argument, 0, 'w'}, 166 check_mrtg_config_wrapper result = {
178 {"label", required_argument, 0, 'l'}, 167 .errorcode = OK,
179 {"units", required_argument, 0, 'u'}, 168 .config = check_mrtg_config_init(),
180 {"variable", required_argument, 0, 'v'},
181 {"version", no_argument, 0, 'V'},
182 {"help", no_argument, 0, 'h'},
183 {0, 0, 0, 0}
184 }; 169 };
185 170
186 if (argc < 2) 171 if (argc < 2) {
187 return ERROR; 172 result.errorcode = ERROR;
173 return result;
174 }
188 175
189 for (c = 1; c < argc; c++) { 176 for (int i = 1; i < argc; i++) {
190 if (strcmp ("-to", argv[c]) == 0) 177 if (strcmp("-to", argv[i]) == 0) {
191 strcpy (argv[c], "-t"); 178 strcpy(argv[i], "-t");
192 else if (strcmp ("-wt", argv[c]) == 0) 179 } else if (strcmp("-wt", argv[i]) == 0) {
193 strcpy (argv[c], "-w"); 180 strcpy(argv[i], "-w");
194 else if (strcmp ("-ct", argv[c]) == 0) 181 } else if (strcmp("-ct", argv[i]) == 0) {
195 strcpy (argv[c], "-c"); 182 strcpy(argv[i], "-c");
183 }
196 } 184 }
197 185
186 int option_char;
187 int option = 0;
198 while (1) { 188 while (1) {
199 c = getopt_long (argc, argv, "hVF:e:a:v:c:w:l:u:", longopts, 189 option_char = getopt_long(argc, argv, "hVF:e:a:v:c:w:l:u:", longopts, &option);
200 &option);
201 190
202 if (c == -1 || c == EOF) 191 if (option_char == -1 || option_char == EOF) {
203 break; 192 break;
193 }
204 194
205 switch (c) { 195 switch (option_char) {
206 case 'F': /* input file */ 196 case 'F': /* input file */
207 log_file = optarg; 197 result.config.log_file = optarg;
208 break; 198 break;
209 case 'e': /* ups name */ 199 case 'e': /* ups name */
210 expire_minutes = atoi (optarg); 200 result.config.expire_minutes = atoi(optarg);
211 break; 201 break;
212 case 'a': /* port */ 202 case 'a': /* port */
213 if (!strcmp (optarg, "MAX")) 203 result.config.use_average = (bool)(strcmp(optarg, "MAX"));
214 use_average = false;
215 else
216 use_average = true;
217 break; 204 break;
218 case 'v': 205 case 'v':
219 variable_number = atoi (optarg); 206 result.config.variable_number = atoi(optarg);
220 if (variable_number < 1 || variable_number > 2) 207 if (result.config.variable_number < 1 || result.config.variable_number > 2) {
221 usage4 (_("Invalid variable number")); 208 usage4(_("Invalid variable number"));
209 }
222 break; 210 break;
223 case 'w': /* critical time threshold */ 211 case 'w': /* critical time threshold */
224 value_warning_threshold = strtoul (optarg, NULL, 10); 212 result.config.value_warning_threshold_set = true;
213 result.config.value_warning_threshold = strtoul(optarg, NULL, 10);
225 break; 214 break;
226 case 'c': /* warning time threshold */ 215 case 'c': /* warning time threshold */
227 value_critical_threshold = strtoul (optarg, NULL, 10); 216 result.config.value_critical_threshold_set = true;
217 result.config.value_critical_threshold = strtoul(optarg, NULL, 10);
228 break; 218 break;
229 case 'l': /* label */ 219 case 'l': /* label */
230 label = optarg; 220 result.config.label = optarg;
231 break; 221 break;
232 case 'u': /* timeout */ 222 case 'u': /* timeout */
233 units = optarg; 223 result.config.units = optarg;
234 break; 224 break;
235 case 'V': /* version */ 225 case 'V': /* version */
236 print_revision (progname, NP_VERSION); 226 print_revision(progname, NP_VERSION);
237 exit (STATE_UNKNOWN); 227 exit(STATE_UNKNOWN);
238 case 'h': /* help */ 228 case 'h': /* help */
239 print_help (); 229 print_help();
240 exit (STATE_UNKNOWN); 230 exit(STATE_UNKNOWN);
241 case '?': /* help */ 231 case '?': /* help */
242 usage5 (); 232 usage5();
243 } 233 }
244 } 234 }
245 235
246 c = optind; 236 option_char = optind;
247 if (log_file == NULL && argc > c) { 237 if (result.config.log_file == NULL && argc > option_char) {
248 log_file = argv[c++]; 238 result.config.log_file = argv[option_char++];
249 } 239 }
250 240
251 if (expire_minutes <= 0 && argc > c) { 241 if (result.config.expire_minutes <= 0 && argc > option_char) {
252 if (is_intpos (argv[c])) 242 if (is_intpos(argv[option_char])) {
253 expire_minutes = atoi (argv[c++]); 243 result.config.expire_minutes = atoi(argv[option_char++]);
254 else 244 } else {
255 die (STATE_UNKNOWN, 245 die(STATE_UNKNOWN, _("%s is not a valid expiration time\nUse '%s -h' for additional help\n"), argv[option_char], progname);
256 _("%s is not a valid expiration time\nUse '%s -h' for additional help\n"), 246 }
257 argv[c], progname);
258 } 247 }
259 248
260 if (argc > c && strcmp (argv[c], "MAX") == 0) { 249 if (argc > option_char && strcmp(argv[option_char], "MAX") == 0) {
261 use_average = false; 250 result.config.use_average = false;
262 c++; 251 option_char++;
263 } 252 } else if (argc > option_char && strcmp(argv[option_char], "AVG") == 0) {
264 else if (argc > c && strcmp (argv[c], "AVG") == 0) { 253 result.config.use_average = true;
265 use_average = true; 254 option_char++;
266 c++;
267 } 255 }
268 256
269 if (argc > c && variable_number == -1) { 257 if (argc > option_char && result.config.variable_number == -1) {
270 variable_number = atoi (argv[c++]); 258 result.config.variable_number = atoi(argv[option_char++]);
271 if (variable_number < 1 || variable_number > 2) { 259 if (result.config.variable_number < 1 || result.config.variable_number > 2) {
272 printf ("%s :", argv[c]); 260 printf("%s :", argv[option_char]);
273 usage (_("Invalid variable number\n")); 261 usage(_("Invalid variable number\n"));
274 } 262 }
275 } 263 }
276 264
277 if (argc > c && value_warning_threshold == 0) { 265 if (argc > option_char && !result.config.value_warning_threshold_set) {
278 value_warning_threshold = strtoul (argv[c++], NULL, 10); 266 result.config.value_warning_threshold_set = true;
267 result.config.value_warning_threshold = strtoul(argv[option_char++], NULL, 10);
279 } 268 }
280 269
281 if (argc > c && value_critical_threshold == 0) { 270 if (argc > option_char && !result.config.value_critical_threshold_set) {
282 value_critical_threshold = strtoul (argv[c++], NULL, 10); 271 result.config.value_critical_threshold_set = true;
272 result.config.value_critical_threshold = strtoul(argv[option_char++], NULL, 10);
283 } 273 }
284 274
285 if (argc > c && strlen (label) == 0) { 275 if (argc > option_char && strlen(result.config.label) == 0) {
286 label = argv[c++]; 276 result.config.label = argv[option_char++];
287 } 277 }
288 278
289 if (argc > c && strlen (units) == 0) { 279 if (argc > option_char && strlen(result.config.units) == 0) {
290 units = argv[c++]; 280 result.config.units = argv[option_char++];
291 } 281 }
292 282
293 return validate_arguments (); 283 return validate_arguments(result);
294} 284}
295 285
296int 286check_mrtg_config_wrapper validate_arguments(check_mrtg_config_wrapper config_wrapper) {
297validate_arguments (void) 287 if (config_wrapper.config.variable_number == -1) {
298{ 288 usage4(_("You must supply the variable number"));
299 if (variable_number == -1) 289 }
300 usage4 (_("You must supply the variable number"));
301 290
302 if (label == NULL) 291 if (config_wrapper.config.label == NULL) {
303 label = strdup ("value"); 292 config_wrapper.config.label = strdup("value");
293 }
304 294
305 if (units == NULL) 295 if (config_wrapper.config.units == NULL) {
306 units = strdup (""); 296 config_wrapper.config.units = strdup("");
297 }
307 298
308 return OK; 299 return config_wrapper;
309} 300}
310 301
311 302void print_help(void) {
312 303 print_revision(progname, NP_VERSION);
313void 304
314print_help (void) 305 printf("Copyright (c) 1999 Ethan Galstad <nagios@nagios.org>\n");
315{ 306 printf(COPYRIGHT, copyright, email);
316 print_revision (progname, NP_VERSION); 307
317 308 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"); 309 printf("%s\n", _("two variables recorded in an MRTG log file."));
319 printf (COPYRIGHT, copyright, email); 310
320 311 printf("\n\n");
321 printf ("%s\n", _("This plugin will check either the average or maximum value of one of the")); 312
322 printf ("%s\n", _("two variables recorded in an MRTG log file.")); 313 print_usage();
323 314
324 printf ("\n\n"); 315 printf(UT_HELP_VRSN);
325 316 printf(UT_EXTRA_OPTS);
326 print_usage (); 317
327 318 printf(" %s\n", "-F, --logfile=FILE");
328 printf (UT_HELP_VRSN); 319 printf(" %s\n", _("The MRTG log file containing the data you want to monitor"));
329 printf (UT_EXTRA_OPTS); 320 printf(" %s\n", "-e, --expires=MINUTES");
330 321 printf(" %s\n", _("Minutes before MRTG data is considered to be too old"));
331 printf (" %s\n", "-F, --logfile=FILE"); 322 printf(" %s\n", "-a, --aggregation=AVG|MAX");
332 printf (" %s\n", _("The MRTG log file containing the data you want to monitor")); 323 printf(" %s\n", _("Should we check average or maximum values?"));
333 printf (" %s\n", "-e, --expires=MINUTES"); 324 printf(" %s\n", "-v, --variable=INTEGER");
334 printf (" %s\n", _("Minutes before MRTG data is considered to be too old")); 325 printf(" %s\n", _("Which variable set should we inspect? (1 or 2)"));
335 printf (" %s\n", "-a, --aggregation=AVG|MAX"); 326 printf(" %s\n", "-w, --warning=INTEGER");
336 printf (" %s\n", _("Should we check average or maximum values?")); 327 printf(" %s\n", _("Threshold value for data to result in WARNING status"));
337 printf (" %s\n", "-v, --variable=INTEGER"); 328 printf(" %s\n", "-c, --critical=INTEGER");
338 printf (" %s\n", _("Which variable set should we inspect? (1 or 2)")); 329 printf(" %s\n", _("Threshold value for data to result in CRITICAL status"));
339 printf (" %s\n", "-w, --warning=INTEGER"); 330 printf(" %s\n", "-l, --label=STRING");
340 printf (" %s\n", _("Threshold value for data to result in WARNING status")); 331 printf(" %s\n", _("Type label for data (Examples: Conns, \"Processor Load\", In, Out)"));
341 printf (" %s\n", "-c, --critical=INTEGER"); 332 printf(" %s\n", "-u, --units=STRING");
342 printf (" %s\n", _("Threshold value for data to result in CRITICAL status")); 333 printf(" %s\n", _("Option units label for data (Example: Packets/Sec, Errors/Sec,"));
343 printf (" %s\n", "-l, --label=STRING"); 334 printf(" %s\n", _("\"Bytes Per Second\", \"%% Utilization\")"));
344 printf (" %s\n", _("Type label for data (Examples: Conns, \"Processor Load\", In, Out)")); 335
345 printf (" %s\n", "-u, --units=STRING"); 336 printf("\n");
346 printf (" %s\n", _("Option units label for data (Example: Packets/Sec, Errors/Sec,")); 337 printf(" %s\n", _("If the value exceeds the <vwl> threshold, a WARNING status is returned. If"));
347 printf (" %s\n", _("\"Bytes Per Second\", \"%% Utilization\")")); 338 printf(" %s\n", _("the value exceeds the <vcl> threshold, a CRITICAL status is returned. If"));
348 339 printf(" %s\n", _("the data in the log file is older than <expire_minutes> old, a WARNING"));
349 printf ("\n"); 340 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")); 341
351 printf (" %s\n", _("the value exceeds the <vcl> threshold, a CRITICAL status is returned. If")); 342 printf("\n");
352 printf (" %s\n", _("the data in the log file is older than <expire_minutes> old, a WARNING")); 343 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.")); 344 printf(" %s\n", _("bandwidth usage. (Use the check_mrtgtraf plugin for monitoring bandwidth)."));
354 345 printf(" %s\n", _("It can be used to monitor any kind of data that MRTG is monitoring - errors,"));
355 printf ("\n"); 346 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")); 347 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).")); 348 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,")); 349
359 printf (" %s\n", _("packets/sec, etc. I use MRTG in conjunction with the Novell NLM that allows")); 350 printf("%s\n", _("Notes:"));
360 printf (" %s\n", _("me to track processor utilization, user connections, drive space, etc and")); 351 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.")); 352 printf(" %s\n", _("file. If you want to monitor both values you will have to define two"));
362 353 printf(" %s\n", _("commands with different values for the <variable> argument. Of course,"));
363 printf ("%s\n", _("Notes:")); 354 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")); 355 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")); 356 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,")); 357
367 printf (" %s\n", _("you can always hack the code to make this plugin work for you...")); 358 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} 359}
373 360
374
375
376/* original command line: 361/* original command line:
377 <log_file> <expire_minutes> <AVG|MAX> <variable> <vwl> <vcl> <label> [units] */ 362 <log_file> <expire_minutes> <AVG|MAX> <variable> <vwl> <vcl> <label> [units] */
378 363
379void 364void print_usage(void) {
380print_usage (void) 365 printf("%s\n", _("Usage:"));
381{ 366 printf("%s -F log_file -a <AVG | MAX> -v variable -w warning -c critical\n", progname);
382 printf ("%s\n", _("Usage:")); 367 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} 368}