summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 01a2701)
raw | patch | inline | side by side (parent: 01a2701)
author | Karl DeBisschop <kdebisschop@users.sourceforge.net> | |
Fri, 20 Feb 2004 05:21:21 +0000 (05:21 +0000) | ||
committer | Karl DeBisschop <kdebisschop@users.sourceforge.net> | |
Fri, 20 Feb 2004 05:21:21 +0000 (05:21 +0000) |
git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/trunk@817 f882894a-f735-0410-b71e-b25c423dba1c
plugins/utils.c | patch | blob | history | |
plugins/utils.h | patch | blob | history |
diff --git a/plugins/utils.c b/plugins/utils.c
index ec2547392c0665c5acd1b1632ee84d9ef8837458..77e2e27955f33c77fd981052161e5229bb179810 100644 (file)
--- a/plugins/utils.c
+++ b/plugins/utils.c
return data;
}
+
+
+char *fperfdata (const char *label,
+ double val,
+ const char *uom,
+ int warnp,
+ double warn,
+ int critp,
+ double crit,
+ int minp,
+ double minv,
+ int maxp,
+ double maxv)
+{
+ char *data = NULL;
+
+ if (strpbrk (label, "'= "))
+ asprintf (&data, "'%s'=%ld%s;", label, val, uom);
+ else
+ asprintf (&data, "%s=%ld%s;", label, val, uom);
+
+ if (warnp)
+ asprintf (&data, "%s%ld;", data, warn);
+ else
+ asprintf (&data, "%s;", data);
+
+ if (critp)
+ asprintf (&data, "%s%ld;", data, crit);
+ else
+ asprintf (&data, "%s;", data);
+
+ if (minp)
+ asprintf (&data, "%s%ld", data, minv);
+
+ if (maxp)
+ asprintf (&data, "%s;%ld", data, maxv);
+
+ return data;
+}
diff --git a/plugins/utils.h b/plugins/utils.h
index c2b06415478902b16fb132de486557f26b856c04..35e62ab44c36be7821f1726948520f27c5300666 100644 (file)
--- a/plugins/utils.h
+++ b/plugins/utils.h
int maxp,
long int maxv);
+char *fperfdata (const char *label,
+ double val,
+ const char *uom,
+ int warnp,
+ double warn,
+ int critp,
+ double crit,
+ int minp,
+ double minv,
+ int maxp,
+ double maxv);
+
/* The idea here is that, although not every plugin will use all of these,
most will or should. Therefore, for consistency, these very common
options should have only these meanings throughout the overall suite */