summaryrefslogtreecommitdiffstats
path: root/plugins
diff options
context:
space:
mode:
Diffstat (limited to 'plugins')
-rw-r--r--plugins/check_load.c1
-rw-r--r--plugins/check_pgsql.c13
-rw-r--r--plugins/check_ping.c20
-rw-r--r--plugins/check_procs.c136
-rw-r--r--plugins/check_radius.c2
-rw-r--r--plugins/check_real.c3
-rw-r--r--plugins/check_smtp.c2
-rw-r--r--plugins/check_snmp.c7
-rw-r--r--plugins/check_ssh.c6
-rw-r--r--plugins/check_swap.c9
-rw-r--r--plugins/check_tcp.c8
-rw-r--r--plugins/check_time.c5
-rw-r--r--plugins/check_udp.c9
-rw-r--r--plugins/check_ups.c6
-rw-r--r--plugins/check_users.c3
-rw-r--r--plugins/urlize.c4
16 files changed, 118 insertions, 116 deletions
diff --git a/plugins/check_load.c b/plugins/check_load.c
index 00bfc8a..6d87237 100644
--- a/plugins/check_load.c
+++ b/plugins/check_load.c
@@ -321,5 +321,6 @@ print_usage (void)
321{ 321{
322 printf ("Usage: %s -w WLOAD1,WLOAD5,WLOAD15 -c CLOAD1,CLOAD5,CLOAD15\n"), 322 printf ("Usage: %s -w WLOAD1,WLOAD5,WLOAD15 -c CLOAD1,CLOAD5,CLOAD15\n"),
323 progname); 323 progname);
324
324 printf (UT_HLP_VRS, progname, progname); 325 printf (UT_HLP_VRS, progname, progname);
325} 326}
diff --git a/plugins/check_pgsql.c b/plugins/check_pgsql.c
index 826a105..f97ef66 100644
--- a/plugins/check_pgsql.c
+++ b/plugins/check_pgsql.c
@@ -441,12 +441,9 @@ a password, but no effort is made to obsure or encrypt the password.\n"));
441void 441void
442print_usage (void) 442print_usage (void)
443{ 443{
444 printf (S_("\ 444 printf ("\
445Usage:\n %s [-H <host>] [-P <port>] [-c <critical time>] [-w <warning time>]\n\ 445Usage: %s [-H <host>] [-P <port>] [-c <critical time>] [-w <warning time>]\n\
446 [-t <timeout>]"), progname); 446 [-t <timeout>] [-d <database>] [-l <logname>] [-p <password>]\n", progname);
447 printf (S_("[-d <database>] [-l <logname>] [-p <password>]\n")); 447
448 printf (S_("\ 448 printf (UT_HLP_VRS, progname, progname);
449 %s (-h | --help) for detailed help\n\
450 %s (-V | --version) for version information\n"),
451 progname, progname);
452} 449}
diff --git a/plugins/check_ping.c b/plugins/check_ping.c
index 132453d..c04fb02 100644
--- a/plugins/check_ping.c
+++ b/plugins/check_ping.c
@@ -485,17 +485,6 @@ error_scan (char buf[MAX_INPUT_BUFFER], const char *addr)
485 485
486 486
487void 487void
488print_usage (void)
489{
490 printf (\
491"Usage: %s -H <host_address> -w <wrta>,<wpl>%% -c <crta>,<cpl>%%\n\
492 [-p packets] [-t timeout] [-L] [-4|-6]\n", progname);
493 printf (_(UT_HLP_VRS), progname, progname);
494}
495
496
497
498void
499print_help (void) 488print_help (void)
500{ 489{
501 print_revision (progname, revision); 490 print_revision (progname, revision);
@@ -539,3 +528,12 @@ the contrib area of the downloads section at http://www.nagios.org\n\n"));
539 528
540 printf (_(UT_SUPPORT)); 529 printf (_(UT_SUPPORT));
541} 530}
531
532void
533print_usage (void)
534{
535 printf ("Usage: %s -H <host_address> -w <wrta>,<wpl>%% -c <crta>,<cpl>%%\n\
536 [-p packets] [-t timeout] [-L] [-4|-6]\n", progname);
537
538 printf (UT_HLP_VRS, progname, progname);
539}
diff --git a/plugins/check_procs.c b/plugins/check_procs.c
index a8a7d5e..ee168db 100644
--- a/plugins/check_procs.c
+++ b/plugins/check_procs.c
@@ -589,6 +589,71 @@ check_thresholds (int value)
589 589
590 590
591 591
592
593/* convert the elapsed time to seconds */
594int
595convert_to_seconds(char *etime) {
596
597 char *ptr;
598 int total;
599
600 int hyphcnt;
601 int coloncnt;
602 int days;
603 int hours;
604 int minutes;
605 int seconds;
606
607 hyphcnt = 0;
608 coloncnt = 0;
609 days = 0;
610 hours = 0;
611 minutes = 0;
612 seconds = 0;
613
614 for (ptr = etime; *ptr != '\0'; ptr++) {
615
616 if (*ptr == '-') {
617 hyphcnt++;
618 continue;
619 }
620 if (*ptr == ':') {
621 coloncnt++;
622 continue;
623 }
624 }
625
626 if (hyphcnt > 0) {
627 sscanf(etime, "%d-%d:%d:%d",
628 &days, &hours, &minutes, &seconds);
629 /* linux 2.6.5/2.6.6 reporting some processes with infinite
630 * elapsed times for some reason */
631 if (days == 49710) {
632 return 0;
633 }
634 } else {
635 if (coloncnt == 2) {
636 sscanf(etime, "%d:%d:%d",
637 &hours, &minutes, &seconds);
638 } else if (coloncnt == 1) {
639 sscanf(etime, "%d:%d",
640 &minutes, &seconds);
641 }
642 }
643
644 total = (days * 86400) +
645 (hours * 3600) +
646 (minutes * 60) +
647 seconds;
648
649 if (verbose >= 3) {
650 printf("seconds: %d\n", total);
651 }
652 return total;
653}
654
655
656
592void 657void
593print_help (void) 658print_help (void)
594{ 659{
@@ -681,78 +746,13 @@ Examples:\n\
681 printf (_(UT_SUPPORT)); 746 printf (_(UT_SUPPORT));
682} 747}
683 748
684
685
686/* convert the elapsed time to seconds */
687int
688convert_to_seconds(char *etime) {
689
690 char *ptr;
691 int total;
692
693 int hyphcnt;
694 int coloncnt;
695 int days;
696 int hours;
697 int minutes;
698 int seconds;
699
700 hyphcnt = 0;
701 coloncnt = 0;
702 days = 0;
703 hours = 0;
704 minutes = 0;
705 seconds = 0;
706
707 for (ptr = etime; *ptr != '\0'; ptr++) {
708
709 if (*ptr == '-') {
710 hyphcnt++;
711 continue;
712 }
713 if (*ptr == ':') {
714 coloncnt++;
715 continue;
716 }
717 }
718
719 if (hyphcnt > 0) {
720 sscanf(etime, "%d-%d:%d:%d",
721 &days, &hours, &minutes, &seconds);
722 /* linux 2.6.5/2.6.6 reporting some processes with infinite
723 * elapsed times for some reason */
724 if (days == 49710) {
725 return 0;
726 }
727 } else {
728 if (coloncnt == 2) {
729 sscanf(etime, "%d:%d:%d",
730 &hours, &minutes, &seconds);
731 } else if (coloncnt == 1) {
732 sscanf(etime, "%d:%d",
733 &minutes, &seconds);
734 }
735 }
736
737 total = (days * 86400) +
738 (hours * 3600) +
739 (minutes * 60) +
740 seconds;
741
742 if (verbose >= 3) {
743 printf("seconds: %d\n", total);
744 }
745 return total;
746}
747
748void 749void
749print_usage (void) 750print_usage (void)
750{ 751{
751 printf ("\ 752 printf ("\
752Usage: %s -w <range> -c <range> [-m metric] [-s state] [-p ppid]\n\ 753Usage: %s -w <range> -c <range> [-m metric] [-s state] [-p ppid]\n\
753 [-u user] [-r rss] [-z vsz] [-P %%cpu] [-a argument-array]\n\ 754 [-u user] [-r rss] [-z vsz] [-P %%cpu] [-a argument-array]\n\
754 [-C command] [-t timeout] [-v]\n", progname); 755 [-C command] [-t timeout] [-v]\n", progname);
755 printf (_(UT_HLP_VRS), progname, progname); 756
757 printf (UT_HLP_VRS, progname, progname);
756} 758}
757
758
diff --git a/plugins/check_radius.c b/plugins/check_radius.c
index 57a3e40..5474614 100644
--- a/plugins/check_radius.c
+++ b/plugins/check_radius.c
@@ -336,5 +336,5 @@ print_usage (void)
336 printf ("\ 336 printf ("\
337Usage: %s -H host -F config_file -u username -p password [-n nas-id] [-P port]\n\ 337Usage: %s -H host -F config_file -u username -p password [-n nas-id] [-P port]\n\
338 [-t timeout] [-r retries] [-e expect]\n", progname); 338 [-t timeout] [-r retries] [-e expect]\n", progname);
339 printf (_(UT_HLP_VRS), progname, progname); 339 printf (UT_HLP_VRS, progname, progname);
340} 340}
diff --git a/plugins/check_real.c b/plugins/check_real.c
index 8a12a3e..8df68d9 100644
--- a/plugins/check_real.c
+++ b/plugins/check_real.c
@@ -439,5 +439,6 @@ print_usage (void)
439 printf ("\ 439 printf ("\
440Usage: %s -H host [-e expect] [-p port] [-w warn] [-c crit]\n\ 440Usage: %s -H host [-e expect] [-p port] [-w warn] [-c crit]\n\
441 [-t timeout] [-v]\n", progname); 441 [-t timeout] [-v]\n", progname);
442 printf (_(UT_HLP_VRS), progname, progname); 442
443 printf (UT_HLP_VRS, progname, progname);
443} 444}
diff --git a/plugins/check_smtp.c b/plugins/check_smtp.c
index c0ddc70..748edfc 100644
--- a/plugins/check_smtp.c
+++ b/plugins/check_smtp.c
@@ -469,5 +469,5 @@ print_usage (void)
469 printf ("\ 469 printf ("\
470Usage: %s -H host [-p port] [-e expect] [-C command] [-f from addr]\n\ 470Usage: %s -H host [-p port] [-e expect] [-C command] [-f from addr]\n\
471 [-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);
472 printf (_(UT_HLP_VRS), progname, progname); 472 printf (UT_HLP_VRS, progname, progname);
473} 473}
diff --git a/plugins/check_snmp.c b/plugins/check_snmp.c
index 2e9ea63..ca6d7a3 100644
--- a/plugins/check_snmp.c
+++ b/plugins/check_snmp.c
@@ -948,12 +948,13 @@ Check status of remote machines and obtain sustem information via SNMP\n\n"));
948void 948void
949print_usage (void) 949print_usage (void)
950{ 950{
951 printf (_("\ 951 printf ("\
952Usage: %s -H <ip_address> -o <OID> [-w warn_range] [-c crit_range] \n\ 952Usage: %s -H <ip_address> -o <OID> [-w warn_range] [-c crit_range] \n\
953 [-C community] [-s string] [-r regex] [-R regexi] [-t timeout]\n\ 953 [-C community] [-s string] [-r regex] [-R regexi] [-t timeout]\n\
954 [-l label] [-u units] [-p port-number] [-d delimiter]\n\ 954 [-l label] [-u units] [-p port-number] [-d delimiter]\n\
955 [-D output-delimiter] [-m miblist] [-P snmp version]\n\ 955 [-D output-delimiter] [-m miblist] [-P snmp version]\n\
956 [-L seclevel] [-U secname] [-a authproto] [-A authpasswd]\n\ 956 [-L seclevel] [-U secname] [-a authproto] [-A authpasswd]\n\
957 [-X privpasswd]\n"), progname); 957 [-X privpasswd]\n", progname);
958 printf (_(UT_HLP_VRS), progname, progname); 958
959 printf (UT_HLP_VRS, progname, progname);
959} 960}
diff --git a/plugins/check_ssh.c b/plugins/check_ssh.c
index a21d64a..a21e2f5 100644
--- a/plugins/check_ssh.c
+++ b/plugins/check_ssh.c
@@ -287,9 +287,9 @@ print_help (void)
287void 287void
288print_usage (void) 288print_usage (void)
289{ 289{
290 printf (_("\ 290 printf ("\
291Usage: %s [-46] [-t <timeout>] [-r <remote version>] [-p <port>] <host>\n"), progname); 291Usage: %s [-46] [-t <timeout>] [-r <remote version>] [-p <port>] <host>\n"), progname);
292 printf (_(UT_HLP_VRS), progname, progname); 292
293 printf (UT_HLP_VRS, progname, progname);
293} 294}
294 295
295/* end of check_ssh.c */
diff --git a/plugins/check_swap.c b/plugins/check_swap.c
index 6857a01..6a448e1 100644
--- a/plugins/check_swap.c
+++ b/plugins/check_swap.c
@@ -514,10 +514,9 @@ On AIX, if -a is specified, uses lsps -a, otherwise uses lsps -s.\n"));
514void 514void
515print_usage (void) 515print_usage (void)
516{ 516{
517 printf (_("Usage:\n\ 517 printf ("Usage:\n\
518 %s [-av] -w <percent_free>%% -c <percent_free>%%\n\ 518 %s [-av] -w <percent_free>%% -c <percent_free>%%\n\
519 %s [-av] -w <bytes_free> -c <bytes_free>\n\ 519 %s [-av] -w <bytes_free> -c <bytes_free>\n", progname, progname);
520 %s (-h | --help) for detailed help\n\ 520
521 %s (-V | --version) for version information\n"), 521 printf (UT_HLP_VRS, progname, progname);
522 progname, progname, progname, progname);
523} 522}
diff --git a/plugins/check_tcp.c b/plugins/check_tcp.c
index 0573776..405a762 100644
--- a/plugins/check_tcp.c
+++ b/plugins/check_tcp.c
@@ -793,12 +793,12 @@ print_help (void)
793void 793void
794print_usage (void) 794print_usage (void)
795{ 795{
796 printf (_("\ 796 printf ("\
797Usage: %s -H host -p port [-w <warning time>] [-c <critical time>]\n\ 797Usage: %s -H host -p port [-w <warning time>] [-c <critical time>]\n\
798 [-s <send string>] [-e <expect string>] [-q <quit string>]\n\ 798 [-s <send string>] [-e <expect string>] [-q <quit string>]\n\
799 [-m <maximum bytes>] [-d <delay>] [-t <timeout seconds>]\n\ 799 [-m <maximum bytes>] [-d <delay>] [-t <timeout seconds>]\n\
800 [-r <refuse state>] [-v] [-4|-6] [-j] [-D <days to cert expiry>]\n\ 800 [-r <refuse state>] [-v] [-4|-6] [-j] [-D <days to cert expiry>]\n\
801 [-S <use SSL>]\n"), progname); 801 [-S <use SSL>]\n", progname);
802 printf (" %s (-h|--help)\n", progname); 802
803 printf (" %s (-V|--version)\n", progname); 803 printf (UT_HLP_VRS, progname, progname);
804} 804}
diff --git a/plugins/check_time.c b/plugins/check_time.c
index 8381fb2..94c33b6 100644
--- a/plugins/check_time.c
+++ b/plugins/check_time.c
@@ -357,8 +357,9 @@ This plugin will check the time on the specified host.\n\n"));
357void 357void
358print_usage (void) 358print_usage (void)
359{ 359{
360 printf (_("\ 360 printf ("\
361Usage: %s -H <host_address> [-p port] [-u] [-w variance] [-c variance]\n\ 361Usage: %s -H <host_address> [-p port] [-u] [-w variance] [-c variance]\n\
362 [-W connect_time] [-C connect_time] [-t timeout]\n"), progname); 362 [-W connect_time] [-C connect_time] [-t timeout]\n", progname);
363
363 printf (_(UT_HLP_VRS), progname, progname); 364 printf (_(UT_HLP_VRS), progname, progname);
364} 365}
diff --git a/plugins/check_udp.c b/plugins/check_udp.c
index 5adf23c..6551ed4 100644
--- a/plugins/check_udp.c
+++ b/plugins/check_udp.c
@@ -225,7 +225,7 @@ print_help (void)
225 printf (COPYRIGHT, copyright, email); 225 printf (COPYRIGHT, copyright, email);
226 226
227 printf (_("\ 227 printf (_("\
228This plugin tests an UDP connection with the specified host.\n\n")); 228 This plugin tests an UDP connection with the specified host.\n\n"));
229 229
230 print_usage (); 230 print_usage ();
231 231
@@ -262,8 +262,9 @@ STATE_CRITICAL, other errors return STATE_UNKNOWN.\n\n"));
262void 262void
263print_usage (void) 263print_usage (void)
264{ 264{
265 printf (_("\ 265 printf ("\
266Usage: %s -H <host_address> [-p port] [-w warn_time] [-c crit_time]\n\ 266Usage: %s -H <host_address> [-p port] [-w warn_time] [-c crit_time]\n\
267 [-e expect] [-s send] [-t to_sec] [-v]\n"), progname); 267 [-e expect] [-s send] [-t to_sec] [-v]\n", progname);
268 printf (_(UT_HLP_VRS), progname, progname); 268
269 printf (UT_HLP_VRS, progname, progname);
269} 270}
diff --git a/plugins/check_ups.c b/plugins/check_ups.c
index 3e538bc..ee373cb 100644
--- a/plugins/check_ups.c
+++ b/plugins/check_ups.c
@@ -647,8 +647,8 @@ http://www.networkupstools.org\n\n"));
647void 647void
648print_usage (void) 648print_usage (void)
649{ 649{
650 printf (_("\ 650 printf ("\
651Usage: %s -H host -u ups [-p port] [-v variable]\n\ 651Usage: %s -H host -u ups [-p port] [-v variable]\n\
652 [-wv warn_value] [-cv crit_value] [-to to_sec] [-T]\n"), progname); 652 [-wv warn_value] [-cv crit_value] [-to to_sec] [-T]\n", progname);
653 printf (_(UT_HLP_VRS), progname, progname); 653 printf (UT_HLP_VRS, progname, progname);
654} 654}
diff --git a/plugins/check_users.c b/plugins/check_users.c
index d089322..05ef86f 100644
--- a/plugins/check_users.c
+++ b/plugins/check_users.c
@@ -215,5 +215,6 @@ void
215print_usage (void) 215print_usage (void)
216{ 216{
217 printf ("Usage: %s -w <users> -c <users>\n", progname); 217 printf ("Usage: %s -w <users> -c <users>\n", progname);
218 printf (_(UT_HLP_VRS), progname, progname); 218
219 printf (UT_HLP_VRS, progname, progname);
219} 220}
diff --git a/plugins/urlize.c b/plugins/urlize.c
index 65a7b3d..e1d02ef 100644
--- a/plugins/urlize.c
+++ b/plugins/urlize.c
@@ -162,5 +162,7 @@ You probably want:\n\
162void 162void
163print_usage (void) 163print_usage (void)
164{ 164{
165 printf (_("Usage:\n %s <url> <plugin> <arg1> ... <argN>\n"), progname); 165 printf ("Usage:\n %s <url> <plugin> <arg1> ... <argN>\n", progname);
166
167 printf (UT_HLP_VRS, progname, progname);
166} 168}