diff --git a/plugins/check_load.c b/plugins/check_load.c
index 9de8ff78546ae6718e102ab9735c7f06a1735d4d..940d37ec9417cf54cc9b31c3acd6ceb93aef09ae 100644 (file)
--- a/plugins/check_load.c
+++ b/plugins/check_load.c
-/******************************************************************************
-*
+/*****************************************************************************
+*
* Nagios check_load plugin
-*
+*
* License: GPL
-* Copyright (c) 1999-2006 nagios-plugins team
-*
-* Last Modified: $Date$
-*
+* Copyright (c) 1999-2007 Nagios Plugins Development Team
+*
* Description:
-*
+*
* This file contains the check_load plugin
-*
-* This plugin tests the current system load average.
-*
-*
-* License Information:
-*
-* This program is free software; you can redistribute it and/or modify
+*
+* This plugin tests the current system load average.
+*
+*
+* 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 2 of the License, or
+* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
-*
+*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
-*
+*
* You should have received a copy of the GNU General Public License
-* along with this program; if not, write to the Free Software
-* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-
- $Id$
-
-******************************************************************************/
+* along with this program. If not, see <http://www.gnu.org/licenses/>.
+*
+*
+*****************************************************************************/
const char *progname = "check_load";
-const char *revision = "$Revision$";
-const char *copyright = "1999-2006";
+const char *copyright = "1999-2007";
const char *email = "nagiosplug-devel@lists.sourceforge.net";
#include "common.h"
get_threshold(char *arg, double *th)
{
size_t i, n;
+ int valid = 0;
char *str = arg, *p;
n = strlen(arg);
th[i] = strtod(str, &p);
if(p == str) break;
+ valid = 1;
str = p + 1;
if(n <= (size_t)(str - arg)) break;
}
/* empty argument or non-floatish, so warn about it and die */
- if(!i) usage (_("Warning threshold must be float or float triplet!\n"));
+ if(!i && !valid) usage (_("Warning threshold must be float or float triplet!\n"));
if(i != 2) {
/* one or more numbers were given, so fill array with last
textdomain (PACKAGE);
setlocale(LC_NUMERIC, "POSIX");
+ /* Parse extra opts if any */
+ argv = np_extra_opts (&argc, argv, progname);
+
if (process_arguments (argc, argv) == ERROR)
usage4 (_("Could not parse arguments"));
take_into_account_cpus = 1;
break;
case 'V': /* version */
- print_revision (progname, revision);
+ print_revision (progname, NP_VERSION);
exit (STATE_OK);
case 'h': /* help */
print_help ();
void
print_help (void)
{
- print_revision (progname, revision);
+ print_revision (progname, NP_VERSION);
printf ("Copyright (c) 1999 Felipe Gustavo de Almeida <galmeida@linux.ime.usp.br>\n");
printf (COPYRIGHT, copyright, email);
printf (_("This plugin tests the current system load average."));
printf ("\n\n");
-
+
print_usage ();
printf (_(UT_HELP_VRSN));
+ printf (_(UT_EXTRA_OPTS));
printf (" %s\n", "-w, --warning=WLOAD1,WLOAD5,WLOAD15");
printf (" %s\n", _("Exit with WARNING status if load average exceeds WLOADn"));
printf (" %s\n", "-r, --percpu");
printf (" %s\n", _("Divide the load averages by the number of CPUs (when possible)"));
+#ifdef NP_EXTRA_OPTS
+ printf ("\n");
+ printf ("%s\n", _("Notes:"));
+ printf (_(UT_EXTRA_OPTS_NOTES));
+#endif
+
printf (_(UT_SUPPORT));
}