summaryrefslogtreecommitdiffstats
path: root/plugins/check_load.c
diff options
context:
space:
mode:
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 bedbf16..3c0ecad 100644
--- a/plugins/check_load.c
+++ b/plugins/check_load.c
@@ -226,32 +226,32 @@ process_arguments (int argc, char **argv)
226 if (c == argc) 226 if (c == argc)
227 return validate_arguments (); 227 return validate_arguments ();
228 if (wload1 < 0 && is_nonnegative (argv[c])) 228 if (wload1 < 0 && is_nonnegative (argv[c]))
229 wload1 = atof (argv[c]); 229 wload1 = atof (argv[c++]);
230 230
231 if (c == argc) 231 if (c == argc)
232 return validate_arguments (); 232 return validate_arguments ();
233 if (cload1 < 0 && is_nonnegative (argv[c])) 233 if (cload1 < 0 && is_nonnegative (argv[c]))
234 cload1 = atof (argv[c]); 234 cload1 = atof (argv[c++]);
235 235
236 if (c == argc) 236 if (c == argc)
237 return validate_arguments (); 237 return validate_arguments ();
238 if (wload5 < 0 && is_nonnegative (argv[c])) 238 if (wload5 < 0 && is_nonnegative (argv[c]))
239 wload5 = atof (argv[c]); 239 wload5 = atof (argv[c++]);
240 240
241 if (c == argc) 241 if (c == argc)
242 return validate_arguments (); 242 return validate_arguments ();
243 if (cload5 < 0 && is_nonnegative (argv[c])) 243 if (cload5 < 0 && is_nonnegative (argv[c]))
244 cload5 = atof (argv[c]); 244 cload5 = atof (argv[c++]);
245 245
246 if (c == argc) 246 if (c == argc)
247 return validate_arguments (); 247 return validate_arguments ();
248 if (wload15 < 0 && is_nonnegative (argv[c])) 248 if (wload15 < 0 && is_nonnegative (argv[c]))
249 wload15 = atof (argv[c]); 249 wload15 = atof (argv[c++]);
250 250
251 if (c == argc) 251 if (c == argc)
252 return validate_arguments (); 252 return validate_arguments ();
253 if (cload15 < 0 && is_nonnegative (argv[c])) 253 if (cload15 < 0 && is_nonnegative (argv[c]))
254 cload15 = atof (argv[c]); 254 cload15 = atof (argv[c++]);
255 255
256 return validate_arguments (); 256 return validate_arguments ();
257} 257}
@@ -263,12 +263,24 @@ process_arguments (int argc, char **argv)
263int 263int
264validate_arguments (void) 264validate_arguments (void)
265{ 265{
266 if ((wload1 > cload1) || (wload5 > cload5) || (wload15 > cload15)) { 266 if (wload1 < 0)
267 printf 267 usage ("Warning threshold for 1-minute load average is not specified\n");
268 ("Inconsistence in parameters: \"warning load\" greater than \"critical load\".\n"); 268 if (wload5 < 0)
269 return STATE_UNKNOWN; 269 usage ("Warning threshold for 5-minute load average is not specified\n");
270 } 270 if (wload15 < 0)
271 271 usage ("Warning threshold for 15-minute load average is not specified\n");
272 if (cload1 < 0)
273 usage ("Critical threshold for 1-minute load average is not specified\n");
274 if (cload5 < 0)
275 usage ("Critical threshold for 5-minute load average is not specified\n");
276 if (cload15 < 0)
277 usage ("Critical threshold for 15-minute load average is not specified\n");
278 if (wload1 > cload1)
279 usage ("Parameter inconsistency: 1-minute \"warning load\" greater than \"critical load\".\n");
280 if (wload5 > cload5)
281 usage ("Parameter inconsistency: 5-minute \"warning load\" greater than \"critical load\".\n");
282 if (wload15 > cload15)
283 usage ("Parameter inconsistency: 15-minute \"warning load\" greater than \"critical load\".\n");
272 return OK; 284 return OK;
273} 285}
274 286