summaryrefslogtreecommitdiffstats
path: root/plugins/t
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/t')
0 files changed, 0 insertions, 0 deletions
diff --git a/plugins/utils.c b/plugins/utils.c
index ec25473..77e2e27 100644
--- a/plugins/utils.c
+++ b/plugins/utils.c
@@ -544,3 +544,42 @@ char *perfdata (const char *label,
544 544
545 return data; 545 return data;
546} 546}
547
548
549char *fperfdata (const char *label,
550 double val,
551 const char *uom,
552 int warnp,
553 double warn,
554 int critp,
555 double crit,
556 int minp,
557 double minv,
558 int maxp,
559 double maxv)
560{
561 char *data = NULL;
562
563 if (strpbrk (label, "'= "))
564 asprintf (&data, "'%s'=%ld%s;", label, val, uom);
565 else
566 asprintf (&data, "%s=%ld%s;", label, val, uom);
567
568 if (warnp)
569 asprintf (&data, "%s%ld;", data, warn);
570 else
571 asprintf (&data, "%s;", data);
572
573 if (critp)
574 asprintf (&data, "%s%ld;", data, crit);
575 else
576 asprintf (&data, "%s;", data);
577
578 if (minp)
579 asprintf (&data, "%s%ld", data, minv);
580
581 if (maxp)
582 asprintf (&data, "%s;%ld", data, maxv);
583
584 return data;
585}
diff --git a/plugins/utils.h b/plugins/utils.h
index c2b0641..35e62ab 100644
--- a/plugins/utils.h
+++ b/plugins/utils.h
@@ -92,6 +92,18 @@ char *perfdata (const char *label,
92 int maxp, 92 int maxp,
93 long int maxv); 93 long int maxv);
94 94
95char *fperfdata (const char *label,
96 double val,
97 const char *uom,
98 int warnp,
99 double warn,
100 int critp,
101 double crit,
102 int minp,
103 double minv,
104 int maxp,
105 double maxv);
106
95/* The idea here is that, although not every plugin will use all of these, 107/* The idea here is that, although not every plugin will use all of these,
96 most will or should. Therefore, for consistency, these very common 108 most will or should. Therefore, for consistency, these very common
97 options should have only these meanings throughout the overall suite */ 109 options should have only these meanings throughout the overall suite */