X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;ds=sidebyside;f=plugins%2Fcheck_load.c;h=7e1cc481e9d777b3662cf404c9f65c6322f9d6eb;hb=187f86275426bfb501c7180c48161e1e22af1ef7;hp=ba942c5c21c0acbdc0527f7a6f86f351520c2272;hpb=fcf3534ea29211d266338d2e7404987dd7bcf97f;p=nagiosplug.git diff --git a/plugins/check_load.c b/plugins/check_load.c index ba942c5..7e1cc48 100644 --- a/plugins/check_load.c +++ b/plugins/check_load.c @@ -13,12 +13,14 @@ 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$ ******************************************************************************/ const char *progname = "check_load"; const char *revision = "$Revision$"; -const char *copyright = "1999-2003"; +const char *copyright = "1999-2004"; const char *email = "nagiosplug-devel@lists.sourceforge.net"; #include "common.h" @@ -49,13 +51,11 @@ char *status_line; - - - int main (int argc, char **argv) { - int result; + int result = STATE_UNKNOWN; + #if HAVE_GETLOADAVG==1 double la[3] = { 0.0, 0.0, 0.0 }; /* NetBSD complains about unitialized arrays */ #else @@ -75,7 +75,7 @@ main (int argc, char **argv) textdomain (PACKAGE); if (process_arguments (argc, argv) == ERROR) - usage ("failed processing arguments\n"); + usage4 (_("Could not parse arguments")); #if HAVE_GETLOADAVG==1 result = getloadavg (la, 3); @@ -152,17 +152,14 @@ main (int argc, char **argv) "%s - %s|%s %s %s\n", state_text (result), status_line, - perfdata ("load1", la1, "", wload1, wload1, cload1, cload1, TRUE, 0, FALSE, 0), - perfdata ("load5", la5, "", wload5, wload5, cload5, cload5, TRUE, 0, FALSE, 0), - perfdata ("load15", la15, "", wload15, wload15, cload15, cload15, TRUE, 0, FALSE, 0)); + fperfdata ("load1", la1, "", (int)wload1, wload1, (int)cload1, cload1, TRUE, 0, FALSE, 0), + fperfdata ("load5", la5, "", (int)wload5, wload5, (int)cload5, cload5, TRUE, 0, FALSE, 0), + fperfdata ("load15", la15, "", (int)wload15, wload15, (int)cload15, cload15, TRUE, 0, FALSE, 0)); return STATE_OK; } - - - /* process command-line arguments */ int process_arguments (int argc, char **argv) @@ -221,13 +218,13 @@ process_arguments (int argc, char **argv) usage (_("Critical threshold must be float or float triplet!\n")); break; case 'V': /* version */ - print_revision (progname, "$Revision$"); + print_revision (progname, revision); exit (STATE_OK); case 'h': /* help */ print_help (); exit (STATE_OK); case '?': /* help */ - usage (_("Invalid argument\n")); + usage2 (_("Unknown argument"), optarg); } } @@ -267,8 +264,6 @@ process_arguments (int argc, char **argv) - - int validate_arguments (void) { @@ -295,16 +290,13 @@ validate_arguments (void) - - - void print_help (void) { print_revision (progname, revision); - printf (_("Copyright (c) 1999 Felipe Gustavo de Almeida \n")); - printf (_(COPYRIGHT), copyright, email); + printf ("Copyright (c) 1999 Felipe Gustavo de Almeida \n"); + printf (COPYRIGHT, copyright, email); printf (_("This plugin tests the current system load average.\n\n")); @@ -325,7 +317,5 @@ the load average format is the same used by \"uptime\" and \"w\"\n\n")); void print_usage (void) { - printf (_("Usage: %s -w WLOAD1,WLOAD5,WLOAD15 -c CLOAD1,CLOAD5,CLOAD15\n"), - progname); - printf (_(UT_HLP_VRS), progname, progname); + printf ("Usage: %s -w WLOAD1,WLOAD5,WLOAD15 -c CLOAD1,CLOAD5,CLOAD15\n", progname); }