summaryrefslogtreecommitdiffstats
path: root/plugins/check_overcr.c
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/check_overcr.c')
-rw-r--r--plugins/check_overcr.c397
1 files changed, 173 insertions, 224 deletions
diff --git a/plugins/check_overcr.c b/plugins/check_overcr.c
index 5165c82..e80d477 100644
--- a/plugins/check_overcr.c
+++ b/plugins/check_overcr.c
@@ -1,36 +1,36 @@
1/***************************************************************************** 1/*****************************************************************************
2* 2 *
3* Monitoring check_overcr plugin 3 * Monitoring check_overcr plugin
4* 4 *
5* License: GPL 5 * License: GPL
6* Copyright (c) 2000-2007 Monitoring Plugins Development Team 6 * Copyright (c) 2000-2024 Monitoring Plugins Development Team
7* 7 *
8* Description: 8 * Description:
9* 9 *
10* This file contains the check_overcr plugin 10 * This file contains the check_overcr plugin
11* 11 *
12* This plugin attempts to contact the Over-CR collector daemon running on the 12 * This plugin attempts to contact the Over-CR collector daemon running on the
13* remote UNIX server in order to gather the requested system information. 13 * remote UNIX server in order to gather the requested system information.
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_overcr"; 32const char *progname = "check_overcr";
33const char *copyright = "2000-2007"; 33const char *copyright = "2000-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"
@@ -66,13 +66,11 @@ char *disk_name = NULL;
66char *process_name = NULL; 66char *process_name = NULL;
67char send_buffer[MAX_INPUT_BUFFER]; 67char send_buffer[MAX_INPUT_BUFFER];
68 68
69int process_arguments (int, char **); 69int process_arguments(int, char **);
70void print_usage (void); 70void print_usage(void);
71void print_help (void); 71void print_help(void);
72 72
73int 73int main(int argc, char **argv) {
74main (int argc, char **argv)
75{
76 int result = STATE_UNKNOWN; 74 int result = STATE_UNKNOWN;
77 char recv_buffer[MAX_INPUT_BUFFER]; 75 char recv_buffer[MAX_INPUT_BUFFER];
78 char temp_buffer[MAX_INPUT_BUFFER]; 76 char temp_buffer[MAX_INPUT_BUFFER];
@@ -91,66 +89,62 @@ main (int argc, char **argv)
91 int uptime_hours = 0; 89 int uptime_hours = 0;
92 int uptime_minutes = 0; 90 int uptime_minutes = 0;
93 91
94 setlocale (LC_ALL, ""); 92 setlocale(LC_ALL, "");
95 bindtextdomain (PACKAGE, LOCALEDIR); 93 bindtextdomain(PACKAGE, LOCALEDIR);
96 textdomain (PACKAGE); 94 textdomain(PACKAGE);
97 95
98 /* Parse extra opts if any */ 96 /* Parse extra opts if any */
99 argv=np_extra_opts (&argc, argv, progname); 97 argv = np_extra_opts(&argc, argv, progname);
100 98
101 if (process_arguments (argc, argv) == ERROR) 99 if (process_arguments(argc, argv) == ERROR)
102 usage4 (_("Could not parse arguments")); 100 usage4(_("Could not parse arguments"));
103 101
104 /* initialize alarm signal handling */ 102 /* initialize alarm signal handling */
105 signal (SIGALRM, socket_timeout_alarm_handler); 103 signal(SIGALRM, socket_timeout_alarm_handler);
106 104
107 /* set socket timeout */ 105 /* set socket timeout */
108 alarm (socket_timeout); 106 alarm(socket_timeout);
109 107
110 result = process_tcp_request2 (server_address, 108 result = process_tcp_request2(server_address, server_port, send_buffer, recv_buffer, sizeof(recv_buffer));
111 server_port,
112 send_buffer,
113 recv_buffer,
114 sizeof (recv_buffer));
115 109
116 switch (vars_to_check) { 110 switch (vars_to_check) {
117 111
118 case LOAD1: 112 case LOAD1:
119 case LOAD5: 113 case LOAD5:
120 case LOAD15: 114 case LOAD15:
121 115
122 if (result != STATE_OK) 116 if (result != STATE_OK)
123 die (result, _("Unknown error fetching load data\n")); 117 die(result, _("Unknown error fetching load data\n"));
124 118
125 temp_ptr = (char *) strtok (recv_buffer, "\r\n"); 119 temp_ptr = (char *)strtok(recv_buffer, "\r\n");
126 if (temp_ptr == NULL) 120 if (temp_ptr == NULL)
127 die (STATE_CRITICAL, _("Invalid response from server - no load information\n")); 121 die(STATE_CRITICAL, _("Invalid response from server - no load information\n"));
128 else 122 else
129 load_1min = strtod (temp_ptr, NULL); 123 load_1min = strtod(temp_ptr, NULL);
130 124
131 temp_ptr = (char *) strtok (NULL, "\r\n"); 125 temp_ptr = (char *)strtok(NULL, "\r\n");
132 if (temp_ptr == NULL) 126 if (temp_ptr == NULL)
133 die (STATE_CRITICAL, _("Invalid response from server after load 1\n")); 127 die(STATE_CRITICAL, _("Invalid response from server after load 1\n"));
134 else 128 else
135 load_5min = strtod (temp_ptr, NULL); 129 load_5min = strtod(temp_ptr, NULL);
136 130
137 temp_ptr = (char *) strtok (NULL, "\r\n"); 131 temp_ptr = (char *)strtok(NULL, "\r\n");
138 if (temp_ptr == NULL) 132 if (temp_ptr == NULL)
139 die (STATE_CRITICAL, _("Invalid response from server after load 5\n")); 133 die(STATE_CRITICAL, _("Invalid response from server after load 5\n"));
140 else 134 else
141 load_15min = strtod (temp_ptr, NULL); 135 load_15min = strtod(temp_ptr, NULL);
142 136
143 switch (vars_to_check) { 137 switch (vars_to_check) {
144 case LOAD1: 138 case LOAD1:
145 strcpy (temp_buffer, "1"); 139 strcpy(temp_buffer, "1");
146 load = load_1min; 140 load = load_1min;
147 break; 141 break;
148 case LOAD5: 142 case LOAD5:
149 strcpy (temp_buffer, "5"); 143 strcpy(temp_buffer, "5");
150 load = load_5min; 144 load = load_5min;
151 break; 145 break;
152 default: 146 default:
153 strcpy (temp_buffer, "15"); 147 strcpy(temp_buffer, "15");
154 load = load_15min; 148 load = load_15min;
155 break; 149 break;
156 } 150 }
@@ -160,98 +154,82 @@ main (int argc, char **argv)
160 else if (check_warning_value && (load >= warning_value)) 154 else if (check_warning_value && (load >= warning_value))
161 result = STATE_WARNING; 155 result = STATE_WARNING;
162 156
163 die (result, 157 die(result, _("Load %s - %s-min load average = %0.2f"), state_text(result), temp_buffer, load);
164 _("Load %s - %s-min load average = %0.2f"),
165 state_text(result),
166 temp_buffer,
167 load);
168 158
169 break; 159 break;
170 160
171 case DPU: 161 case DPU:
172 162
173 if (result != STATE_OK) 163 if (result != STATE_OK)
174 die (result, _("Unknown error fetching disk data\n")); 164 die(result, _("Unknown error fetching disk data\n"));
175 165
176 for (temp_ptr = (char *) strtok (recv_buffer, " "); 166 for (temp_ptr = (char *)strtok(recv_buffer, " "); temp_ptr != NULL; temp_ptr = (char *)strtok(NULL, " ")) {
177 temp_ptr != NULL;
178 temp_ptr = (char *) strtok (NULL, " ")) {
179 167
180 if (!strcmp (temp_ptr, disk_name)) { 168 if (!strcmp(temp_ptr, disk_name)) {
181 found_disk = true; 169 found_disk = true;
182 temp_ptr = (char *) strtok (NULL, "%"); 170 temp_ptr = (char *)strtok(NULL, "%");
183 if (temp_ptr == NULL) 171 if (temp_ptr == NULL)
184 die (STATE_CRITICAL, _("Invalid response from server\n")); 172 die(STATE_CRITICAL, _("Invalid response from server\n"));
185 else 173 else
186 percent_used_disk_space = strtoul (temp_ptr, NULL, 10); 174 percent_used_disk_space = strtoul(temp_ptr, NULL, 10);
187 break; 175 break;
188 } 176 }
189 177
190 temp_ptr = (char *) strtok (NULL, "\r\n"); 178 temp_ptr = (char *)strtok(NULL, "\r\n");
191 } 179 }
192 180
193 /* error if we couldn't find the info for the disk */ 181 /* error if we couldn't find the info for the disk */
194 if (!found_disk) 182 if (!found_disk)
195 die (STATE_CRITICAL, 183 die(STATE_CRITICAL, "CRITICAL - Disk '%s' non-existent or not mounted", disk_name);
196 "CRITICAL - Disk '%s' non-existent or not mounted",
197 disk_name);
198 184
199 if (check_critical_value && (percent_used_disk_space >= critical_value)) 185 if (check_critical_value && (percent_used_disk_space >= critical_value))
200 result = STATE_CRITICAL; 186 result = STATE_CRITICAL;
201 else if (check_warning_value && (percent_used_disk_space >= warning_value)) 187 else if (check_warning_value && (percent_used_disk_space >= warning_value))
202 result = STATE_WARNING; 188 result = STATE_WARNING;
203 189
204 die (result, "Disk %s - %lu%% used on %s", state_text(result), percent_used_disk_space, disk_name); 190 die(result, "Disk %s - %lu%% used on %s", state_text(result), percent_used_disk_space, disk_name);
205 191
206 break; 192 break;
207 193
208 case NETSTAT: 194 case NETSTAT:
209 195
210 if (result != STATE_OK) 196 if (result != STATE_OK)
211 die (result, _("Unknown error fetching network status\n")); 197 die(result, _("Unknown error fetching network status\n"));
212 else 198 else
213 port_connections = strtod (recv_buffer, NULL); 199 port_connections = strtod(recv_buffer, NULL);
214 200
215 if (check_critical_value && (port_connections >= critical_value)) 201 if (check_critical_value && (port_connections >= critical_value))
216 result = STATE_CRITICAL; 202 result = STATE_CRITICAL;
217 else if (check_warning_value && (port_connections >= warning_value)) 203 else if (check_warning_value && (port_connections >= warning_value))
218 result = STATE_WARNING; 204 result = STATE_WARNING;
219 205
220 die (result, 206 die(result, _("Net %s - %d connection%s on port %d"), state_text(result), port_connections, (port_connections == 1) ? "" : "s",
221 _("Net %s - %d connection%s on port %d"), 207 netstat_port);
222 state_text(result),
223 port_connections,
224 (port_connections == 1) ? "" : "s",
225 netstat_port);
226 208
227 break; 209 break;
228 210
229 case PROCS: 211 case PROCS:
230 212
231 if (result != STATE_OK) 213 if (result != STATE_OK)
232 die (result, _("Unknown error fetching process status\n")); 214 die(result, _("Unknown error fetching process status\n"));
233 215
234 temp_ptr = (char *) strtok (recv_buffer, "("); 216 temp_ptr = (char *)strtok(recv_buffer, "(");
235 if (temp_ptr == NULL) 217 if (temp_ptr == NULL)
236 die (STATE_CRITICAL, _("Invalid response from server\n")); 218 die(STATE_CRITICAL, _("Invalid response from server\n"));
237 219
238 temp_ptr = (char *) strtok (NULL, ")"); 220 temp_ptr = (char *)strtok(NULL, ")");
239 if (temp_ptr == NULL) 221 if (temp_ptr == NULL)
240 die (STATE_CRITICAL, _("Invalid response from server\n")); 222 die(STATE_CRITICAL, _("Invalid response from server\n"));
241 else 223 else
242 processes = strtod (temp_ptr, NULL); 224 processes = strtod(temp_ptr, NULL);
243 225
244 if (check_critical_value && (processes >= critical_value)) 226 if (check_critical_value && (processes >= critical_value))
245 result = STATE_CRITICAL; 227 result = STATE_CRITICAL;
246 else if (check_warning_value && (processes >= warning_value)) 228 else if (check_warning_value && (processes >= warning_value))
247 result = STATE_WARNING; 229 result = STATE_WARNING;
248 230
249 die (result, 231 die(result, _("Process %s - %d instance%s of %s running"), state_text(result), processes, (processes == 1) ? "" : "s",
250 _("Process %s - %d instance%s of %s running"), 232 process_name);
251 state_text(result),
252 processes,
253 (processes == 1) ? "" : "s",
254 process_name);
255 break; 233 break;
256 234
257 case UPTIME: 235 case UPTIME:
@@ -259,8 +237,8 @@ main (int argc, char **argv)
259 if (result != STATE_OK) 237 if (result != STATE_OK)
260 return result; 238 return result;
261 239
262 uptime_raw_hours = strtod (recv_buffer, NULL); 240 uptime_raw_hours = strtod(recv_buffer, NULL);
263 uptime_raw_minutes = (unsigned long) (uptime_raw_hours * 60.0); 241 uptime_raw_minutes = (unsigned long)(uptime_raw_hours * 60.0);
264 242
265 if (check_critical_value && (uptime_raw_minutes <= critical_value)) 243 if (check_critical_value && (uptime_raw_minutes <= critical_value))
266 result = STATE_CRITICAL; 244 result = STATE_CRITICAL;
@@ -273,46 +251,31 @@ main (int argc, char **argv)
273 uptime_raw_minutes %= 60; 251 uptime_raw_minutes %= 60;
274 uptime_minutes = uptime_raw_minutes; 252 uptime_minutes = uptime_raw_minutes;
275 253
276 die (result, 254 die(result, _("Uptime %s - Up %d days %d hours %d minutes"), state_text(result), uptime_days, uptime_hours, uptime_minutes);
277 _("Uptime %s - Up %d days %d hours %d minutes"),
278 state_text(result),
279 uptime_days,
280 uptime_hours,
281 uptime_minutes);
282 break; 255 break;
283 256
284 default: 257 default:
285 die (STATE_UNKNOWN, _("Nothing to check!\n")); 258 die(STATE_UNKNOWN, _("Nothing to check!\n"));
286 break; 259 break;
287 } 260 }
288} 261}
289 262
290
291/* process command-line arguments */ 263/* process command-line arguments */
292int 264int process_arguments(int argc, char **argv) {
293process_arguments (int argc, char **argv)
294{
295 int c; 265 int c;
296 266
297 int option = 0; 267 int option = 0;
298 static struct option longopts[] = { 268 static struct option longopts[] = {
299 {"port", required_argument, 0, 'p'}, 269 {"port", required_argument, 0, 'p'}, {"timeout", required_argument, 0, 't'}, {"critical", required_argument, 0, 'c'},
300 {"timeout", required_argument, 0, 't'}, 270 {"warning", required_argument, 0, 'w'}, {"variable", required_argument, 0, 'v'}, {"hostname", required_argument, 0, 'H'},
301 {"critical", required_argument, 0, 'c'}, 271 {"version", no_argument, 0, 'V'}, {"help", no_argument, 0, 'h'}, {0, 0, 0, 0}};
302 {"warning", required_argument, 0, 'w'},
303 {"variable", required_argument, 0, 'v'},
304 {"hostname", required_argument, 0, 'H'},
305 {"version", no_argument, 0, 'V'},
306 {"help", no_argument, 0, 'h'},
307 {0, 0, 0, 0}
308 };
309 272
310 /* no options were supplied */ 273 /* no options were supplied */
311 if (argc < 2) 274 if (argc < 2)
312 return ERROR; 275 return ERROR;
313 276
314 /* backwards compatibility */ 277 /* backwards compatibility */
315 if (!is_option (argv[1])) { 278 if (!is_option(argv[1])) {
316 server_address = argv[1]; 279 server_address = argv[1];
317 argv[1] = argv[0]; 280 argv[1] = argv[0];
318 argv = &argv[1]; 281 argv = &argv[1];
@@ -320,150 +283,136 @@ process_arguments (int argc, char **argv)
320 } 283 }
321 284
322 for (c = 1; c < argc; c++) { 285 for (c = 1; c < argc; c++) {
323 if (strcmp ("-to", argv[c]) == 0) 286 if (strcmp("-to", argv[c]) == 0)
324 strcpy (argv[c], "-t"); 287 strcpy(argv[c], "-t");
325 else if (strcmp ("-wv", argv[c]) == 0) 288 else if (strcmp("-wv", argv[c]) == 0)
326 strcpy (argv[c], "-w"); 289 strcpy(argv[c], "-w");
327 else if (strcmp ("-cv", argv[c]) == 0) 290 else if (strcmp("-cv", argv[c]) == 0)
328 strcpy (argv[c], "-c"); 291 strcpy(argv[c], "-c");
329 } 292 }
330 293
331 while (1) { 294 while (1) {
332 c = getopt_long (argc, argv, "+hVH:t:c:w:p:v:", longopts, 295 c = getopt_long(argc, argv, "+hVH:t:c:w:p:v:", longopts, &option);
333 &option);
334 296
335 if (c == -1 || c == EOF || c == 1) 297 if (c == -1 || c == EOF || c == 1)
336 break; 298 break;
337 299
338 switch (c) { 300 switch (c) {
339 case '?': /* print short usage statement if args not parsable */ 301 case '?': /* print short usage statement if args not parsable */
340 usage5 (); 302 usage5();
341 case 'h': /* help */ 303 case 'h': /* help */
342 print_help (); 304 print_help();
343 exit (STATE_UNKNOWN); 305 exit(STATE_UNKNOWN);
344 case 'V': /* version */ 306 case 'V': /* version */
345 print_revision (progname, NP_VERSION); 307 print_revision(progname, NP_VERSION);
346 exit (STATE_UNKNOWN); 308 exit(STATE_UNKNOWN);
347 case 'H': /* hostname */ 309 case 'H': /* hostname */
348 server_address = optarg; 310 server_address = optarg;
349 break; 311 break;
350 case 'p': /* port */ 312 case 'p': /* port */
351 if (is_intnonneg (optarg)) 313 if (is_intnonneg(optarg))
352 server_port = atoi (optarg); 314 server_port = atoi(optarg);
353 else 315 else
354 die (STATE_UNKNOWN, 316 die(STATE_UNKNOWN, _("Server port an integer\n"));
355 _("Server port an integer\n"));
356 break; 317 break;
357 case 'v': /* variable */ 318 case 'v': /* variable */
358 if (strcmp (optarg, "LOAD") == 0) { 319 if (strcmp(optarg, "LOAD") == 0) {
359 strcpy (send_buffer, "LOAD\r\nQUIT\r\n"); 320 strcpy(send_buffer, "LOAD\r\nQUIT\r\n");
360 if (strcmp (optarg, "LOAD1") == 0) 321 if (strcmp(optarg, "LOAD1") == 0)
361 vars_to_check = LOAD1; 322 vars_to_check = LOAD1;
362 else if (strcmp (optarg, "LOAD5") == 0) 323 else if (strcmp(optarg, "LOAD5") == 0)
363 vars_to_check = LOAD5; 324 vars_to_check = LOAD5;
364 else if (strcmp (optarg, "LOAD15") == 0) 325 else if (strcmp(optarg, "LOAD15") == 0)
365 vars_to_check = LOAD15; 326 vars_to_check = LOAD15;
366 } 327 } else if (strcmp(optarg, "UPTIME") == 0) {
367 else if (strcmp (optarg, "UPTIME") == 0) {
368 vars_to_check = UPTIME; 328 vars_to_check = UPTIME;
369 strcpy (send_buffer, "UPTIME\r\n"); 329 strcpy(send_buffer, "UPTIME\r\n");
370 } 330 } else if (strstr(optarg, "PROC") == optarg) {
371 else if (strstr (optarg, "PROC") == optarg) {
372 vars_to_check = PROCS; 331 vars_to_check = PROCS;
373 process_name = strscpy (process_name, optarg + 4); 332 process_name = strscpy(process_name, optarg + 4);
374 sprintf (send_buffer, "PROCESS %s\r\n", process_name); 333 sprintf(send_buffer, "PROCESS %s\r\n", process_name);
375 } 334 } else if (strstr(optarg, "NET") == optarg) {
376 else if (strstr (optarg, "NET") == optarg) {
377 vars_to_check = NETSTAT; 335 vars_to_check = NETSTAT;
378 netstat_port = atoi (optarg + 3); 336 netstat_port = atoi(optarg + 3);
379 sprintf (send_buffer, "NETSTAT %d\r\n", netstat_port); 337 sprintf(send_buffer, "NETSTAT %d\r\n", netstat_port);
380 } 338 } else if (strstr(optarg, "DPU") == optarg) {
381 else if (strstr (optarg, "DPU") == optarg) {
382 vars_to_check = DPU; 339 vars_to_check = DPU;
383 strcpy (send_buffer, "DISKSPACE\r\n"); 340 strcpy(send_buffer, "DISKSPACE\r\n");
384 disk_name = strscpy (disk_name, optarg + 3); 341 disk_name = strscpy(disk_name, optarg + 3);
385 } 342 } else
386 else
387 return ERROR; 343 return ERROR;
388 break; 344 break;
389 case 'w': /* warning threshold */ 345 case 'w': /* warning threshold */
390 warning_value = strtoul (optarg, NULL, 10); 346 warning_value = strtoul(optarg, NULL, 10);
391 check_warning_value = true; 347 check_warning_value = true;
392 break; 348 break;
393 case 'c': /* critical threshold */ 349 case 'c': /* critical threshold */
394 critical_value = strtoul (optarg, NULL, 10); 350 critical_value = strtoul(optarg, NULL, 10);
395 check_critical_value = true; 351 check_critical_value = true;
396 break; 352 break;
397 case 't': /* timeout */ 353 case 't': /* timeout */
398 socket_timeout = atoi (optarg); 354 socket_timeout = atoi(optarg);
399 if (socket_timeout <= 0) 355 if (socket_timeout <= 0)
400 return ERROR; 356 return ERROR;
401 } 357 }
402
403 } 358 }
404 return OK; 359 return OK;
405} 360}
406 361
407 362void print_help(void) {
408void
409print_help (void)
410{
411 char *myport; 363 char *myport;
412 xasprintf (&myport, "%d", PORT); 364 xasprintf(&myport, "%d", PORT);
413 365
414 print_revision (progname, NP_VERSION); 366 print_revision(progname, NP_VERSION);
415 367
416 printf ("Copyright (c) 1999 Ethan Galstad <nagios@nagios.org>\n"); 368 printf("Copyright (c) 1999 Ethan Galstad <nagios@nagios.org>\n");
417 printf (COPYRIGHT, copyright, email); 369 printf(COPYRIGHT, copyright, email);
418 370
419 printf ("%s\n", _("This plugin attempts to contact the Over-CR collector daemon running on the")); 371 printf("%s\n", _("This plugin attempts to contact the Over-CR collector daemon running on the"));
420 printf ("%s\n", _("remote UNIX server in order to gather the requested system information.")); 372 printf("%s\n", _("remote UNIX server in order to gather the requested system information."));
421 373
422 printf ("\n\n"); 374 printf("\n\n");
423 375
424 print_usage (); 376 print_usage();
425 377
426 printf (UT_HELP_VRSN); 378 printf(UT_HELP_VRSN);
427 printf (UT_EXTRA_OPTS); 379 printf(UT_EXTRA_OPTS);
428 380
429 printf (UT_HOST_PORT, 'p', myport); 381 printf(UT_HOST_PORT, 'p', myport);
430 382
431 printf (" %s\n", "-w, --warning=INTEGER"); 383 printf(" %s\n", "-w, --warning=INTEGER");
432 printf (" %s\n", _("Threshold which will result in a warning status")); 384 printf(" %s\n", _("Threshold which will result in a warning status"));
433 printf (" %s\n", "-c, --critical=INTEGER"); 385 printf(" %s\n", "-c, --critical=INTEGER");
434 printf (" %s\n", _("Threshold which will result in a critical status")); 386 printf(" %s\n", _("Threshold which will result in a critical status"));
435 printf (" %s\n", "-v, --variable=STRING"); 387 printf(" %s\n", "-v, --variable=STRING");
436 printf (" %s\n", _("Variable to check. Valid variables include:")); 388 printf(" %s\n", _("Variable to check. Valid variables include:"));
437 printf (" %s\n", _("LOAD1 = 1 minute average CPU load")); 389 printf(" %s\n", _("LOAD1 = 1 minute average CPU load"));
438 printf (" %s\n", _("LOAD5 = 5 minute average CPU load")); 390 printf(" %s\n", _("LOAD5 = 5 minute average CPU load"));
439 printf (" %s\n", _("LOAD15 = 15 minute average CPU load")); 391 printf(" %s\n", _("LOAD15 = 15 minute average CPU load"));
440 printf (" %s\n", _("DPU<filesys> = percent used disk space on filesystem <filesys>")); 392 printf(" %s\n", _("DPU<filesys> = percent used disk space on filesystem <filesys>"));
441 printf (" %s\n", _("PROC<process> = number of running processes with name <process>")); 393 printf(" %s\n", _("PROC<process> = number of running processes with name <process>"));
442 printf (" %s\n", _("NET<port> = number of active connections on TCP port <port>")); 394 printf(" %s\n", _("NET<port> = number of active connections on TCP port <port>"));
443 printf (" %s\n", _("UPTIME = system uptime in seconds")); 395 printf(" %s\n", _("UPTIME = system uptime in seconds"));
444 396
445 printf (UT_CONN_TIMEOUT, DEFAULT_SOCKET_TIMEOUT); 397 printf(UT_CONN_TIMEOUT, DEFAULT_SOCKET_TIMEOUT);
446 398
447 printf (UT_VERBOSE); 399 printf(UT_VERBOSE);
448 400
449 printf ("\n"); 401 printf("\n");
450 printf ("%s\n", _("This plugin requires that Eric Molitors' Over-CR collector daemon be")); 402 printf("%s\n", _("This plugin requires that Eric Molitors' Over-CR collector daemon be"));
451 printf ("%s\n", _("running on the remote server.")); 403 printf("%s\n", _("running on the remote server."));
452 printf ("%s\n", _("Over-CR can be downloaded from http://www.molitor.org/overcr")); 404 printf("%s\n", _("Over-CR can be downloaded from http://www.molitor.org/overcr"));
453 printf ("%s\n", _("This plugin was tested with version 0.99.53 of the Over-CR collector")); 405 printf("%s\n", _("This plugin was tested with version 0.99.53 of the Over-CR collector"));
454 406
455 printf ("\n"); 407 printf("\n");
456 printf ("%s\n", _("Notes:")); 408 printf("%s\n", _("Notes:"));
457 printf (" %s\n", _("For the available options, the critical threshold value should always be")); 409 printf(" %s\n", _("For the available options, the critical threshold value should always be"));
458 printf (" %s\n", _("higher than the warning threshold value, EXCEPT with the uptime variable")); 410 printf(" %s\n", _("higher than the warning threshold value, EXCEPT with the uptime variable"));
459 411
460 printf (UT_SUPPORT); 412 printf(UT_SUPPORT);
461} 413}
462 414
463 415void print_usage(void) {
464void 416 printf("%s\n", _("Usage:"));
465print_usage (void) 417 printf("%s -H host [-p port] [-v variable] [-w warning] [-c critical] [-t timeout]\n", progname);
466{
467 printf ("%s\n", _("Usage:"));
468 printf ("%s -H host [-p port] [-v variable] [-w warning] [-c critical] [-t timeout]\n", progname);
469} 418}