diff options
Diffstat (limited to 'plugins')
45 files changed, 370 insertions, 399 deletions
diff --git a/plugins/check_by_ssh.c b/plugins/check_by_ssh.c index 6daa1a11..8f6cde99 100644 --- a/plugins/check_by_ssh.c +++ b/plugins/check_by_ssh.c | |||
| @@ -14,6 +14,8 @@ | |||
| 14 | along with this program; if not, write to the Free Software | 14 | along with this program; if not, write to the Free Software |
| 15 | Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | 15 | Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
| 16 | 16 | ||
| 17 | $Id$ | ||
| 18 | |||
| 17 | *****************************************************************************/ | 19 | *****************************************************************************/ |
| 18 | 20 | ||
| 19 | const char *progname = "check_by_ssh"; | 21 | const char *progname = "check_by_ssh"; |
| @@ -67,7 +69,7 @@ main (int argc, char **argv) | |||
| 67 | 69 | ||
| 68 | /* process arguments */ | 70 | /* process arguments */ |
| 69 | if (process_arguments (argc, argv) == ERROR) | 71 | if (process_arguments (argc, argv) == ERROR) |
| 70 | usage (_("Could not parse arguments\n")); | 72 | usage (_("check_by_ssh: could not parse arguments\n")); |
| 71 | 73 | ||
| 72 | 74 | ||
| 73 | /* Set signal handling and alarm timeout */ | 75 | /* Set signal handling and alarm timeout */ |
| @@ -214,10 +216,11 @@ process_arguments (int argc, char **argv) | |||
| 214 | 216 | ||
| 215 | switch (c) { | 217 | switch (c) { |
| 216 | case '?': /* help */ | 218 | case '?': /* help */ |
| 219 | printf (_("%s: Unknown argument: %s\n\n"), progname, optarg); | ||
| 217 | print_usage (); | 220 | print_usage (); |
| 218 | exit (STATE_UNKNOWN); | 221 | exit (STATE_UNKNOWN); |
| 219 | case 'V': /* version */ | 222 | case 'V': /* version */ |
| 220 | print_revision (progname, "$Revision$"); | 223 | print_revision (progname, revision); |
| 221 | exit (STATE_OK); | 224 | exit (STATE_OK); |
| 222 | case 'h': /* help */ | 225 | case 'h': /* help */ |
| 223 | print_help (); | 226 | print_help (); |
| @@ -233,12 +236,12 @@ process_arguments (int argc, char **argv) | |||
| 233 | break; | 236 | break; |
| 234 | case 'H': /* host */ | 237 | case 'H': /* host */ |
| 235 | if (!is_host (optarg)) | 238 | if (!is_host (optarg)) |
| 236 | usage2 (_("Invalid hostname/adress"), optarg); | 239 | usage2 (_("Invalid hostname/address"), optarg); |
| 237 | hostname = optarg; | 240 | hostname = optarg; |
| 238 | break; | 241 | break; |
| 239 | case 'p': /* port number */ | 242 | case 'p': /* port number */ |
| 240 | if (!is_integer (optarg)) | 243 | if (!is_integer (optarg)) |
| 241 | usage2 (_("port must be a positive integer"), optarg); | 244 | usage2 (_("Port must be a positive integer"), optarg); |
| 242 | asprintf (&comm,"%s -p %s", comm, optarg); | 245 | asprintf (&comm,"%s -p %s", comm, optarg); |
| 243 | break; | 246 | break; |
| 244 | case 'O': /* output file */ | 247 | case 'O': /* output file */ |
| @@ -292,7 +295,7 @@ process_arguments (int argc, char **argv) | |||
| 292 | if (c <= argc) { | 295 | if (c <= argc) { |
| 293 | die (STATE_UNKNOWN, _("%s: You must provide a host name\n"), progname); | 296 | die (STATE_UNKNOWN, _("%s: You must provide a host name\n"), progname); |
| 294 | } else if (!is_host (argv[c])) | 297 | } else if (!is_host (argv[c])) |
| 295 | die (STATE_UNKNOWN, "%s: %s %s\n", progname, _("Invalid host name"), argv[c]); | 298 | die (STATE_UNKNOWN, "%s: %s %s\n", progname, _("Invalid hostname/address"), argv[c]); |
| 296 | hostname = argv[c++]; | 299 | hostname = argv[c++]; |
| 297 | } | 300 | } |
| 298 | 301 | ||
| @@ -317,8 +320,6 @@ process_arguments (int argc, char **argv) | |||
| 317 | 320 | ||
| 318 | 321 | ||
| 319 | 322 | ||
| 320 | |||
| 321 | |||
| 322 | int | 323 | int |
| 323 | validate_arguments (void) | 324 | validate_arguments (void) |
| 324 | { | 325 | { |
| @@ -408,8 +409,6 @@ $ cat /tmp/foo\n\ | |||
| 408 | 409 | ||
| 409 | 410 | ||
| 410 | 411 | ||
| 411 | |||
| 412 | |||
| 413 | void | 412 | void |
| 414 | print_usage (void) | 413 | print_usage (void) |
| 415 | { | 414 | { |
diff --git a/plugins/check_dig.c b/plugins/check_dig.c index 5b472eca..a500cdcf 100644 --- a/plugins/check_dig.c +++ b/plugins/check_dig.c | |||
| @@ -14,6 +14,8 @@ | |||
| 14 | along with this program; if not, write to the Free Software | 14 | along with this program; if not, write to the Free Software |
| 15 | Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | 15 | Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
| 16 | 16 | ||
| 17 | $Id$ | ||
| 18 | |||
| 17 | *****************************************************************************/ | 19 | *****************************************************************************/ |
| 18 | 20 | ||
| 19 | #include "common.h" | 21 | #include "common.h" |
| @@ -128,7 +130,6 @@ main (int argc, char **argv) | |||
| 128 | asprintf (&output, _("Server not found in ANSWER SECTION")); | 130 | asprintf (&output, _("Server not found in ANSWER SECTION")); |
| 129 | result = STATE_WARNING; | 131 | result = STATE_WARNING; |
| 130 | } | 132 | } |
| 131 | |||
| 132 | } | 133 | } |
| 133 | 134 | ||
| 134 | } | 135 | } |
| @@ -181,8 +182,6 @@ main (int argc, char **argv) | |||
| 181 | 182 | ||
| 182 | 183 | ||
| 183 | 184 | ||
| 184 | |||
| 185 | |||
| 186 | /* process command-line arguments */ | 185 | /* process command-line arguments */ |
| 187 | int | 186 | int |
| 188 | process_arguments (int argc, char **argv) | 187 | process_arguments (int argc, char **argv) |
| @@ -215,7 +214,9 @@ process_arguments (int argc, char **argv) | |||
| 215 | 214 | ||
| 216 | switch (c) { | 215 | switch (c) { |
| 217 | case '?': /* help */ | 216 | case '?': /* help */ |
| 218 | usage3 (_("Unknown argument"), optopt); | 217 | printf (_("%s: Unknown argument: %s\n\n"), progname, optarg); |
| 218 | print_usage (); | ||
| 219 | exit (STATE_UNKNOWN); | ||
| 219 | case 'h': /* help */ | 220 | case 'h': /* help */ |
| 220 | print_help (); | 221 | print_help (); |
| 221 | exit (STATE_OK); | 222 | exit (STATE_OK); |
| @@ -227,7 +228,7 @@ process_arguments (int argc, char **argv) | |||
| 227 | dns_server = optarg; | 228 | dns_server = optarg; |
| 228 | } | 229 | } |
| 229 | else { | 230 | else { |
| 230 | usage2 (_("Invalid hostname/adress"), optarg); | 231 | usage2 (_("Invalid hostname/address"), optarg); |
| 231 | } | 232 | } |
| 232 | break; | 233 | break; |
| 233 | case 'p': /* server port */ | 234 | case 'p': /* server port */ |
| @@ -235,7 +236,7 @@ process_arguments (int argc, char **argv) | |||
| 235 | server_port = atoi (optarg); | 236 | server_port = atoi (optarg); |
| 236 | } | 237 | } |
| 237 | else { | 238 | else { |
| 238 | usage2 (_("port must be a positive integer"), optarg); | 239 | usage2 (_("Port must be a positive integer"), optarg); |
| 239 | } | 240 | } |
| 240 | break; | 241 | break; |
| 241 | case 'l': /* address to lookup */ | 242 | case 'l': /* address to lookup */ |
| @@ -284,7 +285,7 @@ process_arguments (int argc, char **argv) | |||
| 284 | dns_server = argv[c]; | 285 | dns_server = argv[c]; |
| 285 | } | 286 | } |
| 286 | else { | 287 | else { |
| 287 | usage2 (_("Invalid hostname/adress"), argv[c]); | 288 | usage2 (_("Invalid hostname/address"), argv[c]); |
| 288 | } | 289 | } |
| 289 | } | 290 | } |
| 290 | else { | 291 | else { |
| @@ -297,8 +298,6 @@ process_arguments (int argc, char **argv) | |||
| 297 | 298 | ||
| 298 | 299 | ||
| 299 | 300 | ||
| 300 | |||
| 301 | |||
| 302 | int | 301 | int |
| 303 | validate_arguments (void) | 302 | validate_arguments (void) |
| 304 | { | 303 | { |
| @@ -307,9 +306,6 @@ validate_arguments (void) | |||
| 307 | 306 | ||
| 308 | 307 | ||
| 309 | 308 | ||
| 310 | |||
| 311 | |||
| 312 | |||
| 313 | void | 309 | void |
| 314 | print_help (void) | 310 | print_help (void) |
| 315 | { | 311 | { |
| @@ -354,7 +350,6 @@ print_help (void) | |||
| 354 | 350 | ||
| 355 | 351 | ||
| 356 | 352 | ||
| 357 | |||
| 358 | void | 353 | void |
| 359 | print_usage (void) | 354 | print_usage (void) |
| 360 | { | 355 | { |
diff --git a/plugins/check_disk.c b/plugins/check_disk.c index c8239250..437bbbf2 100644 --- a/plugins/check_disk.c +++ b/plugins/check_disk.c | |||
| @@ -14,6 +14,8 @@ | |||
| 14 | along with this program; if not, write to the Free Software | 14 | along with this program; if not, write to the Free Software |
| 15 | Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | 15 | Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
| 16 | 16 | ||
| 17 | $Id$ | ||
| 18 | |||
| 17 | *****************************************************************************/ | 19 | *****************************************************************************/ |
| 18 | 20 | ||
| 19 | const char *progname = "check_disk"; | 21 | const char *progname = "check_disk"; |
| @@ -133,7 +135,7 @@ int display_mntp = FALSE; | |||
| 133 | static struct mount_entry *mount_list; | 135 | static struct mount_entry *mount_list; |
| 134 | 136 | ||
| 135 | 137 | ||
| 136 | 138 | ||
| 137 | int | 139 | int |
| 138 | main (int argc, char **argv) | 140 | main (int argc, char **argv) |
| 139 | { | 141 | { |
| @@ -162,7 +164,7 @@ main (int argc, char **argv) | |||
| 162 | mount_list = read_filesystem_list (0); | 164 | mount_list = read_filesystem_list (0); |
| 163 | 165 | ||
| 164 | if (process_arguments (argc, argv) != OK) | 166 | if (process_arguments (argc, argv) != OK) |
| 165 | usage (_("Could not parse arguments\n")); | 167 | usage (_("check_disk: could not parse arguments\n")); |
| 166 | 168 | ||
| 167 | for (me = mount_list; me; me = me->me_next) { | 169 | for (me = mount_list; me; me = me->me_next) { |
| 168 | 170 | ||
| @@ -240,7 +242,6 @@ main (int argc, char **argv) | |||
| 240 | 242 | ||
| 241 | 243 | ||
| 242 | 244 | ||
| 243 | |||
| 244 | /* process command-line arguments */ | 245 | /* process command-line arguments */ |
| 245 | int | 246 | int |
| 246 | process_arguments (int argc, char **argv) | 247 | process_arguments (int argc, char **argv) |
| @@ -437,8 +438,9 @@ process_arguments (int argc, char **argv) | |||
| 437 | print_help (); | 438 | print_help (); |
| 438 | exit (STATE_OK); | 439 | exit (STATE_OK); |
| 439 | case '?': /* help */ | 440 | case '?': /* help */ |
| 440 | usage (_("Unknow argument\n")); | 441 | printf (_("%s: Unknown argument: %s\n\n"), progname, optarg); |
| 441 | break; | 442 | print_usage (); |
| 443 | exit (STATE_UNKNOWN); | ||
| 442 | } | 444 | } |
| 443 | } | 445 | } |
| 444 | 446 | ||
| @@ -479,6 +481,7 @@ process_arguments (int argc, char **argv) | |||
| 479 | } | 481 | } |
| 480 | 482 | ||
| 481 | 483 | ||
| 484 | |||
| 482 | void | 485 | void |
| 483 | print_path (const char *mypath) | 486 | print_path (const char *mypath) |
| 484 | { | 487 | { |
| @@ -490,6 +493,8 @@ print_path (const char *mypath) | |||
| 490 | return; | 493 | return; |
| 491 | } | 494 | } |
| 492 | 495 | ||
| 496 | |||
| 497 | |||
| 493 | int | 498 | int |
| 494 | validate_arguments (uintmax_t w, uintmax_t c, double wp, double cp, char *mypath) | 499 | validate_arguments (uintmax_t w, uintmax_t c, double wp, double cp, char *mypath) |
| 495 | { | 500 | { |
| @@ -523,7 +528,6 @@ INPUT ERROR: C_DF (%lu) should be less than W_DF (%lu) and both should be greate | |||
| 523 | 528 | ||
| 524 | 529 | ||
| 525 | 530 | ||
| 526 | |||
| 527 | int | 531 | int |
| 528 | check_disk (double usp, double free_disk) | 532 | check_disk (double usp, double free_disk) |
| 529 | { | 533 | { |
| @@ -564,8 +568,6 @@ walk_name_list (struct name_list *list, const char *name) | |||
| 564 | 568 | ||
| 565 | 569 | ||
| 566 | 570 | ||
| 567 | |||
| 568 | |||
| 569 | void | 571 | void |
| 570 | print_help (void) | 572 | print_help (void) |
| 571 | { | 573 | { |
| @@ -631,7 +633,6 @@ and generates an alert if free space is less than one of the threshold values.") | |||
| 631 | 633 | ||
| 632 | 634 | ||
| 633 | 635 | ||
| 634 | |||
| 635 | void | 636 | void |
| 636 | print_usage (void) | 637 | print_usage (void) |
| 637 | { | 638 | { |
diff --git a/plugins/check_dns.c b/plugins/check_dns.c index 6c08c277..fa7fbc1e 100644 --- a/plugins/check_dns.c +++ b/plugins/check_dns.c | |||
| @@ -16,6 +16,8 @@ | |||
| 16 | 16 | ||
| 17 | LIMITATION: nslookup on Solaris 7 can return output over 2 lines, which will not | 17 | LIMITATION: nslookup on Solaris 7 can return output over 2 lines, which will not |
| 18 | be picked up by this plugin | 18 | be picked up by this plugin |
| 19 | |||
| 20 | $Id$ | ||
| 19 | 21 | ||
| 20 | ******************************************************************************/ | 22 | ******************************************************************************/ |
| 21 | 23 | ||
| @@ -71,7 +73,7 @@ main (int argc, char **argv) | |||
| 71 | } | 73 | } |
| 72 | 74 | ||
| 73 | if (process_arguments (argc, argv) != OK) { | 75 | if (process_arguments (argc, argv) != OK) { |
| 74 | print_usage (); | 76 | usage (_("check_dns: could not parse arguments\n")); |
| 75 | return STATE_UNKNOWN; | 77 | return STATE_UNKNOWN; |
| 76 | } | 78 | } |
| 77 | 79 | ||
| @@ -213,6 +215,8 @@ main (int argc, char **argv) | |||
| 213 | return result; | 215 | return result; |
| 214 | } | 216 | } |
| 215 | 217 | ||
| 218 | |||
| 219 | |||
| 216 | int | 220 | int |
| 217 | error_scan (char *input_buffer) | 221 | error_scan (char *input_buffer) |
| 218 | { | 222 | { |
| @@ -261,6 +265,8 @@ error_scan (char *input_buffer) | |||
| 261 | 265 | ||
| 262 | } | 266 | } |
| 263 | 267 | ||
| 268 | |||
| 269 | |||
| 264 | /* process command-line arguments */ | 270 | /* process command-line arguments */ |
| 265 | int | 271 | int |
| 266 | process_arguments (int argc, char **argv) | 272 | process_arguments (int argc, char **argv) |
| @@ -320,7 +326,7 @@ process_arguments (int argc, char **argv) | |||
| 320 | /* TODO: this is_host check is probably unnecessary. */ | 326 | /* TODO: this is_host check is probably unnecessary. */ |
| 321 | /* Better to confirm nslookup response matches */ | 327 | /* Better to confirm nslookup response matches */ |
| 322 | if (is_host (optarg) == FALSE) { | 328 | if (is_host (optarg) == FALSE) { |
| 323 | printf (_("Invalid server name/address\n\n")); | 329 | printf (_("Invalid hostname/address\n\n")); |
| 324 | print_usage (); | 330 | print_usage (); |
| 325 | exit (STATE_UNKNOWN); | 331 | exit (STATE_UNKNOWN); |
| 326 | } | 332 | } |
| @@ -370,6 +376,8 @@ process_arguments (int argc, char **argv) | |||
| 370 | return validate_arguments (); | 376 | return validate_arguments (); |
| 371 | } | 377 | } |
| 372 | 378 | ||
| 379 | |||
| 380 | |||
| 373 | int | 381 | int |
| 374 | validate_arguments () | 382 | validate_arguments () |
| 375 | { | 383 | { |
| @@ -381,9 +389,6 @@ validate_arguments () | |||
| 381 | 389 | ||
| 382 | 390 | ||
| 383 | 391 | ||
| 384 | |||
| 385 | |||
| 386 | |||
| 387 | void | 392 | void |
| 388 | print_help (void) | 393 | print_help (void) |
| 389 | { | 394 | { |
| @@ -419,7 +424,6 @@ specified in /etc/resolv.conf will be used.\n")); | |||
| 419 | 424 | ||
| 420 | 425 | ||
| 421 | 426 | ||
| 422 | |||
| 423 | void | 427 | void |
| 424 | print_usage (void) | 428 | print_usage (void) |
| 425 | { | 429 | { |
diff --git a/plugins/check_dummy.c b/plugins/check_dummy.c index 7f508349..a99e38a7 100644 --- a/plugins/check_dummy.c +++ b/plugins/check_dummy.c | |||
| @@ -14,6 +14,8 @@ | |||
| 14 | along with this program; if not, write to the Free Software | 14 | along with this program; if not, write to the Free Software |
| 15 | Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | 15 | Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
| 16 | 16 | ||
| 17 | $Id$ | ||
| 18 | |||
| 17 | ******************************************************************************/ | 19 | ******************************************************************************/ |
| 18 | 20 | ||
| 19 | #include "common.h" | 21 | #include "common.h" |
diff --git a/plugins/check_fping.c b/plugins/check_fping.c index 2dba2d58..8647330c 100644 --- a/plugins/check_fping.c +++ b/plugins/check_fping.c | |||
| @@ -14,6 +14,8 @@ | |||
| 14 | along with this program; if not, write to the Free Software | 14 | along with this program; if not, write to the Free Software |
| 15 | Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | 15 | Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
| 16 | 16 | ||
| 17 | $Id$ | ||
| 18 | |||
| 17 | ******************************************************************************/ | 19 | ******************************************************************************/ |
| 18 | 20 | ||
| 19 | const char *progname = "check_fping"; | 21 | const char *progname = "check_fping"; |
| @@ -66,7 +68,7 @@ main (int argc, char **argv) | |||
| 66 | textdomain (PACKAGE); | 68 | textdomain (PACKAGE); |
| 67 | 69 | ||
| 68 | if (process_arguments (argc, argv) == ERROR) | 70 | if (process_arguments (argc, argv) == ERROR) |
| 69 | usage (_("Could not parse arguments\n")); | 71 | usage (_("check_fping: could not parse arguments\n")); |
| 70 | 72 | ||
| 71 | server = strscpy (server, server_name); | 73 | server = strscpy (server, server_name); |
| 72 | 74 | ||
| @@ -116,7 +118,6 @@ main (int argc, char **argv) | |||
| 116 | 118 | ||
| 117 | 119 | ||
| 118 | 120 | ||
| 119 | |||
| 120 | int | 121 | int |
| 121 | textscan (char *buf) | 122 | textscan (char *buf) |
| 122 | { | 123 | { |
| @@ -195,7 +196,6 @@ textscan (char *buf) | |||
| 195 | 196 | ||
| 196 | return status; | 197 | return status; |
| 197 | } | 198 | } |
| 198 | |||
| 199 | 199 | ||
| 200 | 200 | ||
| 201 | 201 | ||
| @@ -308,8 +308,6 @@ process_arguments (int argc, char **argv) | |||
| 308 | 308 | ||
| 309 | 309 | ||
| 310 | 310 | ||
| 311 | |||
| 312 | |||
| 313 | int | 311 | int |
| 314 | get_threshold (char *arg, char *rv[2]) | 312 | get_threshold (char *arg, char *rv[2]) |
| 315 | { | 313 | { |
| @@ -352,8 +350,6 @@ get_threshold (char *arg, char *rv[2]) | |||
| 352 | 350 | ||
| 353 | 351 | ||
| 354 | 352 | ||
| 355 | |||
| 356 | |||
| 357 | void | 353 | void |
| 358 | print_help (void) | 354 | print_help (void) |
| 359 | { | 355 | { |
| @@ -398,7 +394,6 @@ percentage of packet loss to trigger an alarm state.\n")); | |||
| 398 | 394 | ||
| 399 | 395 | ||
| 400 | 396 | ||
| 401 | |||
| 402 | void | 397 | void |
| 403 | print_usage (void) | 398 | print_usage (void) |
| 404 | { | 399 | { |
diff --git a/plugins/check_game.c b/plugins/check_game.c index 511e9617..8b2a6c42 100644 --- a/plugins/check_game.c +++ b/plugins/check_game.c | |||
| @@ -14,6 +14,7 @@ | |||
| 14 | * along with this program; if not, write to the Free Software | 14 | * along with this program; if not, write to the Free Software |
| 15 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | 15 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
| 16 | * | 16 | * |
| 17 | * $Id$ | ||
| 17 | *****************************************************************************/ | 18 | *****************************************************************************/ |
| 18 | 19 | ||
| 19 | const char *progname = "check_game"; | 20 | const char *progname = "check_game"; |
| @@ -64,9 +65,12 @@ main (int argc, char **argv) | |||
| 64 | bindtextdomain (PACKAGE, LOCALEDIR); | 65 | bindtextdomain (PACKAGE, LOCALEDIR); |
| 65 | textdomain (PACKAGE); | 66 | textdomain (PACKAGE); |
| 66 | 67 | ||
| 67 | result = process_arguments (argc, argv); | 68 | // result = process_arguments (argc, argv); |
| 69 | |||
| 70 | if (process_arguments (argc, argv) == ERROR) | ||
| 71 | usage (_("check_game: could not parse arguments\n")); | ||
| 68 | 72 | ||
| 69 | if (result != OK) { | 73 | /* if (result != OK) { |
| 70 | printf (_("Incorrect arguments supplied\n")); | 74 | printf (_("Incorrect arguments supplied\n")); |
| 71 | printf ("\n"); | 75 | printf ("\n"); |
| 72 | print_revision (progname, revision); | 76 | print_revision (progname, revision); |
| @@ -75,6 +79,7 @@ main (int argc, char **argv) | |||
| 75 | printf ("\n"); | 79 | printf ("\n"); |
| 76 | return STATE_UNKNOWN; | 80 | return STATE_UNKNOWN; |
| 77 | } | 81 | } |
| 82 | */ | ||
| 78 | 83 | ||
| 79 | result = STATE_OK; | 84 | result = STATE_OK; |
| 80 | 85 | ||
| @@ -302,7 +307,6 @@ validate_arguments (void) | |||
| 302 | 307 | ||
| 303 | 308 | ||
| 304 | 309 | ||
| 305 | |||
| 306 | void | 310 | void |
| 307 | print_help (void) | 311 | print_help (void) |
| 308 | { | 312 | { |
diff --git a/plugins/check_hpjd.c b/plugins/check_hpjd.c index 5699570c..af6044a0 100644 --- a/plugins/check_hpjd.c +++ b/plugins/check_hpjd.c | |||
| @@ -14,6 +14,7 @@ | |||
| 14 | * along with this program; if not, write to the Free Software | 14 | * along with this program; if not, write to the Free Software |
| 15 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | 15 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
| 16 | * | 16 | * |
| 17 | * $Id$ | ||
| 17 | *****************************************************************************/ | 18 | *****************************************************************************/ |
| 18 | 19 | ||
| 19 | #include "common.h" | 20 | #include "common.h" |
| @@ -84,7 +85,7 @@ main (int argc, char **argv) | |||
| 84 | textdomain (PACKAGE); | 85 | textdomain (PACKAGE); |
| 85 | 86 | ||
| 86 | if (process_arguments (argc, argv) != OK) | 87 | if (process_arguments (argc, argv) != OK) |
| 87 | usage (_("Incorrect arguments supplied\n")); | 88 | usage (_("check_hpjd: could not parse arguments\n")); |
| 88 | 89 | ||
| 89 | /* removed ' 2>1' at end of command 10/27/1999 - EG */ | 90 | /* removed ' 2>1' at end of command 10/27/1999 - EG */ |
| 90 | /* create the query string */ | 91 | /* create the query string */ |
| @@ -285,8 +286,6 @@ main (int argc, char **argv) | |||
| 285 | 286 | ||
| 286 | 287 | ||
| 287 | 288 | ||
| 288 | |||
| 289 | |||
| 290 | /* process command-line arguments */ | 289 | /* process command-line arguments */ |
| 291 | int | 290 | int |
| 292 | process_arguments (int argc, char **argv) | 291 | process_arguments (int argc, char **argv) |
| @@ -321,7 +320,7 @@ process_arguments (int argc, char **argv) | |||
| 321 | address = strscpy(address, optarg) ; | 320 | address = strscpy(address, optarg) ; |
| 322 | } | 321 | } |
| 323 | else { | 322 | else { |
| 324 | usage2 (_("Invalid host name"), optarg); | 323 | usage2 (_("Invalid hostname/address"), optarg); |
| 325 | } | 324 | } |
| 326 | break; | 325 | break; |
| 327 | case 'C': /* community */ | 326 | case 'C': /* community */ |
| @@ -334,7 +333,9 @@ process_arguments (int argc, char **argv) | |||
| 334 | print_help (); | 333 | print_help (); |
| 335 | exit (STATE_OK); | 334 | exit (STATE_OK); |
| 336 | case '?': /* help */ | 335 | case '?': /* help */ |
| 337 | usage (_("Invalid argument\n")); | 336 | printf (_("%s: Unknown argument: %s\n\n"), progname, optarg); |
| 337 | print_usage (); | ||
| 338 | exit (STATE_UNKNOWN); | ||
| 338 | } | 339 | } |
| 339 | } | 340 | } |
| 340 | 341 | ||
| @@ -344,7 +345,7 @@ process_arguments (int argc, char **argv) | |||
| 344 | address = argv[c++]; | 345 | address = argv[c++]; |
| 345 | } | 346 | } |
| 346 | else { | 347 | else { |
| 347 | usage2 (_("Invalid host name"), argv[c]); | 348 | usage2 (_("Invalid hostname/address"), argv[c]); |
| 348 | } | 349 | } |
| 349 | } | 350 | } |
| 350 | 351 | ||
| @@ -360,8 +361,6 @@ process_arguments (int argc, char **argv) | |||
| 360 | 361 | ||
| 361 | 362 | ||
| 362 | 363 | ||
| 363 | |||
| 364 | |||
| 365 | int | 364 | int |
| 366 | validate_arguments (void) | 365 | validate_arguments (void) |
| 367 | { | 366 | { |
| @@ -370,9 +369,6 @@ validate_arguments (void) | |||
| 370 | 369 | ||
| 371 | 370 | ||
| 372 | 371 | ||
| 373 | |||
| 374 | |||
| 375 | |||
| 376 | void | 372 | void |
| 377 | print_help (void) | 373 | print_help (void) |
| 378 | { | 374 | { |
| @@ -398,7 +394,6 @@ Net-snmp must be installed on the computer running the plugin.\n\n")); | |||
| 398 | 394 | ||
| 399 | 395 | ||
| 400 | 396 | ||
| 401 | |||
| 402 | void | 397 | void |
| 403 | print_usage (void) | 398 | print_usage (void) |
| 404 | { | 399 | { |
diff --git a/plugins/check_http.c b/plugins/check_http.c index 98005d02..748ca46e 100644 --- a/plugins/check_http.c +++ b/plugins/check_http.c | |||
| @@ -14,6 +14,8 @@ | |||
| 14 | along with this program; if not, write to the Free Software | 14 | along with this program; if not, write to the Free Software |
| 15 | Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | 15 | Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
| 16 | 16 | ||
| 17 | $Id$ | ||
| 18 | |||
| 17 | ******************************************************************************/ | 19 | ******************************************************************************/ |
| 18 | /* splint -I. -I../../plugins -I../../lib/ -I/usr/kerberos/include/ ../../plugins/check_http.c */ | 20 | /* splint -I. -I../../plugins -I../../lib/ -I/usr/kerberos/include/ ../../plugins/check_http.c */ |
| 19 | 21 | ||
| @@ -188,7 +190,7 @@ main (int argc, char **argv) | |||
| 188 | #endif | 190 | #endif |
| 189 | return result; | 191 | return result; |
| 190 | } | 192 | } |
| 191 | 193 | ||
| 192 | 194 | ||
| 193 | 195 | ||
| 194 | /* process command-line arguments */ | 196 | /* process command-line arguments */ |
| @@ -249,7 +251,9 @@ process_arguments (int argc, char **argv) | |||
| 249 | 251 | ||
| 250 | switch (c) { | 252 | switch (c) { |
| 251 | case '?': /* usage */ | 253 | case '?': /* usage */ |
| 252 | usage3 (_("unknown argument"), optopt); | 254 | printf (_("%s: Unknown argument: %s\n\n"), progname, optarg); |
| 255 | print_usage (); | ||
| 256 | exit (STATE_UNKNOWN); | ||
| 253 | break; | 257 | break; |
| 254 | case 'h': /* help */ | 258 | case 'h': /* help */ |
| 255 | print_help (); | 259 | print_help (); |
| @@ -267,7 +271,7 @@ process_arguments (int argc, char **argv) | |||
| 267 | break; | 271 | break; |
| 268 | case 'c': /* critical time threshold */ | 272 | case 'c': /* critical time threshold */ |
| 269 | if (!is_nonnegative (optarg)) | 273 | if (!is_nonnegative (optarg)) |
| 270 | usage2 (_("invalid critical threshold"), optarg); | 274 | usage2 (_("Critical threshold must be integer"), optarg); |
| 271 | else { | 275 | else { |
| 272 | critical_time = strtod (optarg, NULL); | 276 | critical_time = strtod (optarg, NULL); |
| 273 | check_critical_time = TRUE; | 277 | check_critical_time = TRUE; |
| @@ -275,7 +279,7 @@ process_arguments (int argc, char **argv) | |||
| 275 | break; | 279 | break; |
| 276 | case 'w': /* warning time threshold */ | 280 | case 'w': /* warning time threshold */ |
| 277 | if (!is_nonnegative (optarg)) | 281 | if (!is_nonnegative (optarg)) |
| 278 | usage2 (_("invalid warning threshold"), optarg); | 282 | usage2 (_("Warning threshold must be integer"), optarg); |
| 279 | else { | 283 | else { |
| 280 | warning_time = strtod (optarg, NULL); | 284 | warning_time = strtod (optarg, NULL); |
| 281 | check_warning_time = TRUE; | 285 | check_warning_time = TRUE; |
| @@ -304,13 +308,13 @@ process_arguments (int argc, char **argv) | |||
| 304 | case 'C': /* Check SSL cert validity */ | 308 | case 'C': /* Check SSL cert validity */ |
| 305 | #ifdef HAVE_SSL | 309 | #ifdef HAVE_SSL |
| 306 | if (!is_intnonneg (optarg)) | 310 | if (!is_intnonneg (optarg)) |
| 307 | usage2 (_("invalid certificate expiration period"), optarg); | 311 | usage2 (_("Invalid certificate expiration period"), optarg); |
| 308 | else { | 312 | else { |
| 309 | days_till_exp = atoi (optarg); | 313 | days_till_exp = atoi (optarg); |
| 310 | check_cert = TRUE; | 314 | check_cert = TRUE; |
| 311 | } | 315 | } |
| 312 | #else | 316 | #else |
| 313 | usage (_("check_http: invalid option - SSL is not available\n")); | 317 | usage (_("Invalid option - SSL is not available\n")); |
| 314 | #endif | 318 | #endif |
| 315 | break; | 319 | break; |
| 316 | case 'f': /* onredirect */ | 320 | case 'f': /* onredirect */ |
| @@ -455,7 +459,7 @@ process_arguments (int argc, char **argv) | |||
| 455 | 459 | ||
| 456 | return TRUE; | 460 | return TRUE; |
| 457 | } | 461 | } |
| 458 | 462 | ||
| 459 | 463 | ||
| 460 | 464 | ||
| 461 | /* written by lauri alanko */ | 465 | /* written by lauri alanko */ |
| @@ -498,8 +502,6 @@ base64 (const char *bin, size_t len) | |||
| 498 | buf[i] = '\0'; | 502 | buf[i] = '\0'; |
| 499 | return buf; | 503 | return buf; |
| 500 | } | 504 | } |
| 501 | |||
| 502 | |||
| 503 | 505 | ||
| 504 | 506 | ||
| 505 | 507 | ||
| @@ -613,6 +615,7 @@ parse_time_string (const char *string) | |||
| 613 | } | 615 | } |
| 614 | 616 | ||
| 615 | 617 | ||
| 618 | |||
| 616 | static void | 619 | static void |
| 617 | check_document_dates (const char *headers) | 620 | check_document_dates (const char *headers) |
| 618 | { | 621 | { |
| @@ -818,12 +821,12 @@ check_http (void) | |||
| 818 | if ( sslerr == SSL_ERROR_SSL ) { | 821 | if ( sslerr == SSL_ERROR_SSL ) { |
| 819 | die (STATE_WARNING, _("Client Certificate Required\n")); | 822 | die (STATE_WARNING, _("Client Certificate Required\n")); |
| 820 | } else { | 823 | } else { |
| 821 | die (STATE_CRITICAL, _("Error in recv()\n")); | 824 | die (STATE_CRITICAL, _("Error on receive\n")); |
| 822 | } | 825 | } |
| 823 | } | 826 | } |
| 824 | else { | 827 | else { |
| 825 | #endif | 828 | #endif |
| 826 | die (STATE_CRITICAL, _("Error in recv()\n")); | 829 | die (STATE_CRITICAL, _("Error on receive\n")); |
| 827 | #ifdef HAVE_SSL | 830 | #ifdef HAVE_SSL |
| 828 | } | 831 | } |
| 829 | #endif | 832 | #endif |
| @@ -950,7 +953,7 @@ check_http (void) | |||
| 950 | microsec = deltime (tv); | 953 | microsec = deltime (tv); |
| 951 | elapsed_time = (double)microsec / 1.0e6; | 954 | elapsed_time = (double)microsec / 1.0e6; |
| 952 | asprintf (&msg, | 955 | asprintf (&msg, |
| 953 | _("HTTP problem: %s - %.3f second response time %s%s|%s %s\n"), | 956 | _("HTTP WARNING: %s - %.3f second response time %s%s|%s %s\n"), |
| 954 | status_line, elapsed_time, timestamp, | 957 | status_line, elapsed_time, timestamp, |
| 955 | (display_html ? "</A>" : ""), | 958 | (display_html ? "</A>" : ""), |
| 956 | perfd_time (elapsed_time), perfd_size (pagesize)); | 959 | perfd_time (elapsed_time), perfd_size (pagesize)); |
| @@ -1021,7 +1024,6 @@ check_http (void) | |||
| 1021 | 1024 | ||
| 1022 | 1025 | ||
| 1023 | 1026 | ||
| 1024 | |||
| 1025 | /* per RFC 2396 */ | 1027 | /* per RFC 2396 */ |
| 1026 | #define HDR_LOCATION "%*[Ll]%*[Oo]%*[Cc]%*[Aa]%*[Tt]%*[Ii]%*[Oo]%*[Nn]: " | 1028 | #define HDR_LOCATION "%*[Ll]%*[Oo]%*[Cc]%*[Aa]%*[Tt]%*[Ii]%*[Oo]%*[Nn]: " |
| 1027 | #define URI_HTTP "%[HTPShtps]://" | 1029 | #define URI_HTTP "%[HTPShtps]://" |
| @@ -1223,6 +1225,8 @@ int connect_SSL (void) | |||
| 1223 | } | 1225 | } |
| 1224 | #endif | 1226 | #endif |
| 1225 | 1227 | ||
| 1228 | |||
| 1229 | |||
| 1226 | #ifdef HAVE_SSL | 1230 | #ifdef HAVE_SSL |
| 1227 | int | 1231 | int |
| 1228 | check_certificate (X509 ** certificate) | 1232 | check_certificate (X509 ** certificate) |
| @@ -1298,7 +1302,7 @@ check_certificate (X509 ** certificate) | |||
| 1298 | return STATE_OK; | 1302 | return STATE_OK; |
| 1299 | } | 1303 | } |
| 1300 | #endif | 1304 | #endif |
| 1301 | 1305 | ||
| 1302 | 1306 | ||
| 1303 | 1307 | ||
| 1304 | char *perfd_time (double elapsed_time) | 1308 | char *perfd_time (double elapsed_time) |
| @@ -1310,6 +1314,7 @@ char *perfd_time (double elapsed_time) | |||
| 1310 | } | 1314 | } |
| 1311 | 1315 | ||
| 1312 | 1316 | ||
| 1317 | |||
| 1313 | char *perfd_size (int page_len) | 1318 | char *perfd_size (int page_len) |
| 1314 | { | 1319 | { |
| 1315 | return perfdata ("size", page_len, "B", | 1320 | return perfdata ("size", page_len, "B", |
| @@ -1319,6 +1324,7 @@ char *perfd_size (int page_len) | |||
| 1319 | } | 1324 | } |
| 1320 | 1325 | ||
| 1321 | 1326 | ||
| 1327 | |||
| 1322 | int | 1328 | int |
| 1323 | my_recv (void) | 1329 | my_recv (void) |
| 1324 | { | 1330 | { |
| @@ -1337,6 +1343,7 @@ my_recv (void) | |||
| 1337 | } | 1343 | } |
| 1338 | 1344 | ||
| 1339 | 1345 | ||
| 1346 | |||
| 1340 | int | 1347 | int |
| 1341 | my_close (void) | 1348 | my_close (void) |
| 1342 | { | 1349 | { |
| @@ -1357,9 +1364,6 @@ my_close (void) | |||
| 1357 | 1364 | ||
| 1358 | 1365 | ||
| 1359 | 1366 | ||
| 1360 | |||
| 1361 | |||
| 1362 | |||
| 1363 | void | 1367 | void |
| 1364 | print_help (void) | 1368 | print_help (void) |
| 1365 | { | 1369 | { |
| @@ -1483,7 +1487,6 @@ the certificate is expired.\n")); | |||
| 1483 | 1487 | ||
| 1484 | 1488 | ||
| 1485 | 1489 | ||
| 1486 | |||
| 1487 | void | 1490 | void |
| 1488 | print_usage (void) | 1491 | print_usage (void) |
| 1489 | { | 1492 | { |
diff --git a/plugins/check_ide-smart.c b/plugins/check_ide-smart.c index 06deb12a..9d3c3160 100644 --- a/plugins/check_ide-smart.c +++ b/plugins/check_ide-smart.c | |||
| @@ -2,7 +2,7 @@ | |||
| 2 | * check_ide-smart v.1 - hacked version of ide-smart for Nagios | 2 | * check_ide-smart v.1 - hacked version of ide-smart for Nagios |
| 3 | * Copyright (C) 2000 Robert Dale <rdale@digital-mission.com> | 3 | * Copyright (C) 2000 Robert Dale <rdale@digital-mission.com> |
| 4 | * | 4 | * |
| 5 | * Net Saint - http://www.nagios.org | 5 | * Nagios - http://www.nagios.org |
| 6 | * | 6 | * |
| 7 | * Notes: | 7 | * Notes: |
| 8 | * ide-smart has the same functionality as before. Some return | 8 | * ide-smart has the same functionality as before. Some return |
| @@ -33,6 +33,8 @@ | |||
| 33 | * You should have received a copy of the GNU General Public License | 33 | * You should have received a copy of the GNU General Public License |
| 34 | * along with this program; if not, write to the Free Software | 34 | * along with this program; if not, write to the Free Software |
| 35 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | 35 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
| 36 | * | ||
| 37 | * $Id$ | ||
| 36 | */ | 38 | */ |
| 37 | 39 | ||
| 38 | #include "common.h" | 40 | #include "common.h" |
| @@ -137,6 +139,8 @@ enum SmartCommand | |||
| 137 | SMART_CMD_AUTO_OFFLINE | 139 | SMART_CMD_AUTO_OFFLINE |
| 138 | }; | 140 | }; |
| 139 | 141 | ||
| 142 | |||
| 143 | |||
| 140 | char * | 144 | char * |
| 141 | get_offline_text (int status) | 145 | get_offline_text (int status) |
| 142 | { | 146 | { |
| @@ -146,9 +150,11 @@ get_offline_text (int status) | |||
| 146 | return offline_status_text[i].text; | 150 | return offline_status_text[i].text; |
| 147 | } | 151 | } |
| 148 | } | 152 | } |
| 149 | return "unknown"; | 153 | return "UNKNOW"; |
| 150 | } | 154 | } |
| 151 | 155 | ||
| 156 | |||
| 157 | |||
| 152 | int | 158 | int |
| 153 | smart_read_values (int fd, values_t * values) | 159 | smart_read_values (int fd, values_t * values) |
| 154 | { | 160 | { |
| @@ -160,13 +166,15 @@ smart_read_values (int fd, values_t * values) | |||
| 160 | args[3] = 1; | 166 | args[3] = 1; |
| 161 | if (ioctl (fd, HDIO_DRIVE_CMD, &args)) { | 167 | if (ioctl (fd, HDIO_DRIVE_CMD, &args)) { |
| 162 | e = errno; | 168 | e = errno; |
| 163 | printf (_("CRITICAL: SMART_READ_VALUES: %s\n"), strerror (errno)); | 169 | printf (_("CRITICAL - SMART_READ_VALUES: %s\n"), strerror (errno)); |
| 164 | return e; | 170 | return e; |
| 165 | } | 171 | } |
| 166 | memcpy (values, args + 4, 512); | 172 | memcpy (values, args + 4, 512); |
| 167 | return 0; | 173 | return 0; |
| 168 | } | 174 | } |
| 169 | 175 | ||
| 176 | |||
| 177 | |||
| 170 | int | 178 | int |
| 171 | values_not_passed (values_t * p, thresholds_t * t) | 179 | values_not_passed (values_t * p, thresholds_t * t) |
| 172 | { | 180 | { |
| @@ -190,6 +198,8 @@ values_not_passed (values_t * p, thresholds_t * t) | |||
| 190 | return (passed ? -failed : 2); | 198 | return (passed ? -failed : 2); |
| 191 | } | 199 | } |
| 192 | 200 | ||
| 201 | |||
| 202 | |||
| 193 | int | 203 | int |
| 194 | net_saint (values_t * p, thresholds_t * t) | 204 | net_saint (values_t * p, thresholds_t * t) |
| 195 | { | 205 | { |
| @@ -225,24 +235,24 @@ net_saint (values_t * p, thresholds_t * t) | |||
| 225 | } | 235 | } |
| 226 | switch (status) { | 236 | switch (status) { |
| 227 | case PREFAILURE: | 237 | case PREFAILURE: |
| 228 | printf (_("CRITICAL: %d Harddrive PreFailure%cDetected! %d/%d tests failed.\n"), | 238 | printf (_("CRITICAL - %d Harddrive PreFailure%cDetected! %d/%d tests failed.\n"), |
| 229 | prefailure, | 239 | prefailure, |
| 230 | prefailure > 1 ? 's' : ' ', | 240 | prefailure > 1 ? 's' : ' ', |
| 231 | failed, | 241 | failed, |
| 232 | total); | 242 | total); |
| 233 | break; | 243 | break; |
| 234 | case ADVISORY: | 244 | case ADVISORY: |
| 235 | printf (_("WARNING: %d Harddrive Advisor%s Detected. %d/%d tests failed.\n"), | 245 | printf (_("WARNING - %d Harddrive Advisor%s Detected. %d/%d tests failed.\n"), |
| 236 | advisory, | 246 | advisory, |
| 237 | advisory > 1 ? "ies" : "y", | 247 | advisory > 1 ? "ies" : "y", |
| 238 | failed, | 248 | failed, |
| 239 | total); | 249 | total); |
| 240 | break; | 250 | break; |
| 241 | case OPERATIONAL: | 251 | case OPERATIONAL: |
| 242 | printf (_("Status: Operational (%d/%d tests passed)\n"), passed, total); | 252 | printf (_("STATUS - Operational (%d/%d tests passed)\n"), passed, total); |
| 243 | break; | 253 | break; |
| 244 | default: | 254 | default: |
| 245 | printf (_("Error: Status '%d' uknown. %d/%d tests passed\n"), status, | 255 | printf (_("ERROR - Status '%d' uknown. %d/%d tests passed\n"), status, |
| 246 | passed, total); | 256 | passed, total); |
| 247 | status = -1; | 257 | status = -1; |
| 248 | break; | 258 | break; |
| @@ -250,6 +260,8 @@ net_saint (values_t * p, thresholds_t * t) | |||
| 250 | return status; | 260 | return status; |
| 251 | } | 261 | } |
| 252 | 262 | ||
| 263 | |||
| 264 | |||
| 253 | void | 265 | void |
| 254 | print_value (value_t * p, threshold_t * t) | 266 | print_value (value_t * p, threshold_t * t) |
| 255 | { | 267 | { |
| @@ -259,6 +271,8 @@ print_value (value_t * p, threshold_t * t) | |||
| 259 | p->value > t->threshold ? "Passed" : "Failed"); | 271 | p->value > t->threshold ? "Passed" : "Failed"); |
| 260 | } | 272 | } |
| 261 | 273 | ||
| 274 | |||
| 275 | |||
| 262 | void | 276 | void |
| 263 | print_values (values_t * p, thresholds_t * t) | 277 | print_values (values_t * p, thresholds_t * t) |
| 264 | { | 278 | { |
| @@ -291,6 +305,8 @@ print_values (values_t * p, thresholds_t * t) | |||
| 291 | p->smart_capability & 2 ? "AutoSave" : ""); | 305 | p->smart_capability & 2 ? "AutoSave" : ""); |
| 292 | } | 306 | } |
| 293 | 307 | ||
| 308 | |||
| 309 | |||
| 294 | void | 310 | void |
| 295 | print_thresholds (thresholds_t * p) | 311 | print_thresholds (thresholds_t * p) |
| 296 | { | 312 | { |
| @@ -320,12 +336,14 @@ smart_cmd_simple (int fd, enum SmartCommand command, __u8 val0, | |||
| 320 | if (ioctl (fd, HDIO_DRIVE_CMD, &args)) { | 336 | if (ioctl (fd, HDIO_DRIVE_CMD, &args)) { |
| 321 | e = errno; | 337 | e = errno; |
| 322 | if (show_error) { | 338 | if (show_error) { |
| 323 | printf (_("CRITICAL: %s: %s\n"), smart_command[command].text, strerror (errno)); | 339 | printf (_("CRITICAL - %s: %s\n"), smart_command[command].text, strerror (errno)); |
| 324 | } | 340 | } |
| 325 | } | 341 | } |
| 326 | return e; | 342 | return e; |
| 327 | } | 343 | } |
| 328 | 344 | ||
| 345 | |||
| 346 | |||
| 329 | int | 347 | int |
| 330 | smart_read_thresholds (int fd, thresholds_t * thresholds) | 348 | smart_read_thresholds (int fd, thresholds_t * thresholds) |
| 331 | { | 349 | { |
| @@ -337,13 +355,15 @@ smart_read_thresholds (int fd, thresholds_t * thresholds) | |||
| 337 | args[3] = 1; | 355 | args[3] = 1; |
| 338 | if (ioctl (fd, HDIO_DRIVE_CMD, &args)) { | 356 | if (ioctl (fd, HDIO_DRIVE_CMD, &args)) { |
| 339 | e = errno; | 357 | e = errno; |
| 340 | printf (_("CRITICAL: SMART_READ_THRESHOLDS: %s\n"), strerror (errno)); | 358 | printf (_("CRITICAL - SMART_READ_THRESHOLDS: %s\n"), strerror (errno)); |
| 341 | return e; | 359 | return e; |
| 342 | } | 360 | } |
| 343 | memcpy (thresholds, args + 4, 512); | 361 | memcpy (thresholds, args + 4, 512); |
| 344 | return 0; | 362 | return 0; |
| 345 | } | 363 | } |
| 346 | 364 | ||
| 365 | |||
| 366 | |||
| 347 | void | 367 | void |
| 348 | show_version () | 368 | show_version () |
| 349 | { | 369 | { |
| @@ -352,6 +372,8 @@ show_version () | |||
| 352 | printf ("(C) 1999 Ragnar Hojland Espinosa <ragnar@lightside.dhis.org>\n"); | 372 | printf ("(C) 1999 Ragnar Hojland Espinosa <ragnar@lightside.dhis.org>\n"); |
| 353 | } | 373 | } |
| 354 | 374 | ||
| 375 | |||
| 376 | |||
| 355 | void | 377 | void |
| 356 | show_help () | 378 | show_help () |
| 357 | { | 379 | { |
| @@ -373,6 +395,8 @@ Usage: check_ide-smart [DEVICE] [OPTION]\n\ | |||
| 373 | -V, --version\n")); | 395 | -V, --version\n")); |
| 374 | } | 396 | } |
| 375 | 397 | ||
| 398 | |||
| 399 | |||
| 376 | int | 400 | int |
| 377 | main (int argc, char *argv[]) | 401 | main (int argc, char *argv[]) |
| 378 | { | 402 | { |
| @@ -433,8 +457,9 @@ main (int argc, char *argv[]) | |||
| 433 | show_version (); | 457 | show_version (); |
| 434 | return 0; | 458 | return 0; |
| 435 | default: | 459 | default: |
| 436 | printf (_("Try `%s --help' for more information.\n"), argv[0]); | 460 | printf (_("%s: Unknown argument: %s\n\n"), progname, optarg); |
| 437 | return 1; | 461 | print_usage (); |
| 462 | exit (STATE_UNKNOWN); | ||
| 438 | } | 463 | } |
| 439 | 464 | ||
| 440 | if (optind < argc) { | 465 | if (optind < argc) { |
| @@ -450,12 +475,12 @@ main (int argc, char *argv[]) | |||
| 450 | fd = open (device, O_RDONLY); | 475 | fd = open (device, O_RDONLY); |
| 451 | 476 | ||
| 452 | if (fd < 0) { | 477 | if (fd < 0) { |
| 453 | printf (_("CRITICAL: Couldn't open device: %s\n"), strerror (errno)); | 478 | printf (_("CRITICAL - Couldn't open device: %s\n"), strerror (errno)); |
| 454 | return 2; | 479 | return 2; |
| 455 | } | 480 | } |
| 456 | 481 | ||
| 457 | if (smart_cmd_simple (fd, SMART_CMD_ENABLE, 0, TRUE)) { | 482 | if (smart_cmd_simple (fd, SMART_CMD_ENABLE, 0, TRUE)) { |
| 458 | printf (_("CRITICAL: SMART_CMD_ENABLE\n")); | 483 | printf (_("CRITICAL - SMART_CMD_ENABLE\n")); |
| 459 | return 2; | 484 | return 2; |
| 460 | } | 485 | } |
| 461 | 486 | ||
| @@ -489,4 +514,3 @@ main (int argc, char *argv[]) | |||
| 489 | } | 514 | } |
| 490 | return retval; | 515 | return retval; |
| 491 | } | 516 | } |
| 492 | |||
diff --git a/plugins/check_ldap.c b/plugins/check_ldap.c index 69874117..0dc0380a 100644 --- a/plugins/check_ldap.c +++ b/plugins/check_ldap.c | |||
| @@ -14,6 +14,8 @@ | |||
| 14 | along with this program; if not, write to the Free Software | 14 | along with this program; if not, write to the Free Software |
| 15 | Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | 15 | Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
| 16 | 16 | ||
| 17 | $Id$ | ||
| 18 | |||
| 17 | ******************************************************************************/ | 19 | ******************************************************************************/ |
| 18 | 20 | ||
| 19 | const char *progname = "check_ldap"; | 21 | const char *progname = "check_ldap"; |
| @@ -242,8 +244,9 @@ process_arguments (int argc, char **argv) | |||
| 242 | #endif | 244 | #endif |
| 243 | break; | 245 | break; |
| 244 | default: | 246 | default: |
| 245 | usage (_("check_ldap: could not parse unknown arguments\n")); | 247 | printf (_("%s: Unknown argument: %s\n\n"), progname, optarg); |
| 246 | break; | 248 | print_usage (); |
| 249 | exit (STATE_UNKNOWN); | ||
| 247 | } | 250 | } |
| 248 | } | 251 | } |
| 249 | 252 | ||
| @@ -274,7 +277,6 @@ validate_arguments () | |||
| 274 | 277 | ||
| 275 | 278 | ||
| 276 | 279 | ||
| 277 | |||
| 278 | void | 280 | void |
| 279 | print_help (void) | 281 | print_help (void) |
| 280 | { | 282 | { |
diff --git a/plugins/check_load.c b/plugins/check_load.c index 956f9077..babe84bc 100644 --- a/plugins/check_load.c +++ b/plugins/check_load.c | |||
| @@ -13,6 +13,8 @@ | |||
| 13 | You should have received a copy of the GNU General Public License | 13 | You should have received a copy of the GNU General Public License |
| 14 | along with this program; if not, write to the Free Software | 14 | along with this program; if not, write to the Free Software |
| 15 | Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | 15 | Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
| 16 | |||
| 17 | $Id$ | ||
| 16 | 18 | ||
| 17 | ******************************************************************************/ | 19 | ******************************************************************************/ |
| 18 | 20 | ||
| @@ -75,7 +77,7 @@ main (int argc, char **argv) | |||
| 75 | textdomain (PACKAGE); | 77 | textdomain (PACKAGE); |
| 76 | 78 | ||
| 77 | if (process_arguments (argc, argv) == ERROR) | 79 | if (process_arguments (argc, argv) == ERROR) |
| 78 | usage ("failed processing arguments\n"); | 80 | usage (_("check_load: could not parse arguments\n")); |
| 79 | 81 | ||
| 80 | #if HAVE_GETLOADAVG==1 | 82 | #if HAVE_GETLOADAVG==1 |
| 81 | result = getloadavg (la, 3); | 83 | result = getloadavg (la, 3); |
| @@ -227,7 +229,9 @@ process_arguments (int argc, char **argv) | |||
| 227 | print_help (); | 229 | print_help (); |
| 228 | exit (STATE_OK); | 230 | exit (STATE_OK); |
| 229 | case '?': /* help */ | 231 | case '?': /* help */ |
| 230 | usage (_("Invalid argument\n")); | 232 | printf (_("%s: Unknown argument: %s\n\n"), progname, optarg); |
| 233 | print_usage (); | ||
| 234 | exit (STATE_UNKNOWN); | ||
| 231 | } | 235 | } |
| 232 | } | 236 | } |
| 233 | 237 | ||
diff --git a/plugins/check_mrtg.c b/plugins/check_mrtg.c index 5532389c..2badd4ab 100644 --- a/plugins/check_mrtg.c +++ b/plugins/check_mrtg.c | |||
| @@ -14,6 +14,8 @@ | |||
| 14 | along with this program; if not, write to the Free Software | 14 | along with this program; if not, write to the Free Software |
| 15 | Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | 15 | Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
| 16 | 16 | ||
| 17 | $Id$ | ||
| 18 | |||
| 17 | ******************************************************************************/ | 19 | ******************************************************************************/ |
| 18 | 20 | ||
| 19 | const char *progname = "check_mrtg"; | 21 | const char *progname = "check_mrtg"; |
| @@ -58,7 +60,7 @@ main (int argc, char **argv) | |||
| 58 | textdomain (PACKAGE); | 60 | textdomain (PACKAGE); |
| 59 | 61 | ||
| 60 | if (process_arguments (argc, argv) != OK) | 62 | if (process_arguments (argc, argv) != OK) |
| 61 | usage (_("Incorrect arguments supplied\n")); | 63 | usage (_("check_mrtg: could not parse arguments\n")); |
| 62 | 64 | ||
| 63 | /* open the MRTG log file for reading */ | 65 | /* open the MRTG log file for reading */ |
| 64 | fp = fopen (log_file, "r"); | 66 | fp = fopen (log_file, "r"); |
| @@ -229,7 +231,9 @@ process_arguments (int argc, char **argv) | |||
| 229 | print_help (); | 231 | print_help (); |
| 230 | exit (STATE_OK); | 232 | exit (STATE_OK); |
| 231 | case '?': /* help */ | 233 | case '?': /* help */ |
| 232 | usage (_("Invalid argument\n")); | 234 | printf (_("%s: Unknown argument: %s\n\n"), progname, optarg); |
| 235 | print_usage (); | ||
| 236 | exit (STATE_UNKNOWN); | ||
| 233 | } | 237 | } |
| 234 | } | 238 | } |
| 235 | 239 | ||
diff --git a/plugins/check_mrtgtraf.c b/plugins/check_mrtgtraf.c index a5455b04..0b0f49ef 100644 --- a/plugins/check_mrtgtraf.c +++ b/plugins/check_mrtgtraf.c | |||
| @@ -13,6 +13,8 @@ | |||
| 13 | You should have received a copy of the GNU General Public License | 13 | You should have received a copy of the GNU General Public License |
| 14 | along with this program; if not, write to the Free Software | 14 | along with this program; if not, write to the Free Software |
| 15 | Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | 15 | Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
| 16 | |||
| 17 | $Id$ | ||
| 16 | 18 | ||
| 17 | ******************************************************************************/ | 19 | ******************************************************************************/ |
| 18 | 20 | ||
| @@ -38,9 +40,6 @@ unsigned long outgoing_warning_threshold = 0L; | |||
| 38 | unsigned long outgoing_critical_threshold = 0L; | 40 | unsigned long outgoing_critical_threshold = 0L; |
| 39 | 41 | ||
| 40 | 42 | ||
| 41 | |||
| 42 | |||
| 43 | |||
| 44 | int | 43 | int |
| 45 | main (int argc, char **argv) | 44 | main (int argc, char **argv) |
| 46 | { | 45 | { |
| @@ -64,7 +63,7 @@ main (int argc, char **argv) | |||
| 64 | char outgoing_speed_rating[8]; | 63 | char outgoing_speed_rating[8]; |
| 65 | 64 | ||
| 66 | if (process_arguments (argc, argv) != OK) | 65 | if (process_arguments (argc, argv) != OK) |
| 67 | usage (_("Incorrect arguments supplied\n")); | 66 | usage (_("check_ldap: could not parse arguments\n")); |
| 68 | 67 | ||
| 69 | /* open the MRTG log file for reading */ | 68 | /* open the MRTG log file for reading */ |
| 70 | fp = fopen (log_file, "r"); | 69 | fp = fopen (log_file, "r"); |
| @@ -259,7 +258,9 @@ process_arguments (int argc, char **argv) | |||
| 259 | print_help (); | 258 | print_help (); |
| 260 | exit (STATE_OK); | 259 | exit (STATE_OK); |
| 261 | case '?': /* help */ | 260 | case '?': /* help */ |
| 262 | usage (_("Invalid argument\n")); | 261 | printf (_("%s: Unknown argument: %s\n\n"), progname, optarg); |
| 262 | print_usage (); | ||
| 263 | exit (STATE_UNKNOWN); | ||
| 263 | } | 264 | } |
| 264 | } | 265 | } |
| 265 | 266 | ||
| @@ -314,7 +315,6 @@ validate_arguments (void) | |||
| 314 | 315 | ||
| 315 | 316 | ||
| 316 | 317 | ||
| 317 | |||
| 318 | void | 318 | void |
| 319 | print_help (void) | 319 | print_help (void) |
| 320 | { | 320 | { |
diff --git a/plugins/check_mysql.c b/plugins/check_mysql.c index deac37fc..ffd96ed4 100644 --- a/plugins/check_mysql.c +++ b/plugins/check_mysql.c | |||
| @@ -54,7 +54,7 @@ main (int argc, char **argv) | |||
| 54 | textdomain (PACKAGE); | 54 | textdomain (PACKAGE); |
| 55 | 55 | ||
| 56 | if (process_arguments (argc, argv) != OK) | 56 | if (process_arguments (argc, argv) != OK) |
| 57 | usage (_("Incorrect arguments supplied\n")); | 57 | usage (_("check_mysql: could not parse arguments\n")); |
| 58 | 58 | ||
| 59 | /* initialize mysql */ | 59 | /* initialize mysql */ |
| 60 | mysql_init (&mysql); | 60 | mysql_init (&mysql); |
| @@ -146,8 +146,6 @@ main (int argc, char **argv) | |||
| 146 | 146 | ||
| 147 | 147 | ||
| 148 | 148 | ||
| 149 | |||
| 150 | |||
| 151 | /* process command-line arguments */ | 149 | /* process command-line arguments */ |
| 152 | int | 150 | int |
| 153 | process_arguments (int argc, char **argv) | 151 | process_arguments (int argc, char **argv) |
| @@ -183,7 +181,7 @@ process_arguments (int argc, char **argv) | |||
| 183 | db_host = optarg; | 181 | db_host = optarg; |
| 184 | } | 182 | } |
| 185 | else { | 183 | else { |
| 186 | usage2 (_("Invalid host name"), optarg); | 184 | usage2 (_("Invalid hostname/address"), optarg); |
| 187 | } | 185 | } |
| 188 | break; | 186 | break; |
| 189 | case 'd': /* hostname */ | 187 | case 'd': /* hostname */ |
| @@ -208,7 +206,9 @@ process_arguments (int argc, char **argv) | |||
| 208 | print_help (); | 206 | print_help (); |
| 209 | exit (STATE_OK); | 207 | exit (STATE_OK); |
| 210 | case '?': /* help */ | 208 | case '?': /* help */ |
| 211 | usage (_("Invalid argument\n")); | 209 | printf (_("%s: Unknown argument: %s\n\n"), progname, optarg); |
| 210 | print_usage (); | ||
| 211 | exit (STATE_UNKNOWN); | ||
| 212 | } | 212 | } |
| 213 | } | 213 | } |
| 214 | 214 | ||
| @@ -221,7 +221,7 @@ process_arguments (int argc, char **argv) | |||
| 221 | db_host = argv[c++]; | 221 | db_host = argv[c++]; |
| 222 | } | 222 | } |
| 223 | else { | 223 | else { |
| 224 | usage2 (_("Invalid host name"), optarg); | 224 | usage2 (_("Invalid hostname/address"), optarg); |
| 225 | } | 225 | } |
| 226 | else if (strlen(db_user) == 0) | 226 | else if (strlen(db_user) == 0) |
| 227 | db_user = argv[c++]; | 227 | db_user = argv[c++]; |
| @@ -240,8 +240,6 @@ process_arguments (int argc, char **argv) | |||
| 240 | 240 | ||
| 241 | 241 | ||
| 242 | 242 | ||
| 243 | |||
| 244 | |||
| 245 | int | 243 | int |
| 246 | validate_arguments (void) | 244 | validate_arguments (void) |
| 247 | { | 245 | { |
| @@ -262,9 +260,6 @@ validate_arguments (void) | |||
| 262 | 260 | ||
| 263 | 261 | ||
| 264 | 262 | ||
| 265 | |||
| 266 | |||
| 267 | |||
| 268 | void | 263 | void |
| 269 | print_help (void) | 264 | print_help (void) |
| 270 | { | 265 | { |
| @@ -304,7 +299,6 @@ a server listening on MySQL standard port %d will be checked\n"), MYSQL_PORT); | |||
| 304 | 299 | ||
| 305 | 300 | ||
| 306 | 301 | ||
| 307 | |||
| 308 | void | 302 | void |
| 309 | print_usage (void) | 303 | print_usage (void) |
| 310 | { | 304 | { |
diff --git a/plugins/check_nagios.c b/plugins/check_nagios.c index d9d18d9b..4439251f 100644 --- a/plugins/check_nagios.c +++ b/plugins/check_nagios.c | |||
| @@ -14,6 +14,8 @@ | |||
| 14 | along with this program; if not, write to the Free Software | 14 | along with this program; if not, write to the Free Software |
| 15 | Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | 15 | Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
| 16 | 16 | ||
| 17 | $Id$ | ||
| 18 | |||
| 17 | ******************************************************************************/ | 19 | ******************************************************************************/ |
| 18 | 20 | ||
| 19 | const char *progname = "check_nagios"; | 21 | const char *progname = "check_nagios"; |
| @@ -64,7 +66,7 @@ main (int argc, char **argv) | |||
| 64 | textdomain (PACKAGE); | 66 | textdomain (PACKAGE); |
| 65 | 67 | ||
| 66 | if (process_arguments (argc, argv) == ERROR) | 68 | if (process_arguments (argc, argv) == ERROR) |
| 67 | usage (_("Could not parse arguments\n")); | 69 | usage (_("check_nagios: could not parse arguments\n")); |
| 68 | 70 | ||
| 69 | /* Set signal handling and alarm */ | 71 | /* Set signal handling and alarm */ |
| 70 | if (signal (SIGALRM, timeout_alarm_handler) == SIG_ERR) { | 72 | if (signal (SIGALRM, timeout_alarm_handler) == SIG_ERR) { |
| @@ -78,7 +80,7 @@ main (int argc, char **argv) | |||
| 78 | /* open the status log */ | 80 | /* open the status log */ |
| 79 | fp = fopen (status_log, "r"); | 81 | fp = fopen (status_log, "r"); |
| 80 | if (fp == NULL) { | 82 | if (fp == NULL) { |
| 81 | printf (_("Error: Cannot open status log for reading!\n")); | 83 | printf (_("ERROR - Cannot open status log for reading!\n")); |
| 82 | return STATE_CRITICAL; | 84 | return STATE_CRITICAL; |
| 83 | } | 85 | } |
| 84 | 86 | ||
| @@ -178,8 +180,6 @@ main (int argc, char **argv) | |||
| 178 | 180 | ||
| 179 | 181 | ||
| 180 | 182 | ||
| 181 | |||
| 182 | |||
| 183 | /* process command-line arguments */ | 183 | /* process command-line arguments */ |
| 184 | int | 184 | int |
| 185 | process_arguments (int argc, char **argv) | 185 | process_arguments (int argc, char **argv) |
| @@ -264,9 +264,6 @@ process_arguments (int argc, char **argv) | |||
| 264 | 264 | ||
| 265 | 265 | ||
| 266 | 266 | ||
| 267 | |||
| 268 | |||
| 269 | |||
| 270 | void | 267 | void |
| 271 | print_help (void) | 268 | print_help (void) |
| 272 | { | 269 | { |
| @@ -302,7 +299,6 @@ Example:\n\ | |||
| 302 | 299 | ||
| 303 | 300 | ||
| 304 | 301 | ||
| 305 | |||
| 306 | void | 302 | void |
| 307 | print_usage (void) | 303 | print_usage (void) |
| 308 | { | 304 | { |
diff --git a/plugins/check_nt.c b/plugins/check_nt.c index 8d66092d..84b78bc5 100644 --- a/plugins/check_nt.c +++ b/plugins/check_nt.c | |||
| @@ -26,6 +26,8 @@ | |||
| 26 | * along with this program; if not, write to the Free Software | 26 | * along with this program; if not, write to the Free Software |
| 27 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | 27 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
| 28 | * | 28 | * |
| 29 | * $Id$ | ||
| 30 | * | ||
| 29 | *****************************************************************************/ | 31 | *****************************************************************************/ |
| 30 | 32 | ||
| 31 | #include "common.h" | 33 | #include "common.h" |
| @@ -109,7 +111,7 @@ int main(int argc, char **argv){ | |||
| 109 | textdomain (PACKAGE); | 111 | textdomain (PACKAGE); |
| 110 | 112 | ||
| 111 | if(process_arguments(argc,argv)==ERROR) | 113 | if(process_arguments(argc,argv)==ERROR) |
| 112 | usage(_("Could not parse arguments\n")); | 114 | usage(_("check_nt: could not parse arguments\n")); |
| 113 | 115 | ||
| 114 | /* initialize alarm signal handling */ | 116 | /* initialize alarm signal handling */ |
| 115 | signal(SIGALRM,socket_timeout_alarm_handler); | 117 | signal(SIGALRM,socket_timeout_alarm_handler); |
| @@ -188,7 +190,7 @@ int main(int argc, char **argv){ | |||
| 188 | updays = uptime / 86400; | 190 | updays = uptime / 86400; |
| 189 | uphours = (uptime % 86400) / 3600; | 191 | uphours = (uptime % 86400) / 3600; |
| 190 | upminutes = ((uptime % 86400) % 3600) / 60; | 192 | upminutes = ((uptime % 86400) % 3600) / 60; |
| 191 | asprintf(&output_message,_("System Uptime : %u day(s) %u hour(s) %u minute(s)"),updays,uphours, upminutes); | 193 | asprintf(&output_message,_("System Uptime - %u day(s) %u hour(s) %u minute(s)"),updays,uphours, upminutes); |
| 192 | return_code=STATE_OK; | 194 | return_code=STATE_OK; |
| 193 | break; | 195 | break; |
| 194 | 196 | ||
| @@ -427,9 +429,6 @@ int main(int argc, char **argv){ | |||
| 427 | 429 | ||
| 428 | 430 | ||
| 429 | 431 | ||
| 430 | |||
| 431 | |||
| 432 | |||
| 433 | /* process command-line arguments */ | 432 | /* process command-line arguments */ |
| 434 | int process_arguments(int argc, char **argv){ | 433 | int process_arguments(int argc, char **argv){ |
| 435 | int c; | 434 | int c; |
| @@ -557,9 +556,6 @@ int process_arguments(int argc, char **argv){ | |||
| 557 | 556 | ||
| 558 | 557 | ||
| 559 | 558 | ||
| 560 | |||
| 561 | |||
| 562 | |||
| 563 | void fetch_data (const char *address, int port, const char *sendb) { | 559 | void fetch_data (const char *address, int port, const char *sendb) { |
| 564 | int result; | 560 | int result; |
| 565 | 561 | ||
| @@ -603,9 +599,6 @@ void preparelist(char *string) { | |||
| 603 | 599 | ||
| 604 | 600 | ||
| 605 | 601 | ||
| 606 | |||
| 607 | |||
| 608 | |||
| 609 | void print_help(void) | 602 | void print_help(void) |
| 610 | { | 603 | { |
| 611 | print_revision(progname,"$Revision$"); | 604 | print_revision(progname,"$Revision$"); |
| @@ -681,7 +674,6 @@ Windows NT/2000/XP server.\n\n")); | |||
| 681 | 674 | ||
| 682 | 675 | ||
| 683 | 676 | ||
| 684 | |||
| 685 | void print_usage(void) | 677 | void print_usage(void) |
| 686 | { | 678 | { |
| 687 | printf(_("\ | 679 | printf(_("\ |
diff --git a/plugins/check_nwstat.c b/plugins/check_nwstat.c index 46bc7e90..ec5d5d6c 100644 --- a/plugins/check_nwstat.c +++ b/plugins/check_nwstat.c | |||
| @@ -14,6 +14,8 @@ | |||
| 14 | along with this program; if not, write to the Free Software | 14 | along with this program; if not, write to the Free Software |
| 15 | Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | 15 | Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
| 16 | 16 | ||
| 17 | $Id$ | ||
| 18 | |||
| 17 | ******************************************************************************/ | 19 | ******************************************************************************/ |
| 18 | 20 | ||
| 19 | const char *progname = "check_nwstat"; | 21 | const char *progname = "check_nwstat"; |
| @@ -80,9 +82,6 @@ void print_usage(void); | |||
| 80 | 82 | ||
| 81 | 83 | ||
| 82 | 84 | ||
| 83 | |||
| 84 | |||
| 85 | |||
| 86 | int | 85 | int |
| 87 | main(int argc, char **argv) { | 86 | main(int argc, char **argv) { |
| 88 | int result; | 87 | int result; |
| @@ -123,7 +122,7 @@ main(int argc, char **argv) { | |||
| 123 | textdomain (PACKAGE); | 122 | textdomain (PACKAGE); |
| 124 | 123 | ||
| 125 | if (process_arguments(argc,argv)==ERROR) | 124 | if (process_arguments(argc,argv)==ERROR) |
| 126 | usage(_("Could not parse arguments\n")); | 125 | usage(_("check_nwstat: could not parse arguments\n")); |
| 127 | 126 | ||
| 128 | /* initialize alarm signal handling */ | 127 | /* initialize alarm signal handling */ |
| 129 | signal(SIGALRM,socket_timeout_alarm_handler); | 128 | signal(SIGALRM,socket_timeout_alarm_handler); |
| @@ -609,10 +608,10 @@ main(int argc, char **argv) { | |||
| 609 | 608 | ||
| 610 | if (time_sync_status==0) { | 609 | if (time_sync_status==0) { |
| 611 | result=STATE_CRITICAL; | 610 | result=STATE_CRITICAL; |
| 612 | asprintf (&output_message,_("Critical: Time not in sync with network!")); | 611 | asprintf (&output_message,_("CRITICAL - Time not in sync with network!")); |
| 613 | } | 612 | } |
| 614 | else { | 613 | else { |
| 615 | asprintf (&output_message,_("OK! Time in sync with network!")); | 614 | asprintf (&output_message,_("OK - Time in sync with network!")); |
| 616 | } | 615 | } |
| 617 | 616 | ||
| 618 | /* check LRU sitting time in secondss */ | 617 | /* check LRU sitting time in secondss */ |
| @@ -710,7 +709,9 @@ main(int argc, char **argv) { | |||
| 710 | 709 | ||
| 711 | return result; | 710 | return result; |
| 712 | } | 711 | } |
| 713 | 712 | ||
| 713 | |||
| 714 | |||
| 714 | /* process command-line arguments */ | 715 | /* process command-line arguments */ |
| 715 | int process_arguments(int argc, char **argv) { | 716 | int process_arguments(int argc, char **argv) { |
| 716 | int c; | 717 | int c; |
| @@ -896,9 +897,6 @@ int process_arguments(int argc, char **argv) { | |||
| 896 | 897 | ||
| 897 | 898 | ||
| 898 | 899 | ||
| 899 | |||
| 900 | |||
| 901 | |||
| 902 | void print_help(void) | 900 | void print_help(void) |
| 903 | { | 901 | { |
| 904 | char *myport; | 902 | char *myport; |
| @@ -987,7 +985,6 @@ Notes:\n\ | |||
| 987 | 985 | ||
| 988 | 986 | ||
| 989 | 987 | ||
| 990 | |||
| 991 | void print_usage(void) | 988 | void print_usage(void) |
| 992 | { | 989 | { |
| 993 | printf (_("\ | 990 | printf (_("\ |
diff --git a/plugins/check_overcr.c b/plugins/check_overcr.c index 0b524ff7..6682d8e6 100644 --- a/plugins/check_overcr.c +++ b/plugins/check_overcr.c | |||
| @@ -14,6 +14,8 @@ | |||
| 14 | along with this program; if not, write to the Free Software | 14 | along with this program; if not, write to the Free Software |
| 15 | Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | 15 | Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
| 16 | 16 | ||
| 17 | $Id$ | ||
| 18 | |||
| 17 | ******************************************************************************/ | 19 | ******************************************************************************/ |
| 18 | 20 | ||
| 19 | const char *progname = "check_overcr"; | 21 | const char *progname = "check_overcr"; |
| @@ -84,7 +86,7 @@ main (int argc, char **argv) | |||
| 84 | textdomain (PACKAGE); | 86 | textdomain (PACKAGE); |
| 85 | 87 | ||
| 86 | if (process_arguments (argc, argv) == ERROR) | 88 | if (process_arguments (argc, argv) == ERROR) |
| 87 | usage ("Could not parse arguments\n"); | 89 | usage (_("check_overcr: could not parse arguments\n")); |
| 88 | 90 | ||
| 89 | /* initialize alarm signal handling */ | 91 | /* initialize alarm signal handling */ |
| 90 | signal (SIGALRM, socket_timeout_alarm_handler); | 92 | signal (SIGALRM, socket_timeout_alarm_handler); |
| @@ -281,8 +283,6 @@ main (int argc, char **argv) | |||
| 281 | 283 | ||
| 282 | 284 | ||
| 283 | 285 | ||
| 284 | |||
| 285 | |||
| 286 | /* process command-line arguments */ | 286 | /* process command-line arguments */ |
| 287 | int | 287 | int |
| 288 | process_arguments (int argc, char **argv) | 288 | process_arguments (int argc, char **argv) |
| @@ -401,7 +401,9 @@ process_arguments (int argc, char **argv) | |||
| 401 | } | 401 | } |
| 402 | return OK; | 402 | return OK; |
| 403 | } | 403 | } |
| 404 | 404 | ||
| 405 | |||
| 406 | |||
| 405 | void | 407 | void |
| 406 | print_usage (void) | 408 | print_usage (void) |
| 407 | { | 409 | { |
| @@ -412,6 +414,8 @@ Usage: %s -H host [-p port] [-v variable] [-w warning] [-c critical]\n\ | |||
| 412 | printf (_(UT_HLP_VRS), progname, progname); | 414 | printf (_(UT_HLP_VRS), progname, progname); |
| 413 | } | 415 | } |
| 414 | 416 | ||
| 417 | |||
| 418 | |||
| 415 | void | 419 | void |
| 416 | print_help (void) | 420 | print_help (void) |
| 417 | { | 421 | { |
diff --git a/plugins/check_pgsql.c b/plugins/check_pgsql.c index 07abd9c0..53ba2950 100644 --- a/plugins/check_pgsql.c +++ b/plugins/check_pgsql.c | |||
| @@ -14,6 +14,8 @@ | |||
| 14 | along with this program; if not, write to the Free Software | 14 | along with this program; if not, write to the Free Software |
| 15 | Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | 15 | Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
| 16 | 16 | ||
| 17 | $Id$ | ||
| 18 | |||
| 17 | *****************************************************************************/ | 19 | *****************************************************************************/ |
| 18 | 20 | ||
| 19 | #define DEFAULT_DB "template1" | 21 | #define DEFAULT_DB "template1" |
| @@ -55,7 +57,7 @@ const char *progname = "check_pgsql"; | |||
| 55 | const char *revision = "$Revision$"; | 57 | const char *revision = "$Revision$"; |
| 56 | const char *copyright = "1999-2003"; | 58 | const char *copyright = "1999-2003"; |
| 57 | const char *email = "nagiosplug-devel@lists.sourceforge.net"; | 59 | const char *email = "nagiosplug-devel@lists.sourceforge.net"; |
| 58 | 60 | ||
| 59 | 61 | ||
| 60 | /****************************************************************************** | 62 | /****************************************************************************** |
| 61 | 63 | ||
| @@ -110,8 +112,6 @@ Please note that all tags must be lowercase to use the DocBook XML DTD. | |||
| 110 | <title>Functions</title> | 112 | <title>Functions</title> |
| 111 | -@@ | 113 | -@@ |
| 112 | ******************************************************************************/ | 114 | ******************************************************************************/ |
| 113 | |||
| 114 | |||
| 115 | 115 | ||
| 116 | 116 | ||
| 117 | 117 | ||
| @@ -133,7 +133,7 @@ main (int argc, char **argv) | |||
| 133 | textdomain (PACKAGE); | 133 | textdomain (PACKAGE); |
| 134 | 134 | ||
| 135 | if (process_arguments (argc, argv) == ERROR) | 135 | if (process_arguments (argc, argv) == ERROR) |
| 136 | usage ("Could not parse arguments"); | 136 | usage (_("check_pgsql: could not parse arguments\n")); |
| 137 | 137 | ||
| 138 | /* Set signal handling and alarm */ | 138 | /* Set signal handling and alarm */ |
| 139 | if (signal (SIGALRM, timeout_alarm_handler) == SIG_ERR) { | 139 | if (signal (SIGALRM, timeout_alarm_handler) == SIG_ERR) { |
| @@ -151,7 +151,7 @@ main (int argc, char **argv) | |||
| 151 | 151 | ||
| 152 | /* check to see that the backend connection was successfully made */ | 152 | /* check to see that the backend connection was successfully made */ |
| 153 | if (PQstatus (conn) == CONNECTION_BAD) { | 153 | if (PQstatus (conn) == CONNECTION_BAD) { |
| 154 | printf (_("PGSQL: CRITICAL - no connection to '%s' (%s).\n"), | 154 | printf (_("CRITICAL - no connection to '%s' (%s).\n"), |
| 155 | dbName, PQerrorMessage (conn)); | 155 | dbName, PQerrorMessage (conn)); |
| 156 | PQfinish (conn); | 156 | PQfinish (conn); |
| 157 | return STATE_CRITICAL; | 157 | return STATE_CRITICAL; |
| @@ -166,13 +166,13 @@ main (int argc, char **argv) | |||
| 166 | status = STATE_OK; | 166 | status = STATE_OK; |
| 167 | } | 167 | } |
| 168 | PQfinish (conn); | 168 | PQfinish (conn); |
| 169 | printf (_("PGSQL: %s - database %s (%d sec.)|%s\n"), | 169 | printf (_(" %s - database %s (%d sec.)|%s\n"), |
| 170 | state_text(status), dbName, elapsed_time, | 170 | state_text(status), dbName, elapsed_time, |
| 171 | fperfdata("time", elapsed_time, "s", | 171 | fperfdata("time", elapsed_time, "s", |
| 172 | (int)twarn, twarn, (int)tcrit, tcrit, TRUE, 0, FALSE,0)); | 172 | (int)twarn, twarn, (int)tcrit, tcrit, TRUE, 0, FALSE,0)); |
| 173 | return status; | 173 | return status; |
| 174 | } | 174 | } |
| 175 | 175 | ||
| 176 | 176 | ||
| 177 | 177 | ||
| 178 | /* process command-line arguments */ | 178 | /* process command-line arguments */ |
| @@ -206,8 +206,9 @@ process_arguments (int argc, char **argv) | |||
| 206 | 206 | ||
| 207 | switch (c) { | 207 | switch (c) { |
| 208 | case '?': /* usage */ | 208 | case '?': /* usage */ |
| 209 | usage3 (_("Unknown argument"), optopt); | 209 | printf (_("%s: Unknown argument: %s\n\n"), progname, optarg); |
| 210 | break; | 210 | print_usage (); |
| 211 | exit (STATE_UNKNOWN); | ||
| 211 | case 'h': /* help */ | 212 | case 'h': /* help */ |
| 212 | print_help (); | 213 | print_help (); |
| 213 | exit (STATE_OK); | 214 | exit (STATE_OK); |
| @@ -222,25 +223,25 @@ process_arguments (int argc, char **argv) | |||
| 222 | break; | 223 | break; |
| 223 | case 'c': /* critical time threshold */ | 224 | case 'c': /* critical time threshold */ |
| 224 | if (!is_nonnegative (optarg)) | 225 | if (!is_nonnegative (optarg)) |
| 225 | usage2 (_("Invalid critical threshold"), optarg); | 226 | usage2 (_("Critical threshold must be a positive integer"), optarg); |
| 226 | else | 227 | else |
| 227 | tcrit = strtod (optarg, NULL); | 228 | tcrit = strtod (optarg, NULL); |
| 228 | break; | 229 | break; |
| 229 | case 'w': /* warning time threshold */ | 230 | case 'w': /* warning time threshold */ |
| 230 | if (!is_nonnegative (optarg)) | 231 | if (!is_nonnegative (optarg)) |
| 231 | usage2 (_("Invalid critical threshold"), optarg); | 232 | usage2 (_("Critical threshold must be a positive integer"), optarg); |
| 232 | else | 233 | else |
| 233 | twarn = strtod (optarg, NULL); | 234 | twarn = strtod (optarg, NULL); |
| 234 | break; | 235 | break; |
| 235 | case 'H': /* host */ | 236 | case 'H': /* host */ |
| 236 | if (!is_host (optarg)) | 237 | if (!is_host (optarg)) |
| 237 | usage2 (_("Invalid host name"), optarg); | 238 | usage2 (_("Invalid hostname/address"), optarg); |
| 238 | else | 239 | else |
| 239 | pghost = optarg; | 240 | pghost = optarg; |
| 240 | break; | 241 | break; |
| 241 | case 'P': /* port */ | 242 | case 'P': /* port */ |
| 242 | if (!is_integer (optarg)) | 243 | if (!is_integer (optarg)) |
| 243 | usage2 (_("Port must be an integer"), optarg); | 244 | usage2 (_("Port must be a positive integer"), optarg); |
| 244 | else | 245 | else |
| 245 | pgport = optarg; | 246 | pgport = optarg; |
| 246 | break; | 247 | break; |
| @@ -287,12 +288,13 @@ first character cannot be a number, however.</para> | |||
| 287 | -@@ | 288 | -@@ |
| 288 | ******************************************************************************/ | 289 | ******************************************************************************/ |
| 289 | 290 | ||
| 291 | |||
| 292 | |||
| 290 | int | 293 | int |
| 291 | validate_arguments () | 294 | validate_arguments () |
| 292 | { | 295 | { |
| 293 | return OK; | 296 | return OK; |
| 294 | } | 297 | } |
| 295 | |||
| 296 | 298 | ||
| 297 | 299 | ||
| 298 | /****************************************************************************** | 300 | /****************************************************************************** |
| @@ -315,6 +317,8 @@ first character cannot be a number, however.</para> | |||
| 315 | -@@ | 317 | -@@ |
| 316 | ******************************************************************************/ | 318 | ******************************************************************************/ |
| 317 | 319 | ||
| 320 | |||
| 321 | |||
| 318 | int | 322 | int |
| 319 | is_pg_dbname (char *dbname) | 323 | is_pg_dbname (char *dbname) |
| 320 | { | 324 | { |
| @@ -355,6 +359,8 @@ should be added.</para> | |||
| 355 | -@@ | 359 | -@@ |
| 356 | ******************************************************************************/ | 360 | ******************************************************************************/ |
| 357 | 361 | ||
| 362 | |||
| 363 | |||
| 358 | int | 364 | int |
| 359 | is_pg_logname (char *username) | 365 | is_pg_logname (char *username) |
| 360 | { | 366 | { |
| @@ -370,8 +376,6 @@ is_pg_logname (char *username) | |||
| 370 | </article> | 376 | </article> |
| 371 | -@@ | 377 | -@@ |
| 372 | ******************************************************************************/ | 378 | ******************************************************************************/ |
| 373 | |||
| 374 | |||
| 375 | 379 | ||
| 376 | 380 | ||
| 377 | 381 | ||
| @@ -386,7 +390,7 @@ print_help (void) | |||
| 386 | 390 | ||
| 387 | printf (_(COPYRIGHT), copyright, email); | 391 | printf (_(COPYRIGHT), copyright, email); |
| 388 | 392 | ||
| 389 | printf (_("Test whether a PostgreSQL DBMS is accepting connections.\n\n")); | 393 | printf (_("Test whether a PostgreSQL Database is accepting connections.\n\n")); |
| 390 | 394 | ||
| 391 | print_usage (); | 395 | print_usage (); |
| 392 | 396 | ||
| @@ -431,7 +435,6 @@ a password, but no effort is made to obsure or encrypt the password.\n")); | |||
| 431 | 435 | ||
| 432 | 436 | ||
| 433 | 437 | ||
| 434 | |||
| 435 | void | 438 | void |
| 436 | print_usage (void) | 439 | print_usage (void) |
| 437 | { | 440 | { |
| @@ -444,4 +447,3 @@ Usage:\n %s [-H <host>] [-P <port>] [-c <critical time>] [-w <warning time>]\n\ | |||
| 444 | %s (-V | --version) for version information\n"), | 447 | %s (-V | --version) for version information\n"), |
| 445 | progname, progname); | 448 | progname, progname); |
| 446 | } | 449 | } |
| 447 | |||
diff --git a/plugins/check_ping.c b/plugins/check_ping.c index 074519d3..260e1b65 100644 --- a/plugins/check_ping.c +++ b/plugins/check_ping.c | |||
| @@ -14,6 +14,8 @@ | |||
| 14 | along with this program; if not, write to the Free Software | 14 | along with this program; if not, write to the Free Software |
| 15 | Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | 15 | Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
| 16 | 16 | ||
| 17 | $Id$ | ||
| 18 | |||
| 17 | ******************************************************************************/ | 19 | ******************************************************************************/ |
| 18 | 20 | ||
| 19 | const char *progname = "check_ping"; | 21 | const char *progname = "check_ping"; |
| @@ -60,8 +62,6 @@ char *warn_text; | |||
| 60 | 62 | ||
| 61 | 63 | ||
| 62 | 64 | ||
| 63 | |||
| 64 | |||
| 65 | int | 65 | int |
| 66 | main (int argc, char **argv) | 66 | main (int argc, char **argv) |
| 67 | { | 67 | { |
| @@ -79,7 +79,7 @@ main (int argc, char **argv) | |||
| 79 | addresses[0] = NULL; | 79 | addresses[0] = NULL; |
| 80 | 80 | ||
| 81 | if (process_arguments (argc, argv) == ERROR) | 81 | if (process_arguments (argc, argv) == ERROR) |
| 82 | usage (_("Could not parse arguments")); | 82 | usage (_("check_ping: could not parse arguments\n")); |
| 83 | 83 | ||
| 84 | /* Set signal handling and alarm */ | 84 | /* Set signal handling and alarm */ |
| 85 | if (signal (SIGALRM, popen_timeout_alarm_handler) == SIG_ERR) { | 85 | if (signal (SIGALRM, popen_timeout_alarm_handler) == SIG_ERR) { |
| @@ -159,9 +159,6 @@ main (int argc, char **argv) | |||
| 159 | 159 | ||
| 160 | 160 | ||
| 161 | 161 | ||
| 162 | |||
| 163 | |||
| 164 | |||
| 165 | /* process command-line arguments */ | 162 | /* process command-line arguments */ |
| 166 | int | 163 | int |
| 167 | process_arguments (int argc, char **argv) | 164 | process_arguments (int argc, char **argv) |
| @@ -198,8 +195,9 @@ process_arguments (int argc, char **argv) | |||
| 198 | 195 | ||
| 199 | switch (c) { | 196 | switch (c) { |
| 200 | case '?': /* usage */ | 197 | case '?': /* usage */ |
| 201 | usage3 (_("Unknown argument"), optopt); | 198 | printf (_("%s: Unknown argument: %s\n\n"), progname, optarg); |
| 202 | break; | 199 | print_usage (); |
| 200 | exit (STATE_UNKNOWN); | ||
| 203 | case 'h': /* help */ | 201 | case 'h': /* help */ |
| 204 | print_help (); | 202 | print_help (); |
| 205 | exit (STATE_OK); | 203 | exit (STATE_OK); |
| @@ -270,7 +268,7 @@ process_arguments (int argc, char **argv) | |||
| 270 | 268 | ||
| 271 | if (addresses[0] == NULL) { | 269 | if (addresses[0] == NULL) { |
| 272 | if (is_host (argv[c]) == FALSE) { | 270 | if (is_host (argv[c]) == FALSE) { |
| 273 | usage2 (_("Invalid host name/address"), argv[c]); | 271 | usage2 (_("Invalid hostname/address"), argv[c]); |
| 274 | } else { | 272 | } else { |
| 275 | addresses[0] = argv[c++]; | 273 | addresses[0] = argv[c++]; |
| 276 | n_addresses++; | 274 | n_addresses++; |
| @@ -335,6 +333,8 @@ process_arguments (int argc, char **argv) | |||
| 335 | return validate_arguments (); | 333 | return validate_arguments (); |
| 336 | } | 334 | } |
| 337 | 335 | ||
| 336 | |||
| 337 | |||
| 338 | int | 338 | int |
| 339 | get_threshold (char *arg, float *trta, int *tpl) | 339 | get_threshold (char *arg, float *trta, int *tpl) |
| 340 | { | 340 | { |
| @@ -349,6 +349,8 @@ get_threshold (char *arg, float *trta, int *tpl) | |||
| 349 | return STATE_UNKNOWN; | 349 | return STATE_UNKNOWN; |
| 350 | } | 350 | } |
| 351 | 351 | ||
| 352 | |||
| 353 | |||
| 352 | int | 354 | int |
| 353 | validate_arguments () | 355 | validate_arguments () |
| 354 | { | 356 | { |
| @@ -389,7 +391,7 @@ validate_arguments () | |||
| 389 | 391 | ||
| 390 | for (i=0; i<n_addresses; i++) { | 392 | for (i=0; i<n_addresses; i++) { |
| 391 | if (is_host(addresses[i]) == FALSE) | 393 | if (is_host(addresses[i]) == FALSE) |
| 392 | usage2 (_("Invalid host name/address"), addresses[i]); | 394 | usage2 (_("Invalid hostname/address"), addresses[i]); |
| 393 | } | 395 | } |
| 394 | 396 | ||
| 395 | return OK; | 397 | return OK; |
| @@ -397,9 +399,6 @@ validate_arguments () | |||
| 397 | 399 | ||
| 398 | 400 | ||
| 399 | 401 | ||
| 400 | |||
| 401 | |||
| 402 | |||
| 403 | int | 402 | int |
| 404 | run_ping (const char *cmd, const char *addr) | 403 | run_ping (const char *cmd, const char *addr) |
| 405 | { | 404 | { |
| @@ -444,7 +443,7 @@ run_ping (const char *cmd, const char *addr) | |||
| 444 | 443 | ||
| 445 | /* check stderr, setting at least WARNING if there is output here */ | 444 | /* check stderr, setting at least WARNING if there is output here */ |
| 446 | while (fgets (buf, MAX_INPUT_BUFFER - 1, child_stderr)) | 445 | while (fgets (buf, MAX_INPUT_BUFFER - 1, child_stderr)) |
| 447 | if (! strstr(buf,"Warning: no SO_TIMESTAMP support, falling back to SIOCGSTAMP")) | 446 | if (! strstr(buf,"WARNING - no SO_TIMESTAMP support, falling back to SIOCGSTAMP")) |
| 448 | result = max_state (STATE_WARNING, error_scan (buf, addr)); | 447 | result = max_state (STATE_WARNING, error_scan (buf, addr)); |
| 449 | 448 | ||
| 450 | (void) fclose (child_stderr); | 449 | (void) fclose (child_stderr); |
| @@ -462,17 +461,15 @@ run_ping (const char *cmd, const char *addr) | |||
| 462 | 461 | ||
| 463 | 462 | ||
| 464 | 463 | ||
| 465 | |||
| 466 | |||
| 467 | int | 464 | int |
| 468 | error_scan (char buf[MAX_INPUT_BUFFER], const char *addr) | 465 | error_scan (char buf[MAX_INPUT_BUFFER], const char *addr) |
| 469 | { | 466 | { |
| 470 | if (strstr (buf, "Network is unreachable")) | 467 | if (strstr (buf, "Network is unreachable")) |
| 471 | die (STATE_CRITICAL, _("PING CRITICAL - Network unreachable (%s)"), addr); | 468 | die (STATE_CRITICAL, _("CRITICAL - Network unreachable (%s)"), addr); |
| 472 | else if (strstr (buf, "Destination Host Unreachable")) | 469 | else if (strstr (buf, "Destination Host Unreachable")) |
| 473 | die (STATE_CRITICAL, _("PING CRITICAL - Host Unreachable (%s)"), addr); | 470 | die (STATE_CRITICAL, _("CRITICAL - Host Unreachable (%s)"), addr); |
| 474 | else if (strstr (buf, "unknown host" )) | 471 | else if (strstr (buf, "unknown host" )) |
| 475 | die (STATE_CRITICAL, _("PING CRITICAL - Host not found (%s)"), addr); | 472 | die (STATE_CRITICAL, _("CRITICAL - Host not found (%s)"), addr); |
| 476 | 473 | ||
| 477 | if (strstr (buf, "(DUP!)") || strstr (buf, "DUPLICATES FOUND")) { | 474 | if (strstr (buf, "(DUP!)") || strstr (buf, "DUPLICATES FOUND")) { |
| 478 | if (warn_text == NULL) | 475 | if (warn_text == NULL) |
| @@ -488,9 +485,6 @@ error_scan (char buf[MAX_INPUT_BUFFER], const char *addr) | |||
| 488 | 485 | ||
| 489 | 486 | ||
| 490 | 487 | ||
| 491 | |||
| 492 | |||
| 493 | |||
| 494 | void | 488 | void |
| 495 | print_usage (void) | 489 | print_usage (void) |
| 496 | { | 490 | { |
| @@ -500,6 +494,8 @@ print_usage (void) | |||
| 500 | printf (_(UT_HLP_VRS), progname, progname); | 494 | printf (_(UT_HLP_VRS), progname, progname); |
| 501 | } | 495 | } |
| 502 | 496 | ||
| 497 | |||
| 498 | |||
| 503 | void | 499 | void |
| 504 | print_help (void) | 500 | print_help (void) |
| 505 | { | 501 | { |
diff --git a/plugins/check_procs.c b/plugins/check_procs.c index d39bfa54..011661c1 100644 --- a/plugins/check_procs.c +++ b/plugins/check_procs.c | |||
| @@ -14,6 +14,8 @@ | |||
| 14 | along with this program; if not, write to the Free Software | 14 | along with this program; if not, write to the Free Software |
| 15 | Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | 15 | Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
| 16 | 16 | ||
| 17 | $Id$ | ||
| 18 | |||
| 17 | ******************************************************************************/ | 19 | ******************************************************************************/ |
| 18 | 20 | ||
| 19 | const char *progname = "check_procs"; | 21 | const char *progname = "check_procs"; |
| @@ -73,9 +75,6 @@ char tmp[MAX_INPUT_BUFFER]; | |||
| 73 | 75 | ||
| 74 | 76 | ||
| 75 | 77 | ||
| 76 | |||
| 77 | |||
| 78 | |||
| 79 | int | 78 | int |
| 80 | main (int argc, char **argv) | 79 | main (int argc, char **argv) |
| 81 | { | 80 | { |
| @@ -117,8 +116,7 @@ main (int argc, char **argv) | |||
| 117 | metric = METRIC_PROCS; | 116 | metric = METRIC_PROCS; |
| 118 | 117 | ||
| 119 | if (process_arguments (argc, argv) == ERROR) | 118 | if (process_arguments (argc, argv) == ERROR) |
| 120 | usage (_("Unable to parse command line\n")); | 119 | usage (_("check_procs: could not parse arguments\n")); |
| 121 | |||
| 122 | 120 | ||
| 123 | /* Set signal handling and alarm timeout */ | 121 | /* Set signal handling and alarm timeout */ |
| 124 | if (signal (SIGALRM, popen_timeout_alarm_handler) == SIG_ERR) { | 122 | if (signal (SIGALRM, popen_timeout_alarm_handler) == SIG_ERR) { |
| @@ -127,7 +125,6 @@ main (int argc, char **argv) | |||
| 127 | } | 125 | } |
| 128 | alarm (timeout_interval); | 126 | alarm (timeout_interval); |
| 129 | 127 | ||
| 130 | |||
| 131 | if (verbose >= 2) | 128 | if (verbose >= 2) |
| 132 | printf (_("CMD: %s\n"), PS_COMMAND); | 129 | printf (_("CMD: %s\n"), PS_COMMAND); |
| 133 | 130 | ||
| @@ -296,9 +293,6 @@ main (int argc, char **argv) | |||
| 296 | 293 | ||
| 297 | 294 | ||
| 298 | 295 | ||
| 299 | |||
| 300 | |||
| 301 | |||
| 302 | /* process command-line arguments */ | 296 | /* process command-line arguments */ |
| 303 | int | 297 | int |
| 304 | process_arguments (int argc, char **argv) | 298 | process_arguments (int argc, char **argv) |
| @@ -338,6 +332,7 @@ process_arguments (int argc, char **argv) | |||
| 338 | 332 | ||
| 339 | switch (c) { | 333 | switch (c) { |
| 340 | case '?': /* help */ | 334 | case '?': /* help */ |
| 335 | printf (_("%s: Unknown argument: %s\n\n"), progname, optarg); | ||
| 341 | print_usage (); | 336 | print_usage (); |
| 342 | exit (STATE_UNKNOWN); | 337 | exit (STATE_UNKNOWN); |
| 343 | case 'h': /* help */ | 338 | case 'h': /* help */ |
| @@ -495,7 +490,6 @@ process_arguments (int argc, char **argv) | |||
| 495 | 490 | ||
| 496 | 491 | ||
| 497 | 492 | ||
| 498 | |||
| 499 | int | 493 | int |
| 500 | validate_arguments () | 494 | validate_arguments () |
| 501 | { | 495 | { |
| @@ -543,9 +537,6 @@ validate_arguments () | |||
| 543 | 537 | ||
| 544 | 538 | ||
| 545 | 539 | ||
| 546 | |||
| 547 | |||
| 548 | |||
| 549 | /* Check thresholds against value */ | 540 | /* Check thresholds against value */ |
| 550 | int | 541 | int |
| 551 | check_thresholds (int value) | 542 | check_thresholds (int value) |
| @@ -580,9 +571,6 @@ check_thresholds (int value) | |||
| 580 | 571 | ||
| 581 | 572 | ||
| 582 | 573 | ||
| 583 | |||
| 584 | |||
| 585 | |||
| 586 | void | 574 | void |
| 587 | print_help (void) | 575 | print_help (void) |
| 588 | { | 576 | { |
| @@ -671,6 +659,8 @@ Examples:\n\ | |||
| 671 | printf (_(UT_SUPPORT)); | 659 | printf (_(UT_SUPPORT)); |
| 672 | } | 660 | } |
| 673 | 661 | ||
| 662 | |||
| 663 | |||
| 674 | void | 664 | void |
| 675 | print_usage (void) | 665 | print_usage (void) |
| 676 | { | 666 | { |
| @@ -681,3 +671,4 @@ Usage: %s -w <range> -c <range> [-m metric] [-s state] [-p ppid]\n\ | |||
| 681 | printf (_(UT_HLP_VRS), progname, progname); | 671 | printf (_(UT_HLP_VRS), progname, progname); |
| 682 | } | 672 | } |
| 683 | 673 | ||
| 674 | |||
diff --git a/plugins/check_radius.c b/plugins/check_radius.c index 725cf9f8..3e6bdcae 100644 --- a/plugins/check_radius.c +++ b/plugins/check_radius.c | |||
| @@ -14,6 +14,8 @@ | |||
| 14 | along with this program; if not, write to the Free Software | 14 | along with this program; if not, write to the Free Software |
| 15 | Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | 15 | Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
| 16 | 16 | ||
| 17 | $Id$ | ||
| 18 | |||
| 17 | ******************************************************************************/ | 19 | ******************************************************************************/ |
| 18 | 20 | ||
| 19 | const char *progname = "check_radius"; | 21 | const char *progname = "check_radius"; |
| @@ -94,6 +96,8 @@ Please note that all tags must be lowercase to use the DocBook XML DTD. | |||
| 94 | -@@ | 96 | -@@ |
| 95 | ******************************************************************************/ | 97 | ******************************************************************************/ |
| 96 | 98 | ||
| 99 | |||
| 100 | |||
| 97 | int | 101 | int |
| 98 | main (int argc, char **argv) | 102 | main (int argc, char **argv) |
| 99 | { | 103 | { |
| @@ -109,7 +113,7 @@ main (int argc, char **argv) | |||
| 109 | textdomain (PACKAGE); | 113 | textdomain (PACKAGE); |
| 110 | 114 | ||
| 111 | if (process_arguments (argc, argv) == ERROR) | 115 | if (process_arguments (argc, argv) == ERROR) |
| 112 | usage (_("Could not parse arguments\n")); | 116 | usage (_("check_radius: could not parse arguments\n")); |
| 113 | 117 | ||
| 114 | str = strdup ("dictionary"); | 118 | str = strdup ("dictionary"); |
| 115 | if ((config_file && rc_read_config (config_file)) || | 119 | if ((config_file && rc_read_config (config_file)) || |
| @@ -199,7 +203,7 @@ process_arguments (int argc, char **argv) | |||
| 199 | if (is_intpos (argv[7])) | 203 | if (is_intpos (argv[7])) |
| 200 | port = atoi (argv[7]); | 204 | port = atoi (argv[7]); |
| 201 | else | 205 | else |
| 202 | usage (_("Server port must be a positive integer")); | 206 | usage (_("Port must be a positive integer")); |
| 203 | expect = argv[8]; | 207 | expect = argv[8]; |
| 204 | return OK; | 208 | return OK; |
| 205 | } | 209 | } |
| @@ -227,7 +231,7 @@ process_arguments (int argc, char **argv) | |||
| 227 | break; | 231 | break; |
| 228 | case 'H': /* hostname */ | 232 | case 'H': /* hostname */ |
| 229 | if (is_host (optarg) == FALSE) { | 233 | if (is_host (optarg) == FALSE) { |
| 230 | usage2 (_("Invalid host name/address"), optarg); | 234 | usage2 (_("Invalid hostname/address"), optarg); |
| 231 | } | 235 | } |
| 232 | server = optarg; | 236 | server = optarg; |
| 233 | break; | 237 | break; |
| @@ -235,7 +239,7 @@ process_arguments (int argc, char **argv) | |||
| 235 | if (is_intnonneg (optarg)) | 239 | if (is_intnonneg (optarg)) |
| 236 | port = atoi (optarg); | 240 | port = atoi (optarg); |
| 237 | else | 241 | else |
| 238 | usage (_("Server port must be a positive integer")); | 242 | usage (_("Port must be a positive integer")); |
| 239 | break; | 243 | break; |
| 240 | case 'u': /* username */ | 244 | case 'u': /* username */ |
| 241 | username = optarg; | 245 | username = optarg; |
| @@ -271,9 +275,6 @@ process_arguments (int argc, char **argv) | |||
| 271 | 275 | ||
| 272 | 276 | ||
| 273 | 277 | ||
| 274 | |||
| 275 | |||
| 276 | |||
| 277 | void | 278 | void |
| 278 | print_help (void) | 279 | print_help (void) |
| 279 | { | 280 | { |
| @@ -329,7 +330,6 @@ otherwise compormise could occur.\n")); | |||
| 329 | 330 | ||
| 330 | 331 | ||
| 331 | 332 | ||
| 332 | |||
| 333 | void | 333 | void |
| 334 | print_usage (void) | 334 | print_usage (void) |
| 335 | { | 335 | { |
diff --git a/plugins/check_real.c b/plugins/check_real.c index 755f6eb2..3686ff4b 100644 --- a/plugins/check_real.c +++ b/plugins/check_real.c | |||
| @@ -14,6 +14,8 @@ | |||
| 14 | along with this program; if not, write to the Free Software | 14 | along with this program; if not, write to the Free Software |
| 15 | Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | 15 | Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
| 16 | 16 | ||
| 17 | $Id$ | ||
| 18 | |||
| 17 | ******************************************************************************/ | 19 | ******************************************************************************/ |
| 18 | 20 | ||
| 19 | const char *progname = "check_real"; | 21 | const char *progname = "check_real"; |
| @@ -50,9 +52,6 @@ int verbose = FALSE; | |||
| 50 | 52 | ||
| 51 | 53 | ||
| 52 | 54 | ||
| 53 | |||
| 54 | |||
| 55 | |||
| 56 | int | 55 | int |
| 57 | main (int argc, char **argv) | 56 | main (int argc, char **argv) |
| 58 | { | 57 | { |
| @@ -66,7 +65,7 @@ main (int argc, char **argv) | |||
| 66 | textdomain (PACKAGE); | 65 | textdomain (PACKAGE); |
| 67 | 66 | ||
| 68 | if (process_arguments (argc, argv) != OK) | 67 | if (process_arguments (argc, argv) != OK) |
| 69 | usage (_("Incorrect arguments supplied\n")); | 68 | usage (_("check_real: could not parse arguments\n")); |
| 70 | 69 | ||
| 71 | /* initialize alarm signal handling */ | 70 | /* initialize alarm signal handling */ |
| 72 | signal (SIGALRM, socket_timeout_alarm_handler); | 71 | signal (SIGALRM, socket_timeout_alarm_handler); |
| @@ -251,9 +250,6 @@ main (int argc, char **argv) | |||
| 251 | 250 | ||
| 252 | 251 | ||
| 253 | 252 | ||
| 254 | |||
| 255 | |||
| 256 | |||
| 257 | /* process command-line arguments */ | 253 | /* process command-line arguments */ |
| 258 | int | 254 | int |
| 259 | process_arguments (int argc, char **argv) | 255 | process_arguments (int argc, char **argv) |
| @@ -303,7 +299,7 @@ process_arguments (int argc, char **argv) | |||
| 303 | else if (is_host (optarg)) | 299 | else if (is_host (optarg)) |
| 304 | server_address = optarg; | 300 | server_address = optarg; |
| 305 | else | 301 | else |
| 306 | usage2 (_("Invalid host name"), optarg); | 302 | usage2 (_("Invalid hostname/address"), optarg); |
| 307 | break; | 303 | break; |
| 308 | case 'e': /* string to expect in response header */ | 304 | case 'e': /* string to expect in response header */ |
| 309 | server_expect = optarg; | 305 | server_expect = optarg; |
| @@ -316,7 +312,7 @@ process_arguments (int argc, char **argv) | |||
| 316 | server_port = atoi (optarg); | 312 | server_port = atoi (optarg); |
| 317 | } | 313 | } |
| 318 | else { | 314 | else { |
| 319 | usage (_("Server port must be a positive integer\n")); | 315 | usage (_("Port must be a positive integer\n")); |
| 320 | } | 316 | } |
| 321 | break; | 317 | break; |
| 322 | case 'w': /* warning time threshold */ | 318 | case 'w': /* warning time threshold */ |
| @@ -325,7 +321,7 @@ process_arguments (int argc, char **argv) | |||
| 325 | check_warning_time = TRUE; | 321 | check_warning_time = TRUE; |
| 326 | } | 322 | } |
| 327 | else { | 323 | else { |
| 328 | usage (_("Warning time must be a nonnegative integer\n")); | 324 | usage (_("Warning time must be a positive integer\n")); |
| 329 | } | 325 | } |
| 330 | break; | 326 | break; |
| 331 | case 'c': /* critical time threshold */ | 327 | case 'c': /* critical time threshold */ |
| @@ -355,7 +351,9 @@ process_arguments (int argc, char **argv) | |||
| 355 | print_help (); | 351 | print_help (); |
| 356 | exit (STATE_OK); | 352 | exit (STATE_OK); |
| 357 | case '?': /* usage */ | 353 | case '?': /* usage */ |
| 358 | usage (_("Invalid argument\n")); | 354 | printf (_("%s: Unknown argument: %s\n\n"), progname, optarg); |
| 355 | print_usage (); | ||
| 356 | exit (STATE_UNKNOWN); | ||
| 359 | } | 357 | } |
| 360 | } | 358 | } |
| 361 | 359 | ||
| @@ -365,7 +363,7 @@ process_arguments (int argc, char **argv) | |||
| 365 | server_address = argv[c++]; | 363 | server_address = argv[c++]; |
| 366 | } | 364 | } |
| 367 | else { | 365 | else { |
| 368 | usage2 (_("Invalid host name"), argv[c]); | 366 | usage2 (_("Invalid hostname/address"), argv[c]); |
| 369 | } | 367 | } |
| 370 | } | 368 | } |
| 371 | 369 | ||
| @@ -383,8 +381,6 @@ process_arguments (int argc, char **argv) | |||
| 383 | 381 | ||
| 384 | 382 | ||
| 385 | 383 | ||
| 386 | |||
| 387 | |||
| 388 | int | 384 | int |
| 389 | validate_arguments (void) | 385 | validate_arguments (void) |
| 390 | { | 386 | { |
| @@ -393,8 +389,6 @@ validate_arguments (void) | |||
| 393 | 389 | ||
| 394 | 390 | ||
| 395 | 391 | ||
| 396 | |||
| 397 | |||
| 398 | void | 392 | void |
| 399 | print_help (void) | 393 | print_help (void) |
| 400 | { | 394 | { |
| @@ -439,8 +433,6 @@ values.")); | |||
| 439 | 433 | ||
| 440 | 434 | ||
| 441 | 435 | ||
| 442 | |||
| 443 | |||
| 444 | void | 436 | void |
| 445 | print_usage (void) | 437 | print_usage (void) |
| 446 | { | 438 | { |
diff --git a/plugins/check_smtp.c b/plugins/check_smtp.c index ae3f88b1..696af656 100644 --- a/plugins/check_smtp.c +++ b/plugins/check_smtp.c | |||
| @@ -14,6 +14,8 @@ | |||
| 14 | along with this program; if not, write to the Free Software | 14 | along with this program; if not, write to the Free Software |
| 15 | Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | 15 | Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
| 16 | 16 | ||
| 17 | $Id$ | ||
| 18 | |||
| 17 | ******************************************************************************/ | 19 | ******************************************************************************/ |
| 18 | 20 | ||
| 19 | const char *progname = "check_smtp"; | 21 | const char *progname = "check_smtp"; |
| @@ -69,9 +71,6 @@ int verbose = 0; | |||
| 69 | 71 | ||
| 70 | 72 | ||
| 71 | 73 | ||
| 72 | |||
| 73 | |||
| 74 | |||
| 75 | int | 74 | int |
| 76 | main (int argc, char **argv) | 75 | main (int argc, char **argv) |
| 77 | { | 76 | { |
| @@ -90,7 +89,7 @@ main (int argc, char **argv) | |||
| 90 | textdomain (PACKAGE); | 89 | textdomain (PACKAGE); |
| 91 | 90 | ||
| 92 | if (process_arguments (argc, argv) != OK) | 91 | if (process_arguments (argc, argv) != OK) |
| 93 | usage (_("Incorrect arguments supplied\n")); | 92 | usage (_("check_smtp: could not parse arguments\n")); |
| 94 | 93 | ||
| 95 | /* initialize the HELO command with the localhostname */ | 94 | /* initialize the HELO command with the localhostname */ |
| 96 | #ifndef HOST_MAX_BYTES | 95 | #ifndef HOST_MAX_BYTES |
| @@ -238,9 +237,6 @@ main (int argc, char **argv) | |||
| 238 | 237 | ||
| 239 | 238 | ||
| 240 | 239 | ||
| 241 | |||
| 242 | |||
| 243 | |||
| 244 | /* process command-line arguments */ | 240 | /* process command-line arguments */ |
| 245 | int | 241 | int |
| 246 | process_arguments (int argc, char **argv) | 242 | process_arguments (int argc, char **argv) |
| @@ -292,14 +288,14 @@ process_arguments (int argc, char **argv) | |||
| 292 | server_address = optarg; | 288 | server_address = optarg; |
| 293 | } | 289 | } |
| 294 | else { | 290 | else { |
| 295 | usage2 (_("Invalid host name"), optarg); | 291 | usage2 (_("Invalid hostname/address"), optarg); |
| 296 | } | 292 | } |
| 297 | break; | 293 | break; |
| 298 | case 'p': /* port */ | 294 | case 'p': /* port */ |
| 299 | if (is_intpos (optarg)) | 295 | if (is_intpos (optarg)) |
| 300 | server_port = atoi (optarg); | 296 | server_port = atoi (optarg); |
| 301 | else | 297 | else |
| 302 | usage (_("Server port must be a positive integer\n")); | 298 | usage (_("Port must be a positive integer\n")); |
| 303 | break; | 299 | break; |
| 304 | case 'f': /* from argument */ | 300 | case 'f': /* from argument */ |
| 305 | from_arg = optarg; | 301 | from_arg = optarg; |
| @@ -334,7 +330,7 @@ process_arguments (int argc, char **argv) | |||
| 334 | check_critical_time = TRUE; | 330 | check_critical_time = TRUE; |
| 335 | } | 331 | } |
| 336 | else { | 332 | else { |
| 337 | usage (_("Critical time must be a nonnegative integer\n")); | 333 | usage (_("Critical time must be a positive integer\n")); |
| 338 | } | 334 | } |
| 339 | break; | 335 | break; |
| 340 | case 'w': /* warning time threshold */ | 336 | case 'w': /* warning time threshold */ |
| @@ -343,7 +339,7 @@ process_arguments (int argc, char **argv) | |||
| 343 | check_warning_time = TRUE; | 339 | check_warning_time = TRUE; |
| 344 | } | 340 | } |
| 345 | else { | 341 | else { |
| 346 | usage (_("Warning time must be a nonnegative integer\n")); | 342 | usage (_("Warning time must be a positive integer\n")); |
| 347 | } | 343 | } |
| 348 | break; | 344 | break; |
| 349 | case 'v': /* verbose */ | 345 | case 'v': /* verbose */ |
| @@ -354,7 +350,7 @@ process_arguments (int argc, char **argv) | |||
| 354 | socket_timeout = atoi (optarg); | 350 | socket_timeout = atoi (optarg); |
| 355 | } | 351 | } |
| 356 | else { | 352 | else { |
| 357 | usage (_("Time interval must be a nonnegative integer\n")); | 353 | usage (_("Time interval must be a positive integer\n")); |
| 358 | } | 354 | } |
| 359 | break; | 355 | break; |
| 360 | case '4': | 356 | case '4': |
| @@ -374,7 +370,9 @@ process_arguments (int argc, char **argv) | |||
| 374 | print_help (); | 370 | print_help (); |
| 375 | exit (STATE_OK); | 371 | exit (STATE_OK); |
| 376 | case '?': /* help */ | 372 | case '?': /* help */ |
| 377 | usage (_("Invalid argument\n")); | 373 | printf (_("%s: Unknown argument: %s\n\n"), progname, optarg); |
| 374 | print_usage (); | ||
| 375 | exit (STATE_UNKNOWN); | ||
| 378 | } | 376 | } |
| 379 | } | 377 | } |
| 380 | 378 | ||
| @@ -384,7 +382,7 @@ process_arguments (int argc, char **argv) | |||
| 384 | if (is_host (argv[c])) | 382 | if (is_host (argv[c])) |
| 385 | server_address = argv[c]; | 383 | server_address = argv[c]; |
| 386 | else | 384 | else |
| 387 | usage2 (_("Invalid host name"), argv[c]); | 385 | usage2 (_("Invalid hostname/address"), argv[c]); |
| 388 | } | 386 | } |
| 389 | else { | 387 | else { |
| 390 | asprintf (&server_address, "127.0.0.1"); | 388 | asprintf (&server_address, "127.0.0.1"); |
| @@ -405,8 +403,6 @@ process_arguments (int argc, char **argv) | |||
| 405 | 403 | ||
| 406 | 404 | ||
| 407 | 405 | ||
| 408 | |||
| 409 | |||
| 410 | int | 406 | int |
| 411 | validate_arguments (void) | 407 | validate_arguments (void) |
| 412 | { | 408 | { |
| @@ -415,9 +411,6 @@ validate_arguments (void) | |||
| 415 | 411 | ||
| 416 | 412 | ||
| 417 | 413 | ||
| 418 | |||
| 419 | |||
| 420 | |||
| 421 | void | 414 | void |
| 422 | print_help (void) | 415 | print_help (void) |
| 423 | { | 416 | { |
| @@ -470,8 +463,6 @@ STATE_WARNING return values.\n")); | |||
| 470 | 463 | ||
| 471 | 464 | ||
| 472 | 465 | ||
| 473 | |||
| 474 | |||
| 475 | void | 466 | void |
| 476 | print_usage (void) | 467 | print_usage (void) |
| 477 | { | 468 | { |
| @@ -480,6 +471,3 @@ Usage: %s -H host [-p port] [-e expect] [-C command] [-f from addr]\n\ | |||
| 480 | [-w warn] [-c crit] [-t timeout] [-n] [-v] [-4|-6]\n", progname); | 471 | [-w warn] [-c crit] [-t timeout] [-n] [-v] [-4|-6]\n", progname); |
| 481 | printf (_(UT_HLP_VRS), progname, progname); | 472 | printf (_(UT_HLP_VRS), progname, progname); |
| 482 | } | 473 | } |
| 483 | |||
| 484 | |||
| 485 | |||
diff --git a/plugins/check_snmp.c b/plugins/check_snmp.c index 11ea9559..7d0ebc92 100644 --- a/plugins/check_snmp.c +++ b/plugins/check_snmp.c | |||
| @@ -14,6 +14,8 @@ | |||
| 14 | along with this program; if not, write to the Free Software | 14 | along with this program; if not, write to the Free Software |
| 15 | Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | 15 | Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
| 16 | 16 | ||
| 17 | $Id$ | ||
| 18 | |||
| 17 | ******************************************************************************/ | 19 | ******************************************************************************/ |
| 18 | 20 | ||
| 19 | const char *progname = "check_snmp"; | 21 | const char *progname = "check_snmp"; |
| @@ -118,9 +120,6 @@ char *miblist; | |||
| 118 | 120 | ||
| 119 | 121 | ||
| 120 | 122 | ||
| 121 | |||
| 122 | |||
| 123 | |||
| 124 | int | 123 | int |
| 125 | main (int argc, char **argv) | 124 | main (int argc, char **argv) |
| 126 | { | 125 | { |
| @@ -158,7 +157,7 @@ main (int argc, char **argv) | |||
| 158 | miblist = strdup (DEFAULT_MIBLIST); | 157 | miblist = strdup (DEFAULT_MIBLIST); |
| 159 | 158 | ||
| 160 | if (process_arguments (argc, argv) == ERROR) | 159 | if (process_arguments (argc, argv) == ERROR) |
| 161 | usage (_("Incorrect arguments supplied\n")); | 160 | usage (_("check_snmp: could not parse arguments\n")); |
| 162 | 161 | ||
| 163 | /* create the command line to execute */ | 162 | /* create the command line to execute */ |
| 164 | asprintf (&command_line, "%s -t 1 -r %d -m %s -v %s %s %s:%s %s", | 163 | asprintf (&command_line, "%s -t 1 -r %d -m %s -v %s %s %s:%s %s", |
| @@ -344,9 +343,6 @@ main (int argc, char **argv) | |||
| 344 | 343 | ||
| 345 | 344 | ||
| 346 | 345 | ||
| 347 | |||
| 348 | |||
| 349 | |||
| 350 | /* process command-line arguments */ | 346 | /* process command-line arguments */ |
| 351 | int | 347 | int |
| 352 | process_arguments (int argc, char **argv) | 348 | process_arguments (int argc, char **argv) |
| @@ -402,7 +398,9 @@ process_arguments (int argc, char **argv) | |||
| 402 | 398 | ||
| 403 | switch (c) { | 399 | switch (c) { |
| 404 | case '?': /* usage */ | 400 | case '?': /* usage */ |
| 405 | usage3 ("Unknown argument", optopt); | 401 | printf (_("%s: Unknown argument: %s\n\n"), progname, optarg); |
| 402 | print_usage (); | ||
| 403 | exit (STATE_UNKNOWN); | ||
| 406 | case 'h': /* help */ | 404 | case 'h': /* help */ |
| 407 | print_help (); | 405 | print_help (); |
| 408 | exit (STATE_OK); | 406 | exit (STATE_OK); |
| @@ -601,8 +599,6 @@ process_arguments (int argc, char **argv) | |||
| 601 | } | 599 | } |
| 602 | 600 | ||
| 603 | 601 | ||
| 604 | |||
| 605 | |||
| 606 | /****************************************************************************** | 602 | /****************************************************************************** |
| 607 | 603 | ||
| 608 | @@- | 604 | @@- |
| @@ -623,6 +619,8 @@ first character cannot be a number, however.</para> | |||
| 623 | -@@ | 619 | -@@ |
| 624 | ******************************************************************************/ | 620 | ******************************************************************************/ |
| 625 | 621 | ||
| 622 | |||
| 623 | |||
| 626 | int | 624 | int |
| 627 | validate_arguments () | 625 | validate_arguments () |
| 628 | { | 626 | { |
| @@ -665,7 +663,6 @@ validate_arguments () | |||
| 665 | asprintf(&authpriv, "-l authPriv -a %s -u %s -A %s -x DES -X %s ", authproto, secname, authpasswd, privpasswd); | 663 | asprintf(&authpriv, "-l authPriv -a %s -u %s -A %s -x DES -X %s ", authproto, secname, authpasswd, privpasswd); |
| 666 | } | 664 | } |
| 667 | 665 | ||
| 668 | |||
| 669 | } | 666 | } |
| 670 | else { | 667 | else { |
| 671 | printf (_("Invalid SNMP version: %s\n"), proto); | 668 | printf (_("Invalid SNMP version: %s\n"), proto); |
| @@ -673,17 +670,11 @@ validate_arguments () | |||
| 673 | exit (STATE_UNKNOWN); | 670 | exit (STATE_UNKNOWN); |
| 674 | } | 671 | } |
| 675 | 672 | ||
| 676 | |||
| 677 | |||
| 678 | |||
| 679 | return OK; | 673 | return OK; |
| 680 | } | 674 | } |
| 681 | 675 | ||
| 682 | 676 | ||
| 683 | 677 | ||
| 684 | |||
| 685 | |||
| 686 | |||
| 687 | char * | 678 | char * |
| 688 | clarify_message (char *msg) | 679 | clarify_message (char *msg) |
| 689 | { | 680 | { |
| @@ -721,7 +712,6 @@ clarify_message (char *msg) | |||
| 721 | 712 | ||
| 722 | 713 | ||
| 723 | 714 | ||
| 724 | |||
| 725 | int | 715 | int |
| 726 | check_num (int i) | 716 | check_num (int i) |
| 727 | { | 717 | { |
| @@ -766,7 +756,6 @@ check_num (int i) | |||
| 766 | 756 | ||
| 767 | 757 | ||
| 768 | 758 | ||
| 769 | |||
| 770 | int | 759 | int |
| 771 | lu_getll (unsigned long *ll, char *str) | 760 | lu_getll (unsigned long *ll, char *str) |
| 772 | { | 761 | { |
| @@ -782,7 +771,6 @@ lu_getll (unsigned long *ll, char *str) | |||
| 782 | 771 | ||
| 783 | 772 | ||
| 784 | 773 | ||
| 785 | |||
| 786 | int | 774 | int |
| 787 | lu_getul (unsigned long *ul, char *str) | 775 | lu_getul (unsigned long *ul, char *str) |
| 788 | { | 776 | { |
| @@ -798,7 +786,6 @@ lu_getul (unsigned long *ul, char *str) | |||
| 798 | 786 | ||
| 799 | 787 | ||
| 800 | 788 | ||
| 801 | |||
| 802 | /* trim leading whitespace | 789 | /* trim leading whitespace |
| 803 | if there is a leading quote, make sure it balances */ | 790 | if there is a leading quote, make sure it balances */ |
| 804 | 791 | ||
| @@ -815,7 +802,6 @@ thisarg (char *str) | |||
| 815 | 802 | ||
| 816 | 803 | ||
| 817 | 804 | ||
| 818 | |||
| 819 | /* if there's a leading quote, advance to the trailing quote | 805 | /* if there's a leading quote, advance to the trailing quote |
| 820 | set the trailing quote to '\x0' | 806 | set the trailing quote to '\x0' |
| 821 | if the string continues, advance beyond the comma */ | 807 | if the string continues, advance beyond the comma */ |
| @@ -851,9 +837,6 @@ nextarg (char *str) | |||
| 851 | 837 | ||
| 852 | 838 | ||
| 853 | 839 | ||
| 854 | |||
| 855 | |||
| 856 | |||
| 857 | void | 840 | void |
| 858 | print_help (void) | 841 | print_help (void) |
| 859 | { | 842 | { |
| @@ -960,6 +943,8 @@ Check status of remote machines and obtain sustem information via SNMP\n\n")); | |||
| 960 | printf (_(UT_SUPPORT)); | 943 | printf (_(UT_SUPPORT)); |
| 961 | } | 944 | } |
| 962 | 945 | ||
| 946 | |||
| 947 | |||
| 963 | void | 948 | void |
| 964 | print_usage (void) | 949 | print_usage (void) |
| 965 | { | 950 | { |
diff --git a/plugins/check_ssh.c b/plugins/check_ssh.c index ea74fa88..b78443fe 100644 --- a/plugins/check_ssh.c +++ b/plugins/check_ssh.c | |||
| @@ -14,6 +14,8 @@ | |||
| 14 | along with this program; if not, write to the Free Software | 14 | along with this program; if not, write to the Free Software |
| 15 | Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | 15 | Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
| 16 | 16 | ||
| 17 | $Id$ | ||
| 18 | |||
| 17 | ******************************************************************************/ | 19 | ******************************************************************************/ |
| 18 | 20 | ||
| 19 | #include "common.h" | 21 | #include "common.h" |
| @@ -44,6 +46,8 @@ void print_usage (void); | |||
| 44 | 46 | ||
| 45 | int ssh_connect (char *haddr, int hport, char *remote_version); | 47 | int ssh_connect (char *haddr, int hport, char *remote_version); |
| 46 | 48 | ||
| 49 | |||
| 50 | |||
| 47 | int | 51 | int |
| 48 | main (int argc, char **argv) | 52 | main (int argc, char **argv) |
| 49 | { | 53 | { |
| @@ -54,7 +58,7 @@ main (int argc, char **argv) | |||
| 54 | textdomain (PACKAGE); | 58 | textdomain (PACKAGE); |
| 55 | 59 | ||
| 56 | if (process_arguments (argc, argv) == ERROR) | 60 | if (process_arguments (argc, argv) == ERROR) |
| 57 | usage (_("Could not parse arguments\n")); | 61 | usage (_("check_ssh: could not parse arguments\n")); |
| 58 | 62 | ||
| 59 | /* initialize alarm signal handling */ | 63 | /* initialize alarm signal handling */ |
| 60 | signal (SIGALRM, socket_timeout_alarm_handler); | 64 | signal (SIGALRM, socket_timeout_alarm_handler); |
| @@ -69,6 +73,7 @@ main (int argc, char **argv) | |||
| 69 | } | 73 | } |
| 70 | 74 | ||
| 71 | 75 | ||
| 76 | |||
| 72 | /* process command-line arguments */ | 77 | /* process command-line arguments */ |
| 73 | int | 78 | int |
| 74 | process_arguments (int argc, char **argv) | 79 | process_arguments (int argc, char **argv) |
| @@ -104,8 +109,9 @@ process_arguments (int argc, char **argv) | |||
| 104 | 109 | ||
| 105 | switch (c) { | 110 | switch (c) { |
| 106 | case '?': /* help */ | 111 | case '?': /* help */ |
| 107 | usage (_("Unknow argument\n")); | 112 | printf (_("%s: Unknown argument: %s\n\n"), progname, optarg); |
| 108 | break; | 113 | print_usage (); |
| 114 | exit (STATE_UNKNOWN); | ||
| 109 | case 'V': /* version */ | 115 | case 'V': /* version */ |
| 110 | print_revision (progname, revision); | 116 | print_revision (progname, revision); |
| 111 | exit (STATE_OK); | 117 | exit (STATE_OK); |
| @@ -188,6 +194,7 @@ validate_arguments (void) | |||
| 188 | * | 194 | * |
| 189 | *-----------------------------------------------------------------------*/ | 195 | *-----------------------------------------------------------------------*/ |
| 190 | 196 | ||
| 197 | |||
| 191 | int | 198 | int |
| 192 | ssh_connect (char *haddr, int hport, char *remote_version) | 199 | ssh_connect (char *haddr, int hport, char *remote_version) |
| 193 | { | 200 | { |
| @@ -240,6 +247,8 @@ ssh_connect (char *haddr, int hport, char *remote_version) | |||
| 240 | } | 247 | } |
| 241 | } | 248 | } |
| 242 | 249 | ||
| 250 | |||
| 251 | |||
| 243 | void | 252 | void |
| 244 | print_help (void) | 253 | print_help (void) |
| 245 | { | 254 | { |
| @@ -272,6 +281,8 @@ print_help (void) | |||
| 272 | printf (_(UT_SUPPORT)); | 281 | printf (_(UT_SUPPORT)); |
| 273 | } | 282 | } |
| 274 | 283 | ||
| 284 | |||
| 285 | |||
| 275 | void | 286 | void |
| 276 | print_usage (void) | 287 | print_usage (void) |
| 277 | { | 288 | { |
diff --git a/plugins/check_swap.c b/plugins/check_swap.c index 3016e1ad..064c65e4 100644 --- a/plugins/check_swap.c +++ b/plugins/check_swap.c | |||
| @@ -326,7 +326,6 @@ main (int argc, char **argv) | |||
| 326 | 326 | ||
| 327 | 327 | ||
| 328 | 328 | ||
| 329 | |||
| 330 | int | 329 | int |
| 331 | check_swap (int usp, long unsigned int free_swap) | 330 | check_swap (int usp, long unsigned int free_swap) |
| 332 | { | 331 | { |
| @@ -346,6 +345,7 @@ check_swap (int usp, long unsigned int free_swap) | |||
| 346 | } | 345 | } |
| 347 | 346 | ||
| 348 | 347 | ||
| 348 | |||
| 349 | /* process command-line arguments */ | 349 | /* process command-line arguments */ |
| 350 | int | 350 | int |
| 351 | process_arguments (int argc, char **argv) | 351 | process_arguments (int argc, char **argv) |
| @@ -420,7 +420,9 @@ process_arguments (int argc, char **argv) | |||
| 420 | print_help (); | 420 | print_help (); |
| 421 | exit (STATE_OK); | 421 | exit (STATE_OK); |
| 422 | case '?': /* error */ | 422 | case '?': /* error */ |
| 423 | usage (_("Invalid argument\n")); | 423 | printf (_("%s: Unknown argument: %s\n\n"), progname, optarg); |
| 424 | print_usage (); | ||
| 425 | exit (STATE_UNKNOWN); | ||
| 424 | } | 426 | } |
| 425 | } | 427 | } |
| 426 | 428 | ||
| @@ -450,8 +452,6 @@ process_arguments (int argc, char **argv) | |||
| 450 | 452 | ||
| 451 | 453 | ||
| 452 | 454 | ||
| 453 | |||
| 454 | |||
| 455 | int | 455 | int |
| 456 | validate_arguments (void) | 456 | validate_arguments (void) |
| 457 | { | 457 | { |
| @@ -472,9 +472,6 @@ validate_arguments (void) | |||
| 472 | 472 | ||
| 473 | 473 | ||
| 474 | 474 | ||
| 475 | |||
| 476 | |||
| 477 | |||
| 478 | void | 475 | void |
| 479 | print_help (void) | 476 | print_help (void) |
| 480 | { | 477 | { |
| @@ -514,7 +511,6 @@ On AIX, if -a is specified, uses lsps -a, otherwise uses lsps -s.\n")); | |||
| 514 | 511 | ||
| 515 | 512 | ||
| 516 | 513 | ||
| 517 | |||
| 518 | void | 514 | void |
| 519 | print_usage (void) | 515 | print_usage (void) |
| 520 | { | 516 | { |
diff --git a/plugins/check_tcp.c b/plugins/check_tcp.c index 7cef8bb9..285932d5 100644 --- a/plugins/check_tcp.c +++ b/plugins/check_tcp.c | |||
| @@ -14,6 +14,8 @@ | |||
| 14 | along with this program; if not, write to the Free Software | 14 | along with this program; if not, write to the Free Software |
| 15 | Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | 15 | Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
| 16 | 16 | ||
| 17 | $Id$ | ||
| 18 | |||
| 17 | *****************************************************************************/ | 19 | *****************************************************************************/ |
| 18 | 20 | ||
| 19 | /* progname "check_tcp" changes depending on symlink called */ | 21 | /* progname "check_tcp" changes depending on symlink called */ |
| @@ -100,9 +102,6 @@ char *buffer; | |||
| 100 | 102 | ||
| 101 | 103 | ||
| 102 | 104 | ||
| 103 | |||
| 104 | |||
| 105 | |||
| 106 | int | 105 | int |
| 107 | main (int argc, char **argv) | 106 | main (int argc, char **argv) |
| 108 | { | 107 | { |
| @@ -241,7 +240,7 @@ main (int argc, char **argv) | |||
| 241 | status = strdup (""); | 240 | status = strdup (""); |
| 242 | 241 | ||
| 243 | if (process_arguments (argc, argv) == ERROR) | 242 | if (process_arguments (argc, argv) == ERROR) |
| 244 | usage (_("Could not parse arguments\n")); | 243 | usage (_("check_tcp: could not parse arguments\n")); |
| 245 | 244 | ||
| 246 | /* use default expect if none listed in process_arguments() */ | 245 | /* use default expect if none listed in process_arguments() */ |
| 247 | if (EXPECT && server_expect_count == 0) { | 246 | if (EXPECT && server_expect_count == 0) { |
| @@ -389,7 +388,6 @@ main (int argc, char **argv) | |||
| 389 | 388 | ||
| 390 | return result; | 389 | return result; |
| 391 | } | 390 | } |
| 392 | |||
| 393 | 391 | ||
| 394 | 392 | ||
| 395 | 393 | ||
| @@ -481,12 +479,12 @@ process_arguments (int argc, char **argv) | |||
| 481 | break; | 479 | break; |
| 482 | case 'H': /* hostname */ | 480 | case 'H': /* hostname */ |
| 483 | if (is_host (optarg) == FALSE) | 481 | if (is_host (optarg) == FALSE) |
| 484 | usage2 (_("invalid host name or address"), optarg); | 482 | usage2 (_("invalid hostname/address"), optarg); |
| 485 | server_address = optarg; | 483 | server_address = optarg; |
| 486 | break; | 484 | break; |
| 487 | case 'c': /* critical */ | 485 | case 'c': /* critical */ |
| 488 | if (!is_intnonneg (optarg)) | 486 | if (!is_intnonneg (optarg)) |
| 489 | usage (_("Critical threshold must be a nonnegative integer\n")); | 487 | usage (_("Critical threshold must be a positive integer\n")); |
| 490 | else | 488 | else |
| 491 | critical_time = strtod (optarg, NULL); | 489 | critical_time = strtod (optarg, NULL); |
| 492 | check_critical_time = TRUE; | 490 | check_critical_time = TRUE; |
| @@ -496,7 +494,7 @@ process_arguments (int argc, char **argv) | |||
| 496 | break; | 494 | break; |
| 497 | case 'w': /* warning */ | 495 | case 'w': /* warning */ |
| 498 | if (!is_intnonneg (optarg)) | 496 | if (!is_intnonneg (optarg)) |
| 499 | usage (_("Warning threshold must be a nonnegative integer\n")); | 497 | usage (_("Warning threshold must be a positive integer\n")); |
| 500 | else | 498 | else |
| 501 | warning_time = strtod (optarg, NULL); | 499 | warning_time = strtod (optarg, NULL); |
| 502 | check_warning_time = TRUE; | 500 | check_warning_time = TRUE; |
| @@ -517,7 +515,7 @@ process_arguments (int argc, char **argv) | |||
| 517 | break; | 515 | break; |
| 518 | case 'p': /* port */ | 516 | case 'p': /* port */ |
| 519 | if (!is_intpos (optarg)) | 517 | if (!is_intpos (optarg)) |
| 520 | usage (_("Server port must be a positive integer\n")); | 518 | usage (_("Port must be a positive integer\n")); |
| 521 | else | 519 | else |
| 522 | server_port = atoi (optarg); | 520 | server_port = atoi (optarg); |
| 523 | break; | 521 | break; |
| @@ -548,7 +546,7 @@ process_arguments (int argc, char **argv) | |||
| 548 | else if (!strncmp(optarg,"crit",4)) | 546 | else if (!strncmp(optarg,"crit",4)) |
| 549 | econn_refuse_state = STATE_CRITICAL; | 547 | econn_refuse_state = STATE_CRITICAL; |
| 550 | else | 548 | else |
| 551 | usage (_("Refuse mut be one of ok, warn, crit\n")); | 549 | usage (_("Refuse must be one of ok, warn, crit\n")); |
| 552 | break; | 550 | break; |
| 553 | case 'd': | 551 | case 'd': |
| 554 | if (is_intpos (optarg)) | 552 | if (is_intpos (optarg)) |
| @@ -578,7 +576,8 @@ process_arguments (int argc, char **argv) | |||
| 578 | 576 | ||
| 579 | return OK; | 577 | return OK; |
| 580 | } | 578 | } |
| 581 | 579 | ||
| 580 | |||
| 582 | 581 | ||
| 583 | #ifdef HAVE_SSL | 582 | #ifdef HAVE_SSL |
| 584 | int | 583 | int |
| @@ -634,6 +633,8 @@ connect_SSL (void) | |||
| 634 | } | 633 | } |
| 635 | #endif | 634 | #endif |
| 636 | 635 | ||
| 636 | |||
| 637 | |||
| 637 | #ifdef HAVE_SSL | 638 | #ifdef HAVE_SSL |
| 638 | int | 639 | int |
| 639 | check_certificate (X509 ** certificate) | 640 | check_certificate (X509 ** certificate) |
| @@ -710,6 +711,8 @@ check_certificate (X509 ** certificate) | |||
| 710 | } | 711 | } |
| 711 | #endif | 712 | #endif |
| 712 | 713 | ||
| 714 | |||
| 715 | |||
| 713 | int | 716 | int |
| 714 | my_recv (void) | 717 | my_recv (void) |
| 715 | { | 718 | { |
| @@ -731,9 +734,6 @@ my_recv (void) | |||
| 731 | 734 | ||
| 732 | 735 | ||
| 733 | 736 | ||
| 734 | |||
| 735 | |||
| 736 | |||
| 737 | void | 737 | void |
| 738 | print_help (void) | 738 | print_help (void) |
| 739 | { | 739 | { |
| @@ -790,7 +790,6 @@ print_help (void) | |||
| 790 | 790 | ||
| 791 | 791 | ||
| 792 | 792 | ||
| 793 | |||
| 794 | void | 793 | void |
| 795 | print_usage (void) | 794 | print_usage (void) |
| 796 | { | 795 | { |
diff --git a/plugins/check_time.c b/plugins/check_time.c index 314b7683..617b9e02 100644 --- a/plugins/check_time.c +++ b/plugins/check_time.c | |||
| @@ -14,6 +14,8 @@ | |||
| 14 | along with this program; if not, write to the Free Software | 14 | along with this program; if not, write to the Free Software |
| 15 | Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | 15 | Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
| 16 | 16 | ||
| 17 | $Id$ | ||
| 18 | |||
| 17 | ******************************************************************************/ | 19 | ******************************************************************************/ |
| 18 | 20 | ||
| 19 | #include "common.h" | 21 | #include "common.h" |
| @@ -61,7 +63,7 @@ main (int argc, char **argv) | |||
| 61 | textdomain (PACKAGE); | 63 | textdomain (PACKAGE); |
| 62 | 64 | ||
| 63 | if (process_arguments (argc, argv) != OK) | 65 | if (process_arguments (argc, argv) != OK) |
| 64 | usage (_("Incorrect arguments supplied\n")); | 66 | usage (_("check_time: could not parse arguments\n")); |
| 65 | 67 | ||
| 66 | /* initialize alarm signal handling */ | 68 | /* initialize alarm signal handling */ |
| 67 | signal (SIGALRM, socket_timeout_alarm_handler); | 69 | signal (SIGALRM, socket_timeout_alarm_handler); |
| @@ -168,9 +170,6 @@ main (int argc, char **argv) | |||
| 168 | 170 | ||
| 169 | 171 | ||
| 170 | 172 | ||
| 171 | |||
| 172 | |||
| 173 | |||
| 174 | /* process command-line arguments */ | 173 | /* process command-line arguments */ |
| 175 | int | 174 | int |
| 176 | process_arguments (int argc, char **argv) | 175 | process_arguments (int argc, char **argv) |
| @@ -217,7 +216,9 @@ process_arguments (int argc, char **argv) | |||
| 217 | 216 | ||
| 218 | switch (c) { | 217 | switch (c) { |
| 219 | case '?': /* print short usage statement if args not parsable */ | 218 | case '?': /* print short usage statement if args not parsable */ |
| 220 | usage3 (_("Unknown argument"), optopt); | 219 | printf (_("%s: Unknown argument: %s\n\n"), progname, optarg); |
| 220 | print_usage (); | ||
| 221 | exit (STATE_UNKNOWN); | ||
| 221 | case 'h': /* help */ | 222 | case 'h': /* help */ |
| 222 | print_help (); | 223 | print_help (); |
| 223 | exit (STATE_OK); | 224 | exit (STATE_OK); |
| @@ -226,7 +227,7 @@ process_arguments (int argc, char **argv) | |||
| 226 | exit (STATE_OK); | 227 | exit (STATE_OK); |
| 227 | case 'H': /* hostname */ | 228 | case 'H': /* hostname */ |
| 228 | if (is_host (optarg) == FALSE) | 229 | if (is_host (optarg) == FALSE) |
| 229 | usage2 (_("Invalid host name/address"), optarg); | 230 | usage2 (_("Invalid hostname/address"), optarg); |
| 230 | server_address = optarg; | 231 | server_address = optarg; |
| 231 | break; | 232 | break; |
| 232 | case 'w': /* warning-variance */ | 233 | case 'w': /* warning-variance */ |
| @@ -240,11 +241,11 @@ process_arguments (int argc, char **argv) | |||
| 240 | check_warning_time = TRUE; | 241 | check_warning_time = TRUE; |
| 241 | } | 242 | } |
| 242 | else { | 243 | else { |
| 243 | usage (_("Warning thresholds must be a nonnegative integer\n")); | 244 | usage (_("Warning thresholds must be a positive integer\n")); |
| 244 | } | 245 | } |
| 245 | } | 246 | } |
| 246 | else { | 247 | else { |
| 247 | usage (_("Warning threshold must be a nonnegative integer\n")); | 248 | usage (_("Warning threshold must be a positive integer\n")); |
| 248 | } | 249 | } |
| 249 | break; | 250 | break; |
| 250 | case 'c': /* critical-variance */ | 251 | case 'c': /* critical-variance */ |
| @@ -259,30 +260,30 @@ process_arguments (int argc, char **argv) | |||
| 259 | check_critical_time = TRUE; | 260 | check_critical_time = TRUE; |
| 260 | } | 261 | } |
| 261 | else { | 262 | else { |
| 262 | usage (_("Critical thresholds must be a nonnegative integer\n")); | 263 | usage (_("Critical thresholds must be a positive integer\n")); |
| 263 | } | 264 | } |
| 264 | } | 265 | } |
| 265 | else { | 266 | else { |
| 266 | usage (_("Critical threshold must be a nonnegative integer\n")); | 267 | usage (_("Critical threshold must be a positive integer\n")); |
| 267 | } | 268 | } |
| 268 | break; | 269 | break; |
| 269 | case 'W': /* warning-connect */ | 270 | case 'W': /* warning-connect */ |
| 270 | if (!is_intnonneg (optarg)) | 271 | if (!is_intnonneg (optarg)) |
| 271 | usage (_("Warning threshold must be a nonnegative integer\n")); | 272 | usage (_("Warning threshold must be a positive integer\n")); |
| 272 | else | 273 | else |
| 273 | warning_time = atoi (optarg); | 274 | warning_time = atoi (optarg); |
| 274 | check_warning_time = TRUE; | 275 | check_warning_time = TRUE; |
| 275 | break; | 276 | break; |
| 276 | case 'C': /* critical-connect */ | 277 | case 'C': /* critical-connect */ |
| 277 | if (!is_intnonneg (optarg)) | 278 | if (!is_intnonneg (optarg)) |
| 278 | usage (_("Critical threshold must be a nonnegative integer\n")); | 279 | usage (_("Critical threshold must be a positive integer\n")); |
| 279 | else | 280 | else |
| 280 | critical_time = atoi (optarg); | 281 | critical_time = atoi (optarg); |
| 281 | check_critical_time = TRUE; | 282 | check_critical_time = TRUE; |
| 282 | break; | 283 | break; |
| 283 | case 'p': /* port */ | 284 | case 'p': /* port */ |
| 284 | if (!is_intnonneg (optarg)) | 285 | if (!is_intnonneg (optarg)) |
| 285 | usage (_("Server port must be a nonnegative integer\n")); | 286 | usage (_("Port must be a positive integer\n")); |
| 286 | else | 287 | else |
| 287 | server_port = atoi (optarg); | 288 | server_port = atoi (optarg); |
| 288 | break; | 289 | break; |
| @@ -301,11 +302,11 @@ process_arguments (int argc, char **argv) | |||
| 301 | if (server_address == NULL) { | 302 | if (server_address == NULL) { |
| 302 | if (argc > c) { | 303 | if (argc > c) { |
| 303 | if (is_host (argv[c]) == FALSE) | 304 | if (is_host (argv[c]) == FALSE) |
| 304 | usage2 (_("Invalid host name/address"), optarg); | 305 | usage2 (_("Invalid hostname/address"), optarg); |
| 305 | server_address = argv[c]; | 306 | server_address = argv[c]; |
| 306 | } | 307 | } |
| 307 | else { | 308 | else { |
| 308 | usage (_("Host name was not supplied\n")); | 309 | usage (_("Hostname was not supplied\n")); |
| 309 | } | 310 | } |
| 310 | } | 311 | } |
| 311 | 312 | ||
| @@ -314,9 +315,6 @@ process_arguments (int argc, char **argv) | |||
| 314 | 315 | ||
| 315 | 316 | ||
| 316 | 317 | ||
| 317 | |||
| 318 | |||
| 319 | |||
| 320 | void | 318 | void |
| 321 | print_help (void) | 319 | print_help (void) |
| 322 | { | 320 | { |
| @@ -356,7 +354,6 @@ This plugin will check the time on the specified host.\n\n")); | |||
| 356 | 354 | ||
| 357 | 355 | ||
| 358 | 356 | ||
| 359 | |||
| 360 | void | 357 | void |
| 361 | print_usage (void) | 358 | print_usage (void) |
| 362 | { | 359 | { |
diff --git a/plugins/check_udp.c b/plugins/check_udp.c index 05ade04e..64ab83a7 100644 --- a/plugins/check_udp.c +++ b/plugins/check_udp.c | |||
| @@ -14,6 +14,8 @@ | |||
| 14 | along with this program; if not, write to the Free Software | 14 | along with this program; if not, write to the Free Software |
| 15 | Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | 15 | Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
| 16 | 16 | ||
| 17 | $Id$ | ||
| 18 | |||
| 17 | *****************************************************************************/ | 19 | *****************************************************************************/ |
| 18 | 20 | ||
| 19 | const char *progname = "check_udp"; | 21 | const char *progname = "check_udp"; |
| @@ -50,7 +52,7 @@ main (int argc, char **argv) | |||
| 50 | textdomain (PACKAGE); | 52 | textdomain (PACKAGE); |
| 51 | 53 | ||
| 52 | if (process_arguments (argc, argv) == ERROR) | 54 | if (process_arguments (argc, argv) == ERROR) |
| 53 | usage ("\n"); | 55 | usage (_("check_udp: could not parse arguments\n")); |
| 54 | 56 | ||
| 55 | /* initialize alarm signal handling */ | 57 | /* initialize alarm signal handling */ |
| 56 | signal (SIGALRM, socket_timeout_alarm_handler); | 58 | signal (SIGALRM, socket_timeout_alarm_handler); |
| @@ -102,7 +104,6 @@ main (int argc, char **argv) | |||
| 102 | 104 | ||
| 103 | 105 | ||
| 104 | 106 | ||
| 105 | |||
| 106 | /* process command-line arguments */ | 107 | /* process command-line arguments */ |
| 107 | int | 108 | int |
| 108 | process_arguments (int argc, char **argv) | 109 | process_arguments (int argc, char **argv) |
| @@ -158,19 +159,19 @@ process_arguments (int argc, char **argv) | |||
| 158 | break; | 159 | break; |
| 159 | case 'H': /* hostname */ | 160 | case 'H': /* hostname */ |
| 160 | if (is_host (optarg) == FALSE) | 161 | if (is_host (optarg) == FALSE) |
| 161 | usage2 (_("Invalid host name/address"), optarg); | 162 | usage2 (_("Invalid hostname/address"), optarg); |
| 162 | server_address = optarg; | 163 | server_address = optarg; |
| 163 | break; | 164 | break; |
| 164 | case 'c': /* critical */ | 165 | case 'c': /* critical */ |
| 165 | if (!is_intnonneg (optarg)) | 166 | if (!is_intnonneg (optarg)) |
| 166 | usage (_("Critical threshold must be a nonnegative integer\n")); | 167 | usage (_("Critical threshold must be a positive integer\n")); |
| 167 | else | 168 | else |
| 168 | critical_time = atoi (optarg); | 169 | critical_time = atoi (optarg); |
| 169 | check_critical_time = TRUE; | 170 | check_critical_time = TRUE; |
| 170 | break; | 171 | break; |
| 171 | case 'w': /* warning */ | 172 | case 'w': /* warning */ |
| 172 | if (!is_intnonneg (optarg)) | 173 | if (!is_intnonneg (optarg)) |
| 173 | usage (_("Warning threshold must be a nonnegative integer\n")); | 174 | usage (_("Warning threshold must be a positive integer\n")); |
| 174 | else | 175 | else |
| 175 | warning_time = atoi (optarg); | 176 | warning_time = atoi (optarg); |
| 176 | check_warning_time = TRUE; | 177 | check_warning_time = TRUE; |
| @@ -183,7 +184,7 @@ process_arguments (int argc, char **argv) | |||
| 183 | break; | 184 | break; |
| 184 | case 'p': /* port */ | 185 | case 'p': /* port */ |
| 185 | if (!is_intnonneg (optarg)) | 186 | if (!is_intnonneg (optarg)) |
| 186 | usage (_("Server port must be a nonnegative integer\n")); | 187 | usage (_("Port must be a positive integer\n")); |
| 187 | else | 188 | else |
| 188 | server_port = atoi (optarg); | 189 | server_port = atoi (optarg); |
| 189 | break; | 190 | break; |
| @@ -199,7 +200,7 @@ process_arguments (int argc, char **argv) | |||
| 199 | c = optind; | 200 | c = optind; |
| 200 | if (server_address == NULL && c < argc && argv[c]) { | 201 | if (server_address == NULL && c < argc && argv[c]) { |
| 201 | if (is_host (argv[c]) == FALSE) | 202 | if (is_host (argv[c]) == FALSE) |
| 202 | usage2 (_("Invalid host name/address"), optarg); | 203 | usage2 (_("Invalid hostname/address"), optarg); |
| 203 | server_address = argv[c++]; | 204 | server_address = argv[c++]; |
| 204 | } | 205 | } |
| 205 | 206 | ||
| @@ -214,9 +215,6 @@ process_arguments (int argc, char **argv) | |||
| 214 | 215 | ||
| 215 | 216 | ||
| 216 | 217 | ||
| 217 | |||
| 218 | |||
| 219 | |||
| 220 | void | 218 | void |
| 221 | print_help (void) | 219 | print_help (void) |
| 222 | { | 220 | { |
diff --git a/plugins/check_ups.c b/plugins/check_ups.c index 33cba770..7f88ec30 100644 --- a/plugins/check_ups.c +++ b/plugins/check_ups.c | |||
| @@ -14,6 +14,8 @@ | |||
| 14 | along with this program; if not, write to the Free Software | 14 | along with this program; if not, write to the Free Software |
| 15 | Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | 15 | Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
| 16 | 16 | ||
| 17 | $Id$ | ||
| 18 | |||
| 17 | ******************************************************************************/ | 19 | ******************************************************************************/ |
| 18 | 20 | ||
| 19 | const char *progname = "check_ups"; | 21 | const char *progname = "check_ups"; |
| @@ -90,7 +92,7 @@ main (int argc, char **argv) | |||
| 90 | data = strdup (""); | 92 | data = strdup (""); |
| 91 | 93 | ||
| 92 | if (process_arguments (argc, argv) != OK) | 94 | if (process_arguments (argc, argv) != OK) |
| 93 | usage ("Invalid command arguments supplied\n"); | 95 | usage (_("check_ups: could not parse arguments\n")); |
| 94 | 96 | ||
| 95 | /* initialize alarm signal handling */ | 97 | /* initialize alarm signal handling */ |
| 96 | signal (SIGALRM, socket_timeout_alarm_handler); | 98 | signal (SIGALRM, socket_timeout_alarm_handler); |
| @@ -287,7 +289,7 @@ determine_status (void) | |||
| 287 | 289 | ||
| 288 | if (get_ups_variable ("STATUS", recv_buffer, sizeof (recv_buffer)) != | 290 | if (get_ups_variable ("STATUS", recv_buffer, sizeof (recv_buffer)) != |
| 289 | STATE_OK) { | 291 | STATE_OK) { |
| 290 | printf ("Invalid response received from hostn"); | 292 | printf ("Invalid response received from host\n"); |
| 291 | return ERROR; | 293 | return ERROR; |
| 292 | } | 294 | } |
| 293 | 295 | ||
| @@ -419,8 +421,6 @@ get_ups_variable (const char *varname, char *buf, size_t buflen) | |||
| 419 | 421 | ||
| 420 | 422 | ||
| 421 | 423 | ||
| 422 | |||
| 423 | |||
| 424 | /* Command line: CHECK_UPS <host_address> [-u ups] [-p port] [-v variable] | 424 | /* Command line: CHECK_UPS <host_address> [-u ups] [-p port] [-v variable] |
| 425 | [-wv warn_value] [-cv crit_value] [-to to_sec] */ | 425 | [-wv warn_value] [-cv crit_value] [-to to_sec] */ |
| 426 | 426 | ||
| @@ -466,13 +466,15 @@ process_arguments (int argc, char **argv) | |||
| 466 | 466 | ||
| 467 | switch (c) { | 467 | switch (c) { |
| 468 | case '?': /* help */ | 468 | case '?': /* help */ |
| 469 | usage3 ("Unknown option", optopt); | 469 | printf (_("%s: Unknown argument: %s\n\n"), progname, optarg); |
| 470 | print_usage (); | ||
| 471 | exit (STATE_UNKNOWN); | ||
| 470 | case 'H': /* hostname */ | 472 | case 'H': /* hostname */ |
| 471 | if (is_host (optarg)) { | 473 | if (is_host (optarg)) { |
| 472 | server_address = optarg; | 474 | server_address = optarg; |
| 473 | } | 475 | } |
| 474 | else { | 476 | else { |
| 475 | usage2 (_("Invalid host name"), optarg); | 477 | usage2 (_("Invalid hostname/address"), optarg); |
| 476 | } | 478 | } |
| 477 | break; | 479 | break; |
| 478 | case 'u': /* ups name */ | 480 | case 'u': /* ups name */ |
| @@ -483,7 +485,7 @@ process_arguments (int argc, char **argv) | |||
| 483 | server_port = atoi (optarg); | 485 | server_port = atoi (optarg); |
| 484 | } | 486 | } |
| 485 | else { | 487 | else { |
| 486 | usage2 ("Server port must be a positive integer", optarg); | 488 | usage2 ("Port must be a positive integer", optarg); |
| 487 | } | 489 | } |
| 488 | break; | 490 | break; |
| 489 | case 'c': /* critical time threshold */ | 491 | case 'c': /* critical time threshold */ |
| @@ -492,7 +494,7 @@ process_arguments (int argc, char **argv) | |||
| 492 | check_crit = TRUE; | 494 | check_crit = TRUE; |
| 493 | } | 495 | } |
| 494 | else { | 496 | else { |
| 495 | usage2 ("Critical time must be a nonnegative integer", optarg); | 497 | usage2 ("Critical time must be a positive integer", optarg); |
| 496 | } | 498 | } |
| 497 | break; | 499 | break; |
| 498 | case 'w': /* warning time threshold */ | 500 | case 'w': /* warning time threshold */ |
| @@ -501,7 +503,7 @@ process_arguments (int argc, char **argv) | |||
| 501 | check_warn = TRUE; | 503 | check_warn = TRUE; |
| 502 | } | 504 | } |
| 503 | else { | 505 | else { |
| 504 | usage2 ("Warning time must be a nonnegative integer", optarg); | 506 | usage2 ("Warning time must be a positive integer", optarg); |
| 505 | } | 507 | } |
| 506 | break; | 508 | break; |
| 507 | case 'v': /* variable */ | 509 | case 'v': /* variable */ |
| @@ -521,11 +523,11 @@ process_arguments (int argc, char **argv) | |||
| 521 | socket_timeout = atoi (optarg); | 523 | socket_timeout = atoi (optarg); |
| 522 | } | 524 | } |
| 523 | else { | 525 | else { |
| 524 | usage ("Time interval must be a nonnegative integer\n"); | 526 | usage ("Time interval must be a positive integer\n"); |
| 525 | } | 527 | } |
| 526 | break; | 528 | break; |
| 527 | case 'V': /* version */ | 529 | case 'V': /* version */ |
| 528 | print_revision (progname, "$Revision$"); | 530 | print_revision (progname, revision); |
| 529 | exit (STATE_OK); | 531 | exit (STATE_OK); |
| 530 | case 'h': /* help */ | 532 | case 'h': /* help */ |
| 531 | print_help (); | 533 | print_help (); |
| @@ -538,7 +540,7 @@ process_arguments (int argc, char **argv) | |||
| 538 | if (is_host (argv[optind])) | 540 | if (is_host (argv[optind])) |
| 539 | server_address = argv[optind++]; | 541 | server_address = argv[optind++]; |
| 540 | else | 542 | else |
| 541 | usage2 (_("Invalid host name"), optarg); | 543 | usage2 (_("Invalid hostname/address"), optarg); |
| 542 | } | 544 | } |
| 543 | 545 | ||
| 544 | if (server_address == NULL) | 546 | if (server_address == NULL) |
| @@ -549,8 +551,6 @@ process_arguments (int argc, char **argv) | |||
| 549 | 551 | ||
| 550 | 552 | ||
| 551 | 553 | ||
| 552 | |||
| 553 | |||
| 554 | int | 554 | int |
| 555 | validate_arguments (void) | 555 | validate_arguments (void) |
| 556 | { | 556 | { |
| @@ -559,9 +559,6 @@ validate_arguments (void) | |||
| 559 | 559 | ||
| 560 | 560 | ||
| 561 | 561 | ||
| 562 | |||
| 563 | |||
| 564 | |||
| 565 | void | 562 | void |
| 566 | print_help (void) | 563 | print_help (void) |
| 567 | { | 564 | { |
| @@ -617,7 +614,6 @@ http://www.exploits.org/nut\n\n")); | |||
| 617 | 614 | ||
| 618 | 615 | ||
| 619 | 616 | ||
| 620 | |||
| 621 | void | 617 | void |
| 622 | print_usage (void) | 618 | print_usage (void) |
| 623 | { | 619 | { |
diff --git a/plugins/check_users.c b/plugins/check_users.c index 377a11a6..0417bad1 100644 --- a/plugins/check_users.c +++ b/plugins/check_users.c | |||
| @@ -14,6 +14,8 @@ | |||
| 14 | along with this program; if not, write to the Free Software | 14 | along with this program; if not, write to the Free Software |
| 15 | Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | 15 | Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
| 16 | 16 | ||
| 17 | $Id$ | ||
| 18 | |||
| 17 | *****************************************************************************/ | 19 | *****************************************************************************/ |
| 18 | 20 | ||
| 19 | const char *progname = "check_users"; | 21 | const char *progname = "check_users"; |
| @@ -49,7 +51,7 @@ main (int argc, char **argv) | |||
| 49 | perf = strdup(""); | 51 | perf = strdup(""); |
| 50 | 52 | ||
| 51 | if (process_arguments (argc, argv) == ERROR) | 53 | if (process_arguments (argc, argv) == ERROR) |
| 52 | usage (_("Could not parse arguments\n")); | 54 | usage (_("check_users: could not parse arguments\n")); |
| 53 | 55 | ||
| 54 | /* run the command */ | 56 | /* run the command */ |
| 55 | child_process = spopen (WHO_COMMAND); | 57 | child_process = spopen (WHO_COMMAND); |
| @@ -112,8 +114,6 @@ main (int argc, char **argv) | |||
| 112 | 114 | ||
| 113 | 115 | ||
| 114 | 116 | ||
| 115 | |||
| 116 | |||
| 117 | /* process command-line arguments */ | 117 | /* process command-line arguments */ |
| 118 | int | 118 | int |
| 119 | process_arguments (int argc, char **argv) | 119 | process_arguments (int argc, char **argv) |
| @@ -151,13 +151,13 @@ process_arguments (int argc, char **argv) | |||
| 151 | exit (STATE_OK); | 151 | exit (STATE_OK); |
| 152 | case 'c': /* critical */ | 152 | case 'c': /* critical */ |
| 153 | if (!is_intnonneg (optarg)) | 153 | if (!is_intnonneg (optarg)) |
| 154 | usage (_("Critical threshold must be a nonnegative integer\n")); | 154 | usage (_("Critical threshold must be a positive integer\n")); |
| 155 | else | 155 | else |
| 156 | cusers = atoi (optarg); | 156 | cusers = atoi (optarg); |
| 157 | break; | 157 | break; |
| 158 | case 'w': /* warning */ | 158 | case 'w': /* warning */ |
| 159 | if (!is_intnonneg (optarg)) | 159 | if (!is_intnonneg (optarg)) |
| 160 | usage (_("Warning threshold must be a nonnegative integer\n")); | 160 | usage (_("Warning threshold must be a positive integer\n")); |
| 161 | else | 161 | else |
| 162 | wusers = atoi (optarg); | 162 | wusers = atoi (optarg); |
| 163 | break; | 163 | break; |
| @@ -167,14 +167,14 @@ process_arguments (int argc, char **argv) | |||
| 167 | c = optind; | 167 | c = optind; |
| 168 | if (wusers == -1 && argc > c) { | 168 | if (wusers == -1 && argc > c) { |
| 169 | if (is_intnonneg (argv[c]) == FALSE) | 169 | if (is_intnonneg (argv[c]) == FALSE) |
| 170 | usage (_("Warning threshold must be a nonnegative integer\n")); | 170 | usage (_("Warning threshold must be a positive integer\n")); |
| 171 | else | 171 | else |
| 172 | wusers = atoi (argv[c++]); | 172 | wusers = atoi (argv[c++]); |
| 173 | } | 173 | } |
| 174 | 174 | ||
| 175 | if (cusers == -1 && argc > c) { | 175 | if (cusers == -1 && argc > c) { |
| 176 | if (is_intnonneg (argv[c]) == FALSE) | 176 | if (is_intnonneg (argv[c]) == FALSE) |
| 177 | usage (_("Warning threshold must be a nonnegative integer\n")); | 177 | usage (_("Warning threshold must be a positive integer\n")); |
| 178 | else | 178 | else |
| 179 | cusers = atoi (argv[c]); | 179 | cusers = atoi (argv[c]); |
| 180 | } | 180 | } |
| @@ -184,9 +184,6 @@ process_arguments (int argc, char **argv) | |||
| 184 | 184 | ||
| 185 | 185 | ||
| 186 | 186 | ||
| 187 | |||
| 188 | |||
| 189 | |||
| 190 | void | 187 | void |
| 191 | print_help (void) | 188 | print_help (void) |
| 192 | { | 189 | { |
| @@ -214,7 +211,6 @@ system and generates an error if the number exceeds the thresholds specified.\n" | |||
| 214 | 211 | ||
| 215 | 212 | ||
| 216 | 213 | ||
| 217 | |||
| 218 | void | 214 | void |
| 219 | print_usage (void) | 215 | print_usage (void) |
| 220 | { | 216 | { |
diff --git a/plugins/common.h b/plugins/common.h index fb8ca9c6..e3f150f9 100644 --- a/plugins/common.h +++ b/plugins/common.h | |||
| @@ -28,6 +28,8 @@ | |||
| 28 | * along with this program; if not, write to the Free Software | 28 | * along with this program; if not, write to the Free Software |
| 29 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | 29 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
| 30 | * | 30 | * |
| 31 | * $Id$ | ||
| 32 | * | ||
| 31 | *****************************************************************************/ | 33 | *****************************************************************************/ |
| 32 | 34 | ||
| 33 | #include "config.h" | 35 | #include "config.h" |
diff --git a/plugins/getaddrinfo.c b/plugins/getaddrinfo.c index 12ac67d6..56978208 100644 --- a/plugins/getaddrinfo.c +++ b/plugins/getaddrinfo.c | |||
| @@ -22,6 +22,8 @@ | |||
| 22 | */ | 22 | */ |
| 23 | 23 | ||
| 24 | /* An emulation of the RFC 2553 / Posix getaddrinfo resolver interface. | 24 | /* An emulation of the RFC 2553 / Posix getaddrinfo resolver interface. |
| 25 | * | ||
| 26 | * $Id$ | ||
| 25 | */ | 27 | */ |
| 26 | 28 | ||
| 27 | #ifdef HAVE_CONFIG_H | 29 | #ifdef HAVE_CONFIG_H |
diff --git a/plugins/getaddrinfo.h b/plugins/getaddrinfo.h index 5bcc8844..d4115245 100644 --- a/plugins/getaddrinfo.h +++ b/plugins/getaddrinfo.h | |||
| @@ -23,7 +23,10 @@ | |||
| 23 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | 23 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
| 24 | */ | 24 | */ |
| 25 | 25 | ||
| 26 | /* Structure and prototypes aken from RFC 2553 */ | 26 | /* Structure and prototypes aken from RFC 2553 |
| 27 | * | ||
| 28 | * $Id$ | ||
| 29 | */ | ||
| 27 | 30 | ||
| 28 | struct addrinfo | 31 | struct addrinfo |
| 29 | { | 32 | { |
diff --git a/plugins/gethostbyname.c b/plugins/gethostbyname.c index d151606d..d1b768bc 100644 --- a/plugins/gethostbyname.c +++ b/plugins/gethostbyname.c | |||
| @@ -17,6 +17,8 @@ | |||
| 17 | * You should have received a copy of the GNU Lesser General Public | 17 | * You should have received a copy of the GNU Lesser General Public |
| 18 | * License along with this library; if not, write to the Free Software | 18 | * License along with this library; if not, write to the Free Software |
| 19 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | 19 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
| 20 | * | ||
| 21 | * $Id$ | ||
| 20 | */ | 22 | */ |
| 21 | 23 | ||
| 22 | #ifdef HAVE_CONFIG_H | 24 | #ifdef HAVE_CONFIG_H |
diff --git a/plugins/gethostbyname.h b/plugins/gethostbyname.h index 2b963997..e420837d 100644 --- a/plugins/gethostbyname.h +++ b/plugins/gethostbyname.h | |||
| @@ -17,6 +17,8 @@ | |||
| 17 | * You should have received a copy of the GNU Lesser General Public | 17 | * You should have received a copy of the GNU Lesser General Public |
| 18 | * License along with this library; if not, write to the Free Software | 18 | * License along with this library; if not, write to the Free Software |
| 19 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | 19 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
| 20 | * | ||
| 21 | * $Id$ | ||
| 20 | */ | 22 | */ |
| 21 | 23 | ||
| 22 | /************************************************************************* | 24 | /************************************************************************* |
diff --git a/plugins/negate.c b/plugins/negate.c index a71f1b67..9e5cf46f 100644 --- a/plugins/negate.c +++ b/plugins/negate.c | |||
| @@ -13,6 +13,8 @@ | |||
| 13 | You should have received a copy of the GNU General Public License | 13 | You should have received a copy of the GNU General Public License |
| 14 | along with this program; if not, write to the Free Software | 14 | along with this program; if not, write to the Free Software |
| 15 | Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | 15 | Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
| 16 | |||
| 17 | $Id$ | ||
| 16 | 18 | ||
| 17 | @@-<article> | 19 | @@-<article> |
| 18 | 20 | ||
| @@ -69,6 +71,8 @@ int validate_arguments (void); | |||
| 69 | void print_help (void); | 71 | void print_help (void); |
| 70 | void print_usage (void); | 72 | void print_usage (void); |
| 71 | 73 | ||
| 74 | |||
| 75 | |||
| 72 | int | 76 | int |
| 73 | main (int argc, char **argv) | 77 | main (int argc, char **argv) |
| 74 | { | 78 | { |
| @@ -80,7 +84,7 @@ main (int argc, char **argv) | |||
| 80 | textdomain (PACKAGE); | 84 | textdomain (PACKAGE); |
| 81 | 85 | ||
| 82 | if (process_arguments (argc, argv) == ERROR) | 86 | if (process_arguments (argc, argv) == ERROR) |
| 83 | usage (_("Could not parse arguments\n")); | 87 | usage (_("negate: could not parse arguments\n")); |
| 84 | 88 | ||
| 85 | /* Set signal handling and alarm */ | 89 | /* Set signal handling and alarm */ |
| 86 | if (signal (SIGALRM, timeout_alarm_handler) == SIG_ERR) | 90 | if (signal (SIGALRM, timeout_alarm_handler) == SIG_ERR) |
| @@ -125,8 +129,6 @@ main (int argc, char **argv) | |||
| 125 | else | 129 | else |
| 126 | exit (result); | 130 | exit (result); |
| 127 | } | 131 | } |
| 128 | |||
| 129 | |||
| 130 | 132 | ||
| 131 | /****************************************************************************** | 133 | /****************************************************************************** |
| 132 | @@- | 134 | @@- |
| @@ -146,6 +148,8 @@ is a only a 'timeout' option.</para> | |||
| 146 | -@@ | 148 | -@@ |
| 147 | ******************************************************************************/ | 149 | ******************************************************************************/ |
| 148 | 150 | ||
| 151 | |||
| 152 | |||
| 149 | /* process command-line arguments */ | 153 | /* process command-line arguments */ |
| 150 | int | 154 | int |
| 151 | process_arguments (int argc, char **argv) | 155 | process_arguments (int argc, char **argv) |
| @@ -169,7 +173,9 @@ process_arguments (int argc, char **argv) | |||
| 169 | 173 | ||
| 170 | switch (c) { | 174 | switch (c) { |
| 171 | case '?': /* help */ | 175 | case '?': /* help */ |
| 172 | usage3 (_("Unknown argument"), optopt); | 176 | printf (_("%s: Unknown argument: %s\n\n"), progname, optarg); |
| 177 | print_usage (); | ||
| 178 | exit (STATE_UNKNOWN); | ||
| 173 | break; | 179 | break; |
| 174 | case 'h': /* help */ | 180 | case 'h': /* help */ |
| 175 | print_help (); | 181 | print_help (); |
| @@ -207,6 +213,8 @@ process_arguments (int argc, char **argv) | |||
| 207 | -@@ | 213 | -@@ |
| 208 | ******************************************************************************/ | 214 | ******************************************************************************/ |
| 209 | 215 | ||
| 216 | |||
| 217 | |||
| 210 | int | 218 | int |
| 211 | validate_arguments () | 219 | validate_arguments () |
| 212 | { | 220 | { |
| @@ -225,9 +233,6 @@ validate_arguments () | |||
| 225 | 233 | ||
| 226 | 234 | ||
| 227 | 235 | ||
| 228 | |||
| 229 | |||
| 230 | |||
| 231 | void | 236 | void |
| 232 | print_help (void) | 237 | print_help (void) |
| 233 | { | 238 | { |
| @@ -265,8 +270,6 @@ Otherwise, the output state of the wrapped plugin is unchanged.\n")); | |||
| 265 | 270 | ||
| 266 | 271 | ||
| 267 | 272 | ||
| 268 | |||
| 269 | |||
| 270 | void | 273 | void |
| 271 | print_usage (void) | 274 | print_usage (void) |
| 272 | { | 275 | { |
diff --git a/plugins/netutils.c b/plugins/netutils.c index aee53d35..6702b13f 100644 --- a/plugins/netutils.c +++ b/plugins/netutils.c | |||
| @@ -27,6 +27,8 @@ | |||
| 27 | * along with this program; if not, write to the Free Software | 27 | * along with this program; if not, write to the Free Software |
| 28 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | 28 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
| 29 | * | 29 | * |
| 30 | * $Id$ | ||
| 31 | * | ||
| 30 | ****************************************************************************/ | 32 | ****************************************************************************/ |
| 31 | 33 | ||
| 32 | #include "common.h" | 34 | #include "common.h" |
| @@ -104,7 +106,7 @@ process_tcp_request2 (const char *server_address, int server_port, | |||
| 104 | 106 | ||
| 105 | send_result = send (sd, send_buffer, strlen (send_buffer), 0); | 107 | send_result = send (sd, send_buffer, strlen (send_buffer), 0); |
| 106 | if (send_result<0 || (size_t)send_result!=strlen(send_buffer)) { | 108 | if (send_result<0 || (size_t)send_result!=strlen(send_buffer)) { |
| 107 | printf ("send() failed\n"); | 109 | printf ("Send failed\n"); |
| 108 | result = STATE_WARNING; | 110 | result = STATE_WARNING; |
| 109 | } | 111 | } |
| 110 | 112 | ||
| @@ -313,7 +315,7 @@ send_request (int sd, int proto, const char *send_buffer, char *recv_buffer, int | |||
| 313 | 315 | ||
| 314 | send_result = send (sd, send_buffer, strlen (send_buffer), 0); | 316 | send_result = send (sd, send_buffer, strlen (send_buffer), 0); |
| 315 | if (send_result<0 || (size_t)send_result!=strlen(send_buffer)) { | 317 | if (send_result<0 || (size_t)send_result!=strlen(send_buffer)) { |
| 316 | printf ("send() failed\n"); | 318 | printf ("Send failed\n"); |
| 317 | result = STATE_WARNING; | 319 | result = STATE_WARNING; |
| 318 | } | 320 | } |
| 319 | 321 | ||
| @@ -337,7 +339,7 @@ send_request (int sd, int proto, const char *send_buffer, char *recv_buffer, int | |||
| 337 | if (recv_result == -1) { | 339 | if (recv_result == -1) { |
| 338 | strcpy (recv_buffer, ""); | 340 | strcpy (recv_buffer, ""); |
| 339 | if (proto != IPPROTO_TCP) | 341 | if (proto != IPPROTO_TCP) |
| 340 | printf ("recv() failed\n"); | 342 | printf ("Receive failed\n"); |
| 341 | result = STATE_WARNING; | 343 | result = STATE_WARNING; |
| 342 | } | 344 | } |
| 343 | else | 345 | else |
diff --git a/plugins/netutils.h b/plugins/netutils.h index b2c2a2f5..2f31bdc8 100644 --- a/plugins/netutils.h +++ b/plugins/netutils.h | |||
| @@ -28,6 +28,8 @@ | |||
| 28 | * along with this program; if not, write to the Free Software | 28 | * along with this program; if not, write to the Free Software |
| 29 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | 29 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
| 30 | * | 30 | * |
| 31 | * $Id$ | ||
| 32 | * | ||
| 31 | ******************************************************************************/ | 33 | ******************************************************************************/ |
| 32 | 34 | ||
| 33 | #include "config.h" | 35 | #include "config.h" |
diff --git a/plugins/popen.c b/plugins/popen.c index 05fd0ab9..d527c222 100644 --- a/plugins/popen.c +++ b/plugins/popen.c | |||
| @@ -16,6 +16,8 @@ int spclose(FILE *); | |||
| 16 | * path passed to the exec'd program are esstially empty. (popen create a shell | 16 | * path passed to the exec'd program are esstially empty. (popen create a shell |
| 17 | * and passes the environment to it). | 17 | * and passes the environment to it). |
| 18 | * | 18 | * |
| 19 | * $Id$ | ||
| 20 | * | ||
| 19 | ******************************************************************************/ | 21 | ******************************************************************************/ |
| 20 | 22 | ||
| 21 | #include "common.h" | 23 | #include "common.h" |
diff --git a/plugins/urlize.c b/plugins/urlize.c index d3d97b5a..9973c1a3 100644 --- a/plugins/urlize.c +++ b/plugins/urlize.c | |||
| @@ -14,6 +14,8 @@ | |||
| 14 | along with this program; if not, write to the Free Software | 14 | along with this program; if not, write to the Free Software |
| 15 | Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | 15 | Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
| 16 | 16 | ||
| 17 | $Id$ | ||
| 18 | |||
| 17 | ******************************************************************************/ | 19 | ******************************************************************************/ |
| 18 | 20 | ||
| 19 | const char *progname = "urlize"; | 21 | const char *progname = "urlize"; |
| @@ -69,8 +71,9 @@ main (int argc, char **argv) | |||
| 69 | break; | 71 | break; |
| 70 | case '?': | 72 | case '?': |
| 71 | default: | 73 | default: |
| 72 | usage3 (_("Unknown argument"), optopt); | 74 | printf (_("%s: Unknown argument: %s\n\n"), progname, optarg); |
| 73 | break; | 75 | print_usage (); |
| 76 | exit (STATE_UNKNOWN); | ||
| 74 | } | 77 | } |
| 75 | } | 78 | } |
| 76 | 79 | ||
| @@ -121,9 +124,6 @@ main (int argc, char **argv) | |||
| 121 | 124 | ||
| 122 | 125 | ||
| 123 | 126 | ||
| 124 | |||
| 125 | |||
| 126 | |||
| 127 | void | 127 | void |
| 128 | print_help (void) | 128 | print_help (void) |
| 129 | { | 129 | { |
| @@ -159,7 +159,6 @@ You probably want:\n\ | |||
| 159 | 159 | ||
| 160 | 160 | ||
| 161 | 161 | ||
| 162 | |||
| 163 | void | 162 | void |
| 164 | print_usage (void) | 163 | print_usage (void) |
| 165 | { | 164 | { |
diff --git a/plugins/utils.c b/plugins/utils.c index bb380301..460ff824 100644 --- a/plugins/utils.c +++ b/plugins/utils.c | |||
| @@ -315,9 +315,6 @@ strip (char *buffer) | |||
| 315 | } | 315 | } |
| 316 | 316 | ||
| 317 | 317 | ||
| 318 | |||
| 319 | |||
| 320 | |||
| 321 | /****************************************************************************** | 318 | /****************************************************************************** |
| 322 | * | 319 | * |
| 323 | * Copies one string to another. Any previously existing data in | 320 | * Copies one string to another. Any previously existing data in |
| @@ -343,8 +340,6 @@ strscpy (char *dest, const char *src) | |||
| 343 | 340 | ||
| 344 | 341 | ||
| 345 | 342 | ||
| 346 | |||
| 347 | |||
| 348 | /****************************************************************************** | 343 | /****************************************************************************** |
| 349 | * | 344 | * |
| 350 | * Returns a pointer to the next line of a multiline string buffer | 345 | * Returns a pointer to the next line of a multiline string buffer |
| @@ -414,9 +409,6 @@ strnl (char *str) | |||
| 414 | } | 409 | } |
| 415 | 410 | ||
| 416 | 411 | ||
| 417 | |||
| 418 | |||
| 419 | |||
| 420 | /****************************************************************************** | 412 | /****************************************************************************** |
| 421 | * | 413 | * |
| 422 | * Like strscpy, except only the portion of the source string up to | 414 | * Like strscpy, except only the portion of the source string up to |
| @@ -456,8 +448,6 @@ strpcpy (char *dest, const char *src, const char *str) | |||
| 456 | 448 | ||
| 457 | 449 | ||
| 458 | 450 | ||
| 459 | |||
| 460 | |||
| 461 | /****************************************************************************** | 451 | /****************************************************************************** |
| 462 | * | 452 | * |
| 463 | * Like strscat, except only the portion of the source string up to | 453 | * Like strscat, except only the portion of the source string up to |
| @@ -499,8 +489,6 @@ strpcat (char *dest, const char *src, const char *str) | |||
| 499 | } | 489 | } |
| 500 | 490 | ||
| 501 | 491 | ||
| 502 | |||
| 503 | |||
| 504 | /****************************************************************************** | 492 | /****************************************************************************** |
| 505 | * | 493 | * |
| 506 | * Print perfdata in a standard format | 494 | * Print perfdata in a standard format |
diff --git a/plugins/utils.h b/plugins/utils.h index 35e62ab4..a3ddc0a2 100644 --- a/plugins/utils.h +++ b/plugins/utils.h | |||
| @@ -13,6 +13,8 @@ suite of plugins. */ | |||
| 13 | 13 | ||
| 14 | /* Standardize version information, termination */ | 14 | /* Standardize version information, termination */ |
| 15 | 15 | ||
| 16 | /* $Id$ */ | ||
| 17 | |||
| 16 | void support (void); | 18 | void support (void); |
| 17 | char *clean_revstring (const char *revstring); | 19 | char *clean_revstring (const char *revstring); |
| 18 | void print_revision (const char *, const char *); | 20 | void print_revision (const char *, const char *); |
