diff options
-rw-r--r-- | plugins/utils.c | 64 |
1 files changed, 32 insertions, 32 deletions
diff --git a/plugins/utils.c b/plugins/utils.c index c0dce255..ebdae2e1 100644 --- a/plugins/utils.c +++ b/plugins/utils.c | |||
@@ -601,41 +601,39 @@ 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 | 604 | int warnp, /* Warning present */ | |
605 | int warnp, | ||
606 | uint64_t warn, | 605 | uint64_t warn, |
607 | 606 | int critp, /* Critical present */ | |
608 | int critp, | ||
609 | uint64_t crit, | 607 | uint64_t crit, |
610 | 608 | int minp, /* Minimum present */ | |
611 | int minp, | ||
612 | uint64_t minv, | 609 | uint64_t minv, |
613 | 610 | int maxp, /* Maximum present */ | |
614 | int maxp, | ||
615 | uint64_t maxv) | 611 | uint64_t maxv) |
616 | { | 612 | { |
617 | char *data = NULL; | 613 | char *data = NULL; |
618 | 614 | ||
619 | if (strpbrk (label, "'= ")) | 615 | if (strpbrk (label, "'= ")) |
620 | xasprintf (&data, "'%s'=%ld%s", label, val, uom); | 616 | xasprintf (&data, "'%s'=%ld%s;", label, val, uom); |
621 | else | 617 | else |
622 | xasprintf (&data, "%s=%ld%s", label, val, uom); | 618 | xasprintf (&data, "%s=%ld%s;", label, val, uom); |
623 | xasprintf (&data, "%s;", data); | ||
624 | 619 | ||
625 | if (warnp) | 620 | if (warnp) |
626 | xasprintf (&data, "%s%lu", data, warn); | 621 | xasprintf (&data, "%s%lu;", data, warn); |
627 | xasprintf (&data, "%s;", data); | 622 | else |
623 | xasprintf (&data, "%s;", data); | ||
628 | 624 | ||
629 | if (critp) | 625 | if (critp) |
630 | xasprintf (&data, "%s%lu", data, crit); | 626 | xasprintf (&data, "%s%lu;", data, crit); |
631 | xasprintf (&data, "%s;", data); | 627 | else |
628 | xasprintf (&data, "%s;", data); | ||
632 | 629 | ||
633 | if (minp) | 630 | if (minp) |
634 | xasprintf (&data, "%s%lu", data, minv); | 631 | xasprintf (&data, "%s%lu;", data, minv); |
635 | xasprintf (&data, "%s;", data); | 632 | else |
633 | xasprintf (&data, "%s;", data); | ||
636 | 634 | ||
637 | if (maxp) | 635 | if (maxp) |
638 | xasprintf (&data, "%s;%lu", data, maxv); | 636 | xasprintf (&data, "%s%lu", data, maxv); |
639 | 637 | ||
640 | return data; | 638 | return data; |
641 | } | 639 | } |
@@ -644,37 +642,39 @@ char *perfdata_uint64 (const char *label, | |||
644 | char *perfdata_int64 (const char *label, | 642 | char *perfdata_int64 (const char *label, |
645 | int64_t val, | 643 | int64_t val, |
646 | const char *uom, | 644 | const char *uom, |
647 | int warnp, | 645 | int warnp, /* Warning present */ |
648 | int64_t warn, | 646 | int64_t warn, |
649 | int critp, | 647 | int critp, /* Critical present */ |
650 | int64_t crit, | 648 | int64_t crit, |
651 | int minp, | 649 | int minp, /* Minimum present */ |
652 | int64_t minv, | 650 | int64_t minv, |
653 | int maxp, | 651 | int maxp, /* Maximum present */ |
654 | int64_t maxv) | 652 | int64_t maxv) |
655 | { | 653 | { |
656 | char *data = NULL; | 654 | char *data = NULL; |
657 | 655 | ||
658 | if (strpbrk (label, "'= ")) | 656 | if (strpbrk (label, "'= ")) |
659 | xasprintf (&data, "'%s'=%ld%s", label, val, uom); | 657 | xasprintf (&data, "'%s'=%ld%s;", label, val, uom); |
660 | else | 658 | else |
661 | xasprintf (&data, "%s=%ld%s", label, val, uom); | 659 | xasprintf (&data, "%s=%ld%s;", label, val, uom); |
662 | xasprintf (&data, "%s;", data); | ||
663 | 660 | ||
664 | if (warnp) | 661 | if (warnp) |
665 | xasprintf (&data, "%s%ld", data, warn); | 662 | xasprintf (&data, "%s%ld;", data, warn); |
666 | xasprintf (&data, "%s;", data); | 663 | else |
664 | xasprintf (&data, "%s;", data); | ||
667 | 665 | ||
668 | if (critp) | 666 | if (critp) |
669 | xasprintf (&data, "%s%ld", data, crit); | 667 | xasprintf (&data, "%s%ld;", data, crit); |
670 | xasprintf (&data, "%s;", data); | 668 | else |
669 | xasprintf (&data, "%s;", data); | ||
671 | 670 | ||
672 | if (minp) | 671 | if (minp) |
673 | xasprintf (&data, "%s%ld", data, minv); | 672 | xasprintf (&data, "%s%ld;", data, minv); |
674 | xasprintf (&data, "%s;", data); | 673 | else |
674 | xasprintf (&data, "%s;", data); | ||
675 | 675 | ||
676 | if (maxp) | 676 | if (maxp) |
677 | xasprintf (&data, "%s;%ld", data, maxv); | 677 | xasprintf (&data, "%s%ld", data, maxv); |
678 | 678 | ||
679 | return data; | 679 | return data; |
680 | } | 680 | } |