diff options
Diffstat (limited to 'plugins/utils.c')
| -rw-r--r-- | plugins/utils.c | 35 |
1 files changed, 20 insertions, 15 deletions
diff --git a/plugins/utils.c b/plugins/utils.c index 34335c89..41fe5fcf 100644 --- a/plugins/utils.c +++ b/plugins/utils.c | |||
| @@ -285,7 +285,8 @@ double delta_time(struct timeval tv) { | |||
| 285 | struct timeval now; | 285 | struct timeval now; |
| 286 | 286 | ||
| 287 | gettimeofday(&now, NULL); | 287 | gettimeofday(&now, NULL); |
| 288 | return ((double)(now.tv_sec - tv.tv_sec) + (double)(now.tv_usec - tv.tv_usec) / (double)1000000); | 288 | return ((double)(now.tv_sec - tv.tv_sec) + |
| 289 | (double)(now.tv_usec - tv.tv_usec) / (double)1000000); | ||
| 289 | } | 290 | } |
| 290 | 291 | ||
| 291 | long deltime(struct timeval tv) { | 292 | long deltime(struct timeval tv) { |
| @@ -507,8 +508,8 @@ int xasprintf(char **strp, const char *fmt, ...) { | |||
| 507 | * | 508 | * |
| 508 | ******************************************************************************/ | 509 | ******************************************************************************/ |
| 509 | 510 | ||
| 510 | char *perfdata(const char *label, long int val, const char *uom, bool warnp, long int warn, bool critp, long int crit, bool minp, | 511 | char *perfdata(const char *label, long int val, const char *uom, bool warnp, long int warn, |
| 511 | long int minv, bool maxp, long int maxv) { | 512 | bool critp, long int crit, bool minp, long int minv, bool maxp, long int maxv) { |
| 512 | char *data = NULL; | 513 | char *data = NULL; |
| 513 | 514 | ||
| 514 | if (strpbrk(label, "'= ")) { | 515 | if (strpbrk(label, "'= ")) { |
| @@ -542,10 +543,11 @@ char *perfdata(const char *label, long int val, const char *uom, bool warnp, lon | |||
| 542 | return data; | 543 | return data; |
| 543 | } | 544 | } |
| 544 | 545 | ||
| 545 | char *perfdata_uint64(const char *label, uint64_t val, const char *uom, bool warnp, /* Warning present */ | 546 | char *perfdata_uint64(const char *label, uint64_t val, const char *uom, |
| 546 | uint64_t warn, bool critp, /* Critical present */ | 547 | bool warnp, /* Warning present */ |
| 547 | uint64_t crit, bool minp, /* Minimum present */ | 548 | uint64_t warn, bool critp, /* Critical present */ |
| 548 | uint64_t minv, bool maxp, /* Maximum present */ | 549 | uint64_t crit, bool minp, /* Minimum present */ |
| 550 | uint64_t minv, bool maxp, /* Maximum present */ | ||
| 549 | uint64_t maxv) { | 551 | uint64_t maxv) { |
| 550 | char *data = NULL; | 552 | char *data = NULL; |
| 551 | 553 | ||
| @@ -580,10 +582,11 @@ char *perfdata_uint64(const char *label, uint64_t val, const char *uom, bool war | |||
| 580 | return data; | 582 | return data; |
| 581 | } | 583 | } |
| 582 | 584 | ||
| 583 | char *perfdata_int64(const char *label, int64_t val, const char *uom, bool warnp, /* Warning present */ | 585 | char *perfdata_int64(const char *label, int64_t val, const char *uom, |
| 584 | int64_t warn, bool critp, /* Critical present */ | 586 | bool warnp, /* Warning present */ |
| 585 | int64_t crit, bool minp, /* Minimum present */ | 587 | int64_t warn, bool critp, /* Critical present */ |
| 586 | int64_t minv, bool maxp, /* Maximum present */ | 588 | int64_t crit, bool minp, /* Minimum present */ |
| 589 | int64_t minv, bool maxp, /* Maximum present */ | ||
| 587 | int64_t maxv) { | 590 | int64_t maxv) { |
| 588 | char *data = NULL; | 591 | char *data = NULL; |
| 589 | 592 | ||
| @@ -618,8 +621,8 @@ char *perfdata_int64(const char *label, int64_t val, const char *uom, bool warnp | |||
| 618 | return data; | 621 | return data; |
| 619 | } | 622 | } |
| 620 | 623 | ||
| 621 | char *fperfdata(const char *label, double val, const char *uom, bool warnp, double warn, bool critp, double crit, bool minp, double minv, | 624 | char *fperfdata(const char *label, double val, const char *uom, bool warnp, double warn, bool critp, |
| 622 | bool maxp, double maxv) { | 625 | double crit, bool minp, double minv, bool maxp, double maxv) { |
| 623 | char *data = NULL; | 626 | char *data = NULL; |
| 624 | 627 | ||
| 625 | if (strpbrk(label, "'= ")) { | 628 | if (strpbrk(label, "'= ")) { |
| @@ -655,7 +658,8 @@ char *fperfdata(const char *label, double val, const char *uom, bool warnp, doub | |||
| 655 | return data; | 658 | return data; |
| 656 | } | 659 | } |
| 657 | 660 | ||
| 658 | char *sperfdata(const char *label, double val, const char *uom, char *warn, char *crit, bool minp, double minv, bool maxp, double maxv) { | 661 | char *sperfdata(const char *label, double val, const char *uom, char *warn, char *crit, bool minp, |
| 662 | double minv, bool maxp, double maxv) { | ||
| 659 | char *data = NULL; | 663 | char *data = NULL; |
| 660 | if (strpbrk(label, "'= ")) { | 664 | if (strpbrk(label, "'= ")) { |
| 661 | xasprintf(&data, "'%s'=", label); | 665 | xasprintf(&data, "'%s'=", label); |
| @@ -690,7 +694,8 @@ char *sperfdata(const char *label, double val, const char *uom, char *warn, char | |||
| 690 | return data; | 694 | return data; |
| 691 | } | 695 | } |
| 692 | 696 | ||
| 693 | char *sperfdata_int(const char *label, int val, const char *uom, char *warn, char *crit, bool minp, int minv, bool maxp, int maxv) { | 697 | char *sperfdata_int(const char *label, int val, const char *uom, char *warn, char *crit, bool minp, |
| 698 | int minv, bool maxp, int maxv) { | ||
| 694 | char *data = NULL; | 699 | char *data = NULL; |
| 695 | if (strpbrk(label, "'= ")) { | 700 | if (strpbrk(label, "'= ")) { |
| 696 | xasprintf(&data, "'%s'=", label); | 701 | xasprintf(&data, "'%s'=", label); |
