mirror of
https://github.com/monitoring-plugins/monitoring-plugins.git
synced 2026-04-15 22:00:06 -04:00
add perfdata function for floats to complement ints, also spell fix "received"
git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/trunk@817 f882894a-f735-0410-b71e-b25c423dba1c
This commit is contained in:
parent
01a27016b7
commit
7ba54264fb
2 changed files with 51 additions and 0 deletions
|
|
@ -544,3 +544,42 @@ char *perfdata (const char *label,
|
|||
|
||||
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;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -92,6 +92,18 @@ char *perfdata (const char *label,
|
|||
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 */
|
||||
|
|
|
|||
Loading…
Reference in a new issue