summaryrefslogtreecommitdiffstats
path: root/plugins/check_users.c
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/check_users.c')
-rw-r--r--plugins/check_users.c21
1 files changed, 13 insertions, 8 deletions
diff --git a/plugins/check_users.c b/plugins/check_users.c
index 7cf7a2cc..89b95369 100644
--- a/plugins/check_users.c
+++ b/plugins/check_users.c
@@ -227,18 +227,23 @@ process_arguments (int argc, char **argv)
227 } 227 }
228 228
229 c = optind; 229 c = optind;
230
230 if (warning_range == NULL && argc > c) 231 if (warning_range == NULL && argc > c)
231 warning_range = argv[c++]; 232 warning_range = argv[c++];
233
232 if (critical_range == NULL && argc > c) 234 if (critical_range == NULL && argc > c)
233 critical_range = argv[c++]; 235 critical_range = argv[c++];
234 236
235 /* this will abort in case of invalid ranges */ 237 /* this will abort in case of invalid ranges */
236 set_thresholds (&thlds, warning_range, critical_range); 238 set_thresholds (&thlds, warning_range, critical_range);
237 239
238 if (thlds->warning->end < 0) 240 if (!thlds->warning) {
239 usage4 (_("Warning threshold must be a positive integer")); 241 usage4 (_("Warning threshold must be a valid range expression"));
240 if (thlds->critical->end < 0) 242 }
241 usage4 (_("Critical threshold must be a positive integer")); 243
244 if (!thlds->critical) {
245 usage4 (_("Critical threshold must be a valid range expression"));
246 }
242 247
243 return OK; 248 return OK;
244} 249}
@@ -261,10 +266,10 @@ print_help (void)
261 printf (UT_HELP_VRSN); 266 printf (UT_HELP_VRSN);
262 printf (UT_EXTRA_OPTS); 267 printf (UT_EXTRA_OPTS);
263 268
264 printf (" %s\n", "-w, --warning=INTEGER"); 269 printf (" %s\n", "-w, --warning=RANGE_EXPRESSION");
265 printf (" %s\n", _("Set WARNING status if more than INTEGER users are logged in")); 270 printf (" %s\n", _("Set WARNING status if number of logged in users violates RANGE_EXPRESSION"));
266 printf (" %s\n", "-c, --critical=INTEGER"); 271 printf (" %s\n", "-c, --critical=RANGE_EXPRESSION");
267 printf (" %s\n", _("Set CRITICAL status if more than INTEGER users are logged in")); 272 printf (" %s\n", _("Set CRITICAL status if number of logged in users violates RANGE_EXPRESSION"));
268 273
269 printf (UT_SUPPORT); 274 printf (UT_SUPPORT);
270} 275}