summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRincewindsHat <12514511+RincewindsHat@users.noreply.github.com>2021-11-19 09:29:10 (GMT)
committerGitHub <noreply@github.com>2021-11-19 09:29:10 (GMT)
commitdf835cfde00334de219efc741e2ba7bf5f64f635 (patch)
treec1472abfd7762162357759c7ba8c1ee796388caa
parent6e18790b69df72b545aa784ffc36b138860a08a9 (diff)
parentee3449dee7578f1b0508b9ceb0c14a0d72a67646 (diff)
downloadmonitoring-plugins-df835cf.tar.gz
Merge pull request #1723 from RincewindsHat/check_swap_smallfix_and_style
Small fix to threshold validation and style (indentation) fixes
-rw-r--r--plugins/check_swap.c43
1 files changed, 23 insertions, 20 deletions
diff --git a/plugins/check_swap.c b/plugins/check_swap.c
index 685c2cc..7f71bf7 100644
--- a/plugins/check_swap.c
+++ b/plugins/check_swap.c
@@ -552,9 +552,12 @@ validate_arguments (void)
552 if (warn.value == 0 && crit.value == 0) { 552 if (warn.value == 0 && crit.value == 0) {
553 return ERROR; 553 return ERROR;
554 } 554 }
555 else if (warn.value < crit.value) { 555 else if ((warn.is_percentage == crit.is_percentage) && (warn.value < crit.value)) {
556 usage4 556 /* This is NOT triggered if warn and crit are different units, e.g warn is percentage
557 (_("Warning should be more than critical")); 557 * and crit is absolut. We cannot determine the condition at this point since we
558 * dont know the value of total swap yet
559 */
560 usage4(_("Warning should be more than critical"));
558 } 561 }
559 return OK; 562 return OK;
560} 563}
@@ -570,7 +573,7 @@ print_help (void)
570 573
571 printf ("%s\n", _("Check swap space on local machine.")); 574 printf ("%s\n", _("Check swap space on local machine."));
572 575
573 printf ("\n\n"); 576 printf ("\n\n");
574 577
575 print_usage (); 578 print_usage ();
576 579
@@ -578,23 +581,23 @@ print_help (void)
578 printf (UT_EXTRA_OPTS); 581 printf (UT_EXTRA_OPTS);
579 582
580 printf (" %s\n", "-w, --warning=INTEGER"); 583 printf (" %s\n", "-w, --warning=INTEGER");
581 printf (" %s\n", _("Exit with WARNING status if less than INTEGER bytes of swap space are free")); 584 printf (" %s\n", _("Exit with WARNING status if less than INTEGER bytes of swap space are free"));
582 printf (" %s\n", "-w, --warning=PERCENT%%"); 585 printf (" %s\n", "-w, --warning=PERCENT%");
583 printf (" %s\n", _("Exit with WARNING status if less than PERCENT of swap space is free")); 586 printf (" %s\n", _("Exit with WARNING status if less than PERCENT of swap space is free"));
584 printf (" %s\n", "-c, --critical=INTEGER"); 587 printf (" %s\n", "-c, --critical=INTEGER");
585 printf (" %s\n", _("Exit with CRITICAL status if less than INTEGER bytes of swap space are free")); 588 printf (" %s\n", _("Exit with CRITICAL status if less than INTEGER bytes of swap space are free"));
586 printf (" %s\n", "-c, --critical=PERCENT%%"); 589 printf (" %s\n", "-c, --critical=PERCENT%");
587 printf (" %s\n", _("Exit with CRITICAL status if less than PERCENT of swap space is free")); 590 printf (" %s\n", _("Exit with CRITICAL status if less than PERCENT of swap space is free"));
588 printf (" %s\n", "-a, --allswaps"); 591 printf (" %s\n", "-a, --allswaps");
589 printf (" %s\n", _("Conduct comparisons for all swap partitions, one by one")); 592 printf (" %s\n", _("Conduct comparisons for all swap partitions, one by one"));
590 printf (" %s\n", "-n, --no-swap=<ok|warning|critical|unknown>"); 593 printf (" %s\n", "-n, --no-swap=<ok|warning|critical|unknown>");
591 printf (" %s %s\n", _("Resulting state when there is no swap regardless of thresholds. Default:"), state_text(no_swap_state)); 594 printf (" %s %s\n", _("Resulting state when there is no swap regardless of thresholds. Default:"), state_text(no_swap_state));
592 printf (UT_VERBOSE); 595 printf (UT_VERBOSE);
593 596
594 printf ("\n"); 597 printf ("\n");
595 printf ("%s\n", _("Notes:")); 598 printf ("%s\n", _("Notes:"));
596 printf (" %s\n", _("Both INTEGER and PERCENT thresholds can be specified, they are all checked.")); 599 printf (" %s\n", _("Both INTEGER and PERCENT thresholds can be specified, they are all checked."));
597 printf (" %s\n", _("On AIX, if -a is specified, uses lsps -a, otherwise uses lsps -s.")); 600 printf (" %s\n", _("On AIX, if -a is specified, uses lsps -a, otherwise uses lsps -s."));
598 601
599 printf (UT_SUPPORT); 602 printf (UT_SUPPORT);
600} 603}
@@ -604,6 +607,6 @@ void
604print_usage (void) 607print_usage (void)
605{ 608{
606 printf ("%s\n", _("Usage:")); 609 printf ("%s\n", _("Usage:"));
607 printf (" %s [-av] -w <percent_free>%% -c <percent_free>%%\n",progname); 610 printf (" %s [-av] -w <percent_free>%% -c <percent_free>%%\n",progname);
608 printf (" -w <bytes_free> -c <bytes_free> [-n <state>]\n"); 611 printf (" -w <bytes_free> -c <bytes_free> [-n <state>]\n");
609} 612}