diff options
Diffstat (limited to 'plugins/check_users.c')
-rw-r--r-- | plugins/check_users.c | 25 |
1 files changed, 15 insertions, 10 deletions
diff --git a/plugins/check_users.c b/plugins/check_users.c index 2a9ee986..89b95369 100644 --- a/plugins/check_users.c +++ b/plugins/check_users.c | |||
@@ -179,7 +179,7 @@ main (int argc, char **argv) | |||
179 | printf (_("USERS %s - %d users currently logged in |%s\n"), | 179 | printf (_("USERS %s - %d users currently logged in |%s\n"), |
180 | state_text(result), users, | 180 | state_text(result), users, |
181 | sperfdata_int("users", users, "", warning_range, | 181 | sperfdata_int("users", users, "", warning_range, |
182 | critical_range, TRUE, 0, FALSE, 0)); | 182 | critical_range, true, 0, false, 0)); |
183 | } | 183 | } |
184 | 184 | ||
185 | return result; | 185 | return result; |
@@ -202,7 +202,7 @@ process_arguments (int argc, char **argv) | |||
202 | if (argc < 2) | 202 | if (argc < 2) |
203 | usage ("\n"); | 203 | usage ("\n"); |
204 | 204 | ||
205 | while (1) { | 205 | while (true) { |
206 | c = getopt_long (argc, argv, "+hVvc:w:", longopts, &option); | 206 | c = getopt_long (argc, argv, "+hVvc:w:", longopts, &option); |
207 | 207 | ||
208 | if (c == -1 || c == EOF || c == 1) | 208 | if (c == -1 || c == EOF || c == 1) |
@@ -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 | } |