Code

check_host: Allocate a large-enough buffer for the host table.
[nagiosplug.git] / plugins / check_cluster.c
index ac3eeceb0eebce9b891af4e8ae218aaaee7e8971..d4e39e0f37db71a84d392743de179c4e697eef90 100644 (file)
@@ -6,9 +6,6 @@
 * Copyright (c) 2000-2004 Ethan Galstad (nagios@nagios.org)
 * Copyright (c) 2007 Nagios Plugins Development Team
 * 
-* Last Modified: $Date$
-* 
-* 
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 * 
-* $Id$
 * 
 *****************************************************************************/
 
 const char *progname = "check_cluster";
-const char *revision = "$Revision$";
 const char *copyright = "2000-2007";
 const char *email = "nagiosplug-devel@lists.sourceforge.net";
 
@@ -74,6 +69,9 @@ int main(int argc, char **argv){
        bindtextdomain (PACKAGE, LOCALEDIR);
        textdomain (PACKAGE);
 
+       /* Parse extra opts if any */
+       argv=np_extra_opts(&argc, argv, progname);
+
        if(process_arguments(argc,argv)==ERROR)
                usage(_("Could not parse arguments"));
 
@@ -121,7 +119,7 @@ int main(int argc, char **argv){
                        }
                }
         }
-       
+
 
        /* return the status of the cluster */
        if(check_type==CHECK_SERVICES){
@@ -146,7 +144,7 @@ int main(int argc, char **argv){
 int process_arguments(int argc, char **argv){
        int c;
        int option=0;
-       static struct option longopts[]={ 
+       static struct option longopts[]={
                {"data",     required_argument,0,'d'},
                {"warning",  required_argument,0,'w'},
                {"critical", required_argument,0,'c'},
@@ -201,7 +199,7 @@ int process_arguments(int argc, char **argv){
                        break;
 
                case 'V': /* version */
-                       print_revision (progname, revision);
+                       print_revision (progname, NP_VERSION);
                        exit (STATE_OK);
                        break;
 
@@ -225,7 +223,7 @@ int process_arguments(int argc, char **argv){
 void
 print_help(void)
 {
-       print_revision(progname, revision);
+       print_revision(progname, NP_VERSION);
        printf ("Copyright (c) 2000-2004 Ethan Galstad (nagios@nagios.org)\n");
        printf(COPYRIGHT, copyright, email);
 
@@ -236,6 +234,7 @@ print_help(void)
 
        printf("\n");
        printf("%s\n", _("Options:"));
+       printf(UT_EXTRA_OPTS);
        printf (" %s\n", "-s, --service");
        printf ("    %s\n", _("Check service cluster status"));
        printf (" %s\n", "-h, --host");
@@ -252,13 +251,19 @@ print_help(void)
        printf ("    %s\n", _("The status codes of the hosts or services in the cluster, separated by"));
        printf ("    %s\n", _("commas"));
 
-       printf(_(UT_VERBOSE));
+       printf(UT_VERBOSE);
 
        printf("\n");
        printf("%s\n", _("Notes:"));
-       printf(_(UT_THRESHOLDS_NOTES));
+       printf(UT_THRESHOLDS_NOTES);
+
+       printf ("\n");
+       printf ("%s\n", _("Examples:"));
+       printf (" %s\n", "check_cluster -s -d 2,0,2,0 -c @3:");
+       printf ("    %s\n", _("Will alert critical if there are 3 or more service data points in a non-OK") );
+       printf ("    %s\n", _("state.") );
 
-       printf(_(UT_SUPPORT));
+       printf(UT_SUPPORT);
 }
 
 
@@ -266,7 +271,7 @@ void
 print_usage(void)
 {
 
-       printf(_("Usage:"));
+       printf("%s\n", _("Usage:"));
        printf(" %s (-s | -h) -d val1[,val2,...,valn] [-l label]\n", progname);
        printf("[-w threshold] [-c threshold] [-v] [--help]\n");