summaryrefslogtreecommitdiffstats
path: root/plugins/check_procs.c
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/check_procs.c')
-rw-r--r--plugins/check_procs.c36
1 files changed, 9 insertions, 27 deletions
diff --git a/plugins/check_procs.c b/plugins/check_procs.c
index d4792107..64e62dde 100644
--- a/plugins/check_procs.c
+++ b/plugins/check_procs.c
@@ -260,7 +260,7 @@ main (int argc, char **argv)
260 printf (_("%d crit, %d warn out of "), crit, warn); 260 printf (_("%d crit, %d warn out of "), crit, warn);
261 } 261 }
262 } 262 }
263 printf (ngettext ("%d process", "%d processes", procs), procs); 263 printf (ngettext ("%d process", "%d processes", (unsigned long) procs), procs);
264 264
265 if (strcmp(fmt,"") != 0) { 265 if (strcmp(fmt,"") != 0) {
266 printf (_(" with %s"), fmt); 266 printf (_(" with %s"), fmt);
@@ -361,10 +361,7 @@ process_arguments (int argc, char **argv)
361 options |= PPID; 361 options |= PPID;
362 break; 362 break;
363 } 363 }
364 printf (_("%s: Parent Process ID must be an integer!\n\n"), 364 usage2 (_("%s: Parent Process ID must be an integer!\n\n"), progname);
365 progname);
366 print_usage ();
367 exit (STATE_UNKNOWN);
368 case 's': /* status */ 365 case 's': /* status */
369 if (statopts) 366 if (statopts)
370 break; 367 break;
@@ -378,20 +375,14 @@ process_arguments (int argc, char **argv)
378 uid = atoi (optarg); 375 uid = atoi (optarg);
379 pw = getpwuid ((uid_t) uid); 376 pw = getpwuid ((uid_t) uid);
380 /* check to be sure user exists */ 377 /* check to be sure user exists */
381 if (pw == NULL) { 378 if (pw == NULL)
382 printf (_("UID %d was not found\n"), uid); 379 usage2 (_("UID %d was not found\n"), uid);
383 print_usage ();
384 exit (STATE_UNKNOWN);
385 }
386 } 380 }
387 else { 381 else {
388 pw = getpwnam (optarg); 382 pw = getpwnam (optarg);
389 /* check to be sure user exists */ 383 /* check to be sure user exists */
390 if (pw == NULL) { 384 if (pw == NULL)
391 printf (_("User name %s was not found\n"), optarg); 385 usage2 (_("User name %s was not found\n"), optarg);
392 print_usage ();
393 exit (STATE_UNKNOWN);
394 }
395 /* then get uid */ 386 /* then get uid */
396 uid = pw->pw_uid; 387 uid = pw->pw_uid;
397 } 388 }
@@ -423,20 +414,14 @@ process_arguments (int argc, char **argv)
423 options |= RSS; 414 options |= RSS;
424 break; 415 break;
425 } 416 }
426 printf (_("%s: RSS must be an integer!\n\n"), 417 usage2 (_("%s: RSS must be an integer!\n\n"), progname);
427 progname);
428 print_usage ();
429 exit (STATE_UNKNOWN);
430 case 'z': /* VSZ */ 418 case 'z': /* VSZ */
431 if (sscanf (optarg, "%d%[^0-9]", &vsz, tmp) == 1) { 419 if (sscanf (optarg, "%d%[^0-9]", &vsz, tmp) == 1) {
432 asprintf (&fmt, _("%s%sVSZ >= %d"), (fmt ? fmt : ""), (options ? ", " : ""), vsz); 420 asprintf (&fmt, _("%s%sVSZ >= %d"), (fmt ? fmt : ""), (options ? ", " : ""), vsz);
433 options |= VSZ; 421 options |= VSZ;
434 break; 422 break;
435 } 423 }
436 printf (_("%s: VSZ must be an integer!\n\n"), 424 usage2 (_("%s: VSZ must be an integer!\n\n"), progname);
437 progname);
438 print_usage ();
439 exit (STATE_UNKNOWN);
440 case 'P': /* PCPU */ 425 case 'P': /* PCPU */
441 /* TODO: -P 1.5.5 is accepted */ 426 /* TODO: -P 1.5.5 is accepted */
442 if (sscanf (optarg, "%f%[^0-9.]", &pcpu, tmp) == 1) { 427 if (sscanf (optarg, "%f%[^0-9.]", &pcpu, tmp) == 1) {
@@ -444,10 +429,7 @@ process_arguments (int argc, char **argv)
444 options |= PCPU; 429 options |= PCPU;
445 break; 430 break;
446 } 431 }
447 printf (_("%s: PCPU must be a float!\n\n"), 432 usage2 (_("%s: PCPU must be a float!\n\n"), progname);
448 progname);
449 print_usage ();
450 exit (STATE_UNKNOWN);
451 case 'm': 433 case 'm':
452 asprintf (&metric_name, "%s", optarg); 434 asprintf (&metric_name, "%s", optarg);
453 if ( strcmp(optarg, "PROCS") == 0) { 435 if ( strcmp(optarg, "PROCS") == 0) {