aboutsummaryrefslogtreecommitdiff
path: root/plugins/check_load.c
diff options
context:
space:
mode:
authorGravatar Karl DeBisschop <kdebisschop@users.sourceforge.net> 2002-10-21 03:55:37 +0000
committerGravatar Karl DeBisschop <kdebisschop@users.sourceforge.net> 2002-10-21 03:55:37 +0000
commitdaa6209ac5b3a94cb64c5a38f2b0800474ad71e9 (patch)
tree577179fe2638073acdc276fd33549f81ec9efbd0 /plugins/check_load.c
parent35df6c697d3a5988f4306bb86e6fe1901ed99069 (diff)
downloadmonitoring-plugins-daa6209ac5b3a94cb64c5a38f2b0800474ad71e9.tar.gz
remove broken call_getopt
git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/trunk@147 f882894a-f735-0410-b71e-b25c423dba1c
Diffstat (limited to 'plugins/check_load.c')
-rw-r--r--plugins/check_load.c36
1 files changed, 24 insertions, 12 deletions
diff --git a/plugins/check_load.c b/plugins/check_load.c
index bedbf16e..3c0ecad8 100644
--- a/plugins/check_load.c
+++ b/plugins/check_load.c
@@ -226,32 +226,32 @@ process_arguments (int argc, char **argv)
if (c == argc)
return validate_arguments ();
if (wload1 < 0 && is_nonnegative (argv[c]))
- wload1 = atof (argv[c]);
+ wload1 = atof (argv[c++]);
if (c == argc)
return validate_arguments ();
if (cload1 < 0 && is_nonnegative (argv[c]))
- cload1 = atof (argv[c]);
+ cload1 = atof (argv[c++]);
if (c == argc)
return validate_arguments ();
if (wload5 < 0 && is_nonnegative (argv[c]))
- wload5 = atof (argv[c]);
+ wload5 = atof (argv[c++]);
if (c == argc)
return validate_arguments ();
if (cload5 < 0 && is_nonnegative (argv[c]))
- cload5 = atof (argv[c]);
+ cload5 = atof (argv[c++]);
if (c == argc)
return validate_arguments ();
if (wload15 < 0 && is_nonnegative (argv[c]))
- wload15 = atof (argv[c]);
+ wload15 = atof (argv[c++]);
if (c == argc)
return validate_arguments ();
if (cload15 < 0 && is_nonnegative (argv[c]))
- cload15 = atof (argv[c]);
+ cload15 = atof (argv[c++]);
return validate_arguments ();
}
@@ -263,12 +263,24 @@ process_arguments (int argc, char **argv)
int
validate_arguments (void)
{
- if ((wload1 > cload1) || (wload5 > cload5) || (wload15 > cload15)) {
- printf
- ("Inconsistence in parameters: \"warning load\" greater than \"critical load\".\n");
- return STATE_UNKNOWN;
- }
-
+ if (wload1 < 0)
+ usage ("Warning threshold for 1-minute load average is not specified\n");
+ if (wload5 < 0)
+ usage ("Warning threshold for 5-minute load average is not specified\n");
+ if (wload15 < 0)
+ usage ("Warning threshold for 15-minute load average is not specified\n");
+ if (cload1 < 0)
+ usage ("Critical threshold for 1-minute load average is not specified\n");
+ if (cload5 < 0)
+ usage ("Critical threshold for 5-minute load average is not specified\n");
+ if (cload15 < 0)
+ usage ("Critical threshold for 15-minute load average is not specified\n");
+ if (wload1 > cload1)
+ usage ("Parameter inconsistency: 1-minute \"warning load\" greater than \"critical load\".\n");
+ if (wload5 > cload5)
+ usage ("Parameter inconsistency: 5-minute \"warning load\" greater than \"critical load\".\n");
+ if (wload15 > cload15)
+ usage ("Parameter inconsistency: 15-minute \"warning load\" greater than \"critical load\".\n");
return OK;
}