[Nagiosplug-checkins] CVS: nagiosplug/plugins utils.c,1.32,1.33 utils.h,1.15,1.16
Karl DeBisschop
kdebisschop at users.sourceforge.net
Tue Aug 26 07:09:29 CEST 2003
Update of /cvsroot/nagiosplug/nagiosplug/plugins
In directory sc8-pr-cvs1:/tmp/cvs-serv24227
Modified Files:
utils.c utils.h
Log Message:
function to make perfdata output
Index: utils.c
===================================================================
RCS file: /cvsroot/nagiosplug/nagiosplug/plugins/utils.c,v
retrieving revision 1.32
retrieving revision 1.33
diff -C2 -r1.32 -r1.33
*** utils.c 10 Aug 2003 12:56:19 -0000 1.32
--- utils.c 26 Aug 2003 10:44:14 -0000 1.33
***************
*** 498,499 ****
--- 498,543 ----
return dest;
}
+
+
+
+
+ /******************************************************************************
+ *
+ * Print perfdata in a standard format
+ *
+ ******************************************************************************/
+
+ char *perfdata (const char *label,
+ long int val,
+ const char *uom,
+ int warnp,
+ long int warn,
+ int critp,
+ long int crit,
+ int minp,
+ long int minv,
+ int maxp,
+ long int maxv)
+ {
+ char *data = NULL;
+
+ 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;
+ }
Index: utils.h
===================================================================
RCS file: /cvsroot/nagiosplug/nagiosplug/plugins/utils.h,v
retrieving revision 1.15
retrieving revision 1.16
diff -C2 -r1.15 -r1.16
*** utils.h 9 Aug 2003 06:01:03 -0000 1.15
--- utils.h 26 Aug 2003 10:44:14 -0000 1.16
***************
*** 80,83 ****
--- 80,95 ----
#define max(a,b) (((a)>(b))?(a):(b))
+ char *perfdata (const char *label,
+ long int val,
+ const char *uom,
+ int warnp,
+ long int warn,
+ int critp,
+ long int crit,
+ int minp,
+ long int minv,
+ int maxp,
+ long int 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
More information about the Commits
mailing list