diff options
author | RincewindsHat <12514511+RincewindsHat@users.noreply.github.com> | 2021-10-28 16:13:28 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-10-28 16:13:28 +0200 |
commit | 7415eb2f065911b138e167e35d0f67cddb5718ef (patch) | |
tree | 27c82696cf49a00a379f030bb09adc3f1e37102e /plugins/utils.c | |
parent | e79ada81a696e3c826b383e3ff7cbc8f91bf46a4 (diff) | |
parent | 884327ee21b25be3ce1b5627bb40339e14545256 (diff) | |
download | monitoring-plugins-7415eb2f065911b138e167e35d0f67cddb5718ef.tar.gz |
Merge pull request #1714 from RincewindsHat/fix_perfdata_for_big_values_for_check_disk
Fix perfdata for big values for check disk.
First merge \o/
Diffstat (limited to 'plugins/utils.c')
-rw-r--r-- | plugins/utils.c | 32 |
1 files changed, 18 insertions, 14 deletions
diff --git a/plugins/utils.c b/plugins/utils.c index f7f8952f..ebdae2e1 100644 --- a/plugins/utils.c +++ b/plugins/utils.c | |||
@@ -601,13 +601,13 @@ char *perfdata (const char *label, | |||
601 | char *perfdata_uint64 (const char *label, | 601 | char *perfdata_uint64 (const char *label, |
602 | uint64_t val, | 602 | uint64_t val, |
603 | const char *uom, | 603 | const char *uom, |
604 | int warnp, | 604 | int warnp, /* Warning present */ |
605 | uint64_t warn, | 605 | uint64_t warn, |
606 | int critp, | 606 | int critp, /* Critical present */ |
607 | uint64_t crit, | 607 | uint64_t crit, |
608 | int minp, | 608 | int minp, /* Minimum present */ |
609 | uint64_t minv, | 609 | uint64_t minv, |
610 | int maxp, | 610 | int maxp, /* Maximum present */ |
611 | uint64_t maxv) | 611 | uint64_t maxv) |
612 | { | 612 | { |
613 | char *data = NULL; | 613 | char *data = NULL; |
@@ -618,20 +618,22 @@ char *perfdata_uint64 (const char *label, | |||
618 | xasprintf (&data, "%s=%ld%s;", label, val, uom); | 618 | xasprintf (&data, "%s=%ld%s;", label, val, uom); |
619 | 619 | ||
620 | if (warnp) | 620 | if (warnp) |
621 | xasprintf (&data, "%s%ld;", data, warn); | 621 | xasprintf (&data, "%s%lu;", data, warn); |
622 | else | 622 | else |
623 | xasprintf (&data, "%s;", data); | 623 | xasprintf (&data, "%s;", data); |
624 | 624 | ||
625 | if (critp) | 625 | if (critp) |
626 | xasprintf (&data, "%s%ld;", data, crit); | 626 | xasprintf (&data, "%s%lu;", data, crit); |
627 | else | 627 | else |
628 | xasprintf (&data, "%s;", data); | 628 | xasprintf (&data, "%s;", data); |
629 | 629 | ||
630 | if (minp) | 630 | if (minp) |
631 | xasprintf (&data, "%s%ld", data, minv); | 631 | xasprintf (&data, "%s%lu;", data, minv); |
632 | else | ||
633 | xasprintf (&data, "%s;", data); | ||
632 | 634 | ||
633 | if (maxp) | 635 | if (maxp) |
634 | xasprintf (&data, "%s;%ld", data, maxv); | 636 | xasprintf (&data, "%s%lu", data, maxv); |
635 | 637 | ||
636 | return data; | 638 | return data; |
637 | } | 639 | } |
@@ -640,13 +642,13 @@ char *perfdata_uint64 (const char *label, | |||
640 | char *perfdata_int64 (const char *label, | 642 | char *perfdata_int64 (const char *label, |
641 | int64_t val, | 643 | int64_t val, |
642 | const char *uom, | 644 | const char *uom, |
643 | int warnp, | 645 | int warnp, /* Warning present */ |
644 | int64_t warn, | 646 | int64_t warn, |
645 | int critp, | 647 | int critp, /* Critical present */ |
646 | int64_t crit, | 648 | int64_t crit, |
647 | int minp, | 649 | int minp, /* Minimum present */ |
648 | int64_t minv, | 650 | int64_t minv, |
649 | int maxp, | 651 | int maxp, /* Maximum present */ |
650 | int64_t maxv) | 652 | int64_t maxv) |
651 | { | 653 | { |
652 | char *data = NULL; | 654 | char *data = NULL; |
@@ -667,10 +669,12 @@ char *perfdata_int64 (const char *label, | |||
667 | xasprintf (&data, "%s;", data); | 669 | xasprintf (&data, "%s;", data); |
668 | 670 | ||
669 | if (minp) | 671 | if (minp) |
670 | xasprintf (&data, "%s%ld", data, minv); | 672 | xasprintf (&data, "%s%ld;", data, minv); |
673 | else | ||
674 | xasprintf (&data, "%s;", data); | ||
671 | 675 | ||
672 | if (maxp) | 676 | if (maxp) |
673 | xasprintf (&data, "%s;%ld", data, maxv); | 677 | xasprintf (&data, "%s%ld", data, maxv); |
674 | 678 | ||
675 | return data; | 679 | return data; |
676 | } | 680 | } |