[Nagiosplug-checkins] CVS: nagiosplug/plugins utils.c,1.35,1.36 utils.h,1.18,1.19
Karl DeBisschop
kdebisschop at users.sourceforge.net
Thu Feb 19 21:33:03 CET 2004
- Previous message: [Nagiosplug-checkins] CVS: nagiosplug AUTHORS,1.22,1.23
- Next message: [Nagiosplug-checkins] CVS: nagiosplug/plugins check_snmp.c,1.36,1.37 negate.c,1.13,1.14 netutils.c,1.15,1.16 urlize.c,1.9,1.10
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
Update of /cvsroot/nagiosplug/nagiosplug/plugins
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25228
Modified Files:
utils.c utils.h
Log Message:
add perfdata function for floats to complement ints, also spell fix "received"
Index: utils.c
===================================================================
RCS file: /cvsroot/nagiosplug/nagiosplug/plugins/utils.c,v
retrieving revision 1.35
retrieving revision 1.36
diff -C2 -r1.35 -r1.36
*** utils.c 28 Aug 2003 03:53:12 -0000 1.35
--- utils.c 20 Feb 2004 05:21:21 -0000 1.36
***************
*** 545,546 ****
--- 545,585 ----
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;
+ }
Index: utils.h
===================================================================
RCS file: /cvsroot/nagiosplug/nagiosplug/plugins/utils.h,v
retrieving revision 1.18
retrieving revision 1.19
diff -C2 -r1.18 -r1.19
*** utils.h 10 Nov 2003 11:15:23 -0000 1.18
--- utils.h 20 Feb 2004 05:21:21 -0000 1.19
***************
*** 93,96 ****
--- 93,108 ----
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
- Previous message: [Nagiosplug-checkins] CVS: nagiosplug AUTHORS,1.22,1.23
- Next message: [Nagiosplug-checkins] CVS: nagiosplug/plugins check_snmp.c,1.36,1.37 negate.c,1.13,1.14 netutils.c,1.15,1.16 urlize.c,1.9,1.10
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
More information about the Commits
mailing list