mirror of
https://github.com/monitoring-plugins/monitoring-plugins.git
synced 2026-05-28 04:35:40 -04:00
Fix types in perfdata functions
This commit is contained in:
parent
06fa1036f9
commit
065ed65a87
2 changed files with 220 additions and 164 deletions
243
plugins/utils.c
243
plugins/utils.c
|
|
@ -89,41 +89,46 @@ bool is_numeric(char *number) {
|
|||
char tmp[1];
|
||||
float x;
|
||||
|
||||
if (!number)
|
||||
if (!number) {
|
||||
return false;
|
||||
else if (sscanf(number, "%f%c", &x, tmp) == 1)
|
||||
} else if (sscanf(number, "%f%c", &x, tmp) == 1) {
|
||||
return true;
|
||||
else
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
bool is_positive(char *number) {
|
||||
if (is_numeric(number) && atof(number) > 0.0)
|
||||
if (is_numeric(number) && atof(number) > 0.0) {
|
||||
return true;
|
||||
else
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
bool is_negative(char *number) {
|
||||
if (is_numeric(number) && atof(number) < 0.0)
|
||||
if (is_numeric(number) && atof(number) < 0.0) {
|
||||
return true;
|
||||
else
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
bool is_nonnegative(char *number) {
|
||||
if (is_numeric(number) && atof(number) >= 0.0)
|
||||
if (is_numeric(number) && atof(number) >= 0.0) {
|
||||
return true;
|
||||
else
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
bool is_percentage(char *number) {
|
||||
int x;
|
||||
if (is_numeric(number) && (x = atof(number)) >= 0 && x <= 100)
|
||||
if (is_numeric(number) && (x = atof(number)) >= 0 && x <= 100) {
|
||||
return true;
|
||||
else
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
bool is_percentage_expression(const char str[]) {
|
||||
|
|
@ -156,36 +161,41 @@ bool is_percentage_expression(const char str[]) {
|
|||
bool is_integer(char *number) {
|
||||
long int n;
|
||||
|
||||
if (!number || (strspn(number, "-0123456789 ") != strlen(number)))
|
||||
if (!number || (strspn(number, "-0123456789 ") != strlen(number))) {
|
||||
return false;
|
||||
}
|
||||
|
||||
n = strtol(number, NULL, 10);
|
||||
|
||||
if (errno != ERANGE && n >= INT_MIN && n <= INT_MAX)
|
||||
if (errno != ERANGE && n >= INT_MIN && n <= INT_MAX) {
|
||||
return true;
|
||||
else
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
bool is_intpos(char *number) {
|
||||
if (is_integer(number) && atoi(number) > 0)
|
||||
if (is_integer(number) && atoi(number) > 0) {
|
||||
return true;
|
||||
else
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
bool is_intneg(char *number) {
|
||||
if (is_integer(number) && atoi(number) < 0)
|
||||
if (is_integer(number) && atoi(number) < 0) {
|
||||
return true;
|
||||
else
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
bool is_intnonneg(char *number) {
|
||||
if (is_integer(number) && atoi(number) >= 0)
|
||||
if (is_integer(number) && atoi(number) >= 0) {
|
||||
return true;
|
||||
else
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
@ -247,19 +257,21 @@ bool is_uint64(char *number, uint64_t *target) {
|
|||
|
||||
bool is_intpercent(char *number) {
|
||||
int i;
|
||||
if (is_integer(number) && (i = atoi(number)) >= 0 && i <= 100)
|
||||
if (is_integer(number) && (i = atoi(number)) >= 0 && i <= 100) {
|
||||
return true;
|
||||
else
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
bool is_option(char *str) {
|
||||
if (!str)
|
||||
if (!str) {
|
||||
return false;
|
||||
else if (strspn(str, "-") == 1 || strspn(str, "-") == 2)
|
||||
} else if (strspn(str, "-") == 1 || strspn(str, "-") == 2) {
|
||||
return true;
|
||||
else
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef NEED_GETTIMEOFDAY
|
||||
|
|
@ -288,10 +300,11 @@ void strip(char *buffer) {
|
|||
|
||||
for (x = strlen(buffer); x >= 1; x--) {
|
||||
i = x - 1;
|
||||
if (buffer[i] == ' ' || buffer[i] == '\r' || buffer[i] == '\n' || buffer[i] == '\t')
|
||||
if (buffer[i] == ' ' || buffer[i] == '\r' || buffer[i] == '\n' || buffer[i] == '\t') {
|
||||
buffer[i] = '\0';
|
||||
else
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
|
@ -309,8 +322,9 @@ void strip(char *buffer) {
|
|||
*****************************************************************************/
|
||||
|
||||
char *strscpy(char *dest, const char *src) {
|
||||
if (src == NULL)
|
||||
if (src == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
xasprintf(&dest, "%s", src);
|
||||
|
||||
|
|
@ -369,17 +383,21 @@ char *strscpy(char *dest, const char *src) {
|
|||
|
||||
char *strnl(char *str) {
|
||||
size_t len;
|
||||
if (str == NULL)
|
||||
if (str == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
str = strpbrk(str, "\r\n");
|
||||
if (str == NULL)
|
||||
if (str == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
len = strspn(str, "\r\n");
|
||||
if (str[len] == '\0')
|
||||
if (str[len] == '\0') {
|
||||
return NULL;
|
||||
}
|
||||
str += len;
|
||||
if (strlen(str) == 0)
|
||||
if (strlen(str) == 0) {
|
||||
return NULL;
|
||||
}
|
||||
return str;
|
||||
}
|
||||
|
||||
|
|
@ -402,15 +420,18 @@ char *strnl(char *str) {
|
|||
char *strpcpy(char *dest, const char *src, const char *str) {
|
||||
size_t len;
|
||||
|
||||
if (src)
|
||||
if (src) {
|
||||
len = strcspn(src, str);
|
||||
else
|
||||
} else {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (dest == NULL || strlen(dest) < len)
|
||||
if (dest == NULL || strlen(dest) < len) {
|
||||
dest = realloc(dest, len + 1);
|
||||
if (dest == NULL)
|
||||
}
|
||||
if (dest == NULL) {
|
||||
die(STATE_UNKNOWN, _("failed realloc in strpcpy\n"));
|
||||
}
|
||||
|
||||
strncpy(dest, src, len);
|
||||
dest[len] = '\0';
|
||||
|
|
@ -434,10 +455,11 @@ char *strpcpy(char *dest, const char *src, const char *str) {
|
|||
char *strpcat(char *dest, const char *src, const char *str) {
|
||||
size_t len, l2;
|
||||
|
||||
if (dest)
|
||||
if (dest) {
|
||||
len = strlen(dest);
|
||||
else
|
||||
} else {
|
||||
len = 0;
|
||||
}
|
||||
|
||||
if (src) {
|
||||
l2 = strcspn(src, str);
|
||||
|
|
@ -446,8 +468,9 @@ char *strpcat(char *dest, const char *src, const char *str) {
|
|||
}
|
||||
|
||||
dest = realloc(dest, len + l2 + 1);
|
||||
if (dest == NULL)
|
||||
if (dest == NULL) {
|
||||
die(STATE_UNKNOWN, _("failed malloc in strscat\n"));
|
||||
}
|
||||
|
||||
strncpy(dest + len, src, l2);
|
||||
dest[len + l2] = '\0';
|
||||
|
|
@ -463,8 +486,9 @@ char *strpcat(char *dest, const char *src, const char *str) {
|
|||
|
||||
int xvasprintf(char **strp, const char *fmt, va_list ap) {
|
||||
int result = vasprintf(strp, fmt, ap);
|
||||
if (result == -1 || *strp == NULL)
|
||||
if (result == -1 || *strp == NULL) {
|
||||
die(STATE_UNKNOWN, _("failed malloc in xvasprintf\n"));
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
|
|
@ -483,126 +507,145 @@ int xasprintf(char **strp, const char *fmt, ...) {
|
|||
*
|
||||
******************************************************************************/
|
||||
|
||||
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 *perfdata(const char *label, long int val, const char *uom, bool warnp, long int warn, bool critp, long int crit, bool minp,
|
||||
long int minv, bool maxp, long int maxv) {
|
||||
char *data = NULL;
|
||||
|
||||
if (strpbrk(label, "'= "))
|
||||
if (strpbrk(label, "'= ")) {
|
||||
xasprintf(&data, "'%s'=%ld%s;", label, val, uom);
|
||||
else
|
||||
} else {
|
||||
xasprintf(&data, "%s=%ld%s;", label, val, uom);
|
||||
}
|
||||
|
||||
if (warnp)
|
||||
if (warnp) {
|
||||
xasprintf(&data, "%s%ld;", data, warn);
|
||||
else
|
||||
} else {
|
||||
xasprintf(&data, "%s;", data);
|
||||
}
|
||||
|
||||
if (critp)
|
||||
if (critp) {
|
||||
xasprintf(&data, "%s%ld;", data, crit);
|
||||
else
|
||||
} else {
|
||||
xasprintf(&data, "%s;", data);
|
||||
}
|
||||
|
||||
if (minp)
|
||||
if (minp) {
|
||||
xasprintf(&data, "%s%ld;", data, minv);
|
||||
else
|
||||
} else {
|
||||
xasprintf(&data, "%s;", data);
|
||||
}
|
||||
|
||||
if (maxp)
|
||||
if (maxp) {
|
||||
xasprintf(&data, "%s%ld", data, maxv);
|
||||
}
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
char *perfdata_uint64(const char *label, uint64_t val, const char *uom, int warnp, /* Warning present */
|
||||
uint64_t warn, int critp, /* Critical present */
|
||||
uint64_t crit, int minp, /* Minimum present */
|
||||
uint64_t minv, int maxp, /* Maximum present */
|
||||
char *perfdata_uint64(const char *label, uint64_t val, const char *uom, bool warnp, /* Warning present */
|
||||
uint64_t warn, bool critp, /* Critical present */
|
||||
uint64_t crit, bool minp, /* Minimum present */
|
||||
uint64_t minv, bool maxp, /* Maximum present */
|
||||
uint64_t maxv) {
|
||||
char *data = NULL;
|
||||
|
||||
if (strpbrk(label, "'= "))
|
||||
if (strpbrk(label, "'= ")) {
|
||||
xasprintf(&data, "'%s'=%" PRIu64 "%s;", label, val, uom);
|
||||
else
|
||||
} else {
|
||||
xasprintf(&data, "%s=%" PRIu64 "%s;", label, val, uom);
|
||||
}
|
||||
|
||||
if (warnp)
|
||||
if (warnp) {
|
||||
xasprintf(&data, "%s%" PRIu64 ";", data, warn);
|
||||
else
|
||||
} else {
|
||||
xasprintf(&data, "%s;", data);
|
||||
}
|
||||
|
||||
if (critp)
|
||||
if (critp) {
|
||||
xasprintf(&data, "%s%" PRIu64 ";", data, crit);
|
||||
else
|
||||
} else {
|
||||
xasprintf(&data, "%s;", data);
|
||||
}
|
||||
|
||||
if (minp)
|
||||
if (minp) {
|
||||
xasprintf(&data, "%s%" PRIu64 ";", data, minv);
|
||||
else
|
||||
} else {
|
||||
xasprintf(&data, "%s;", data);
|
||||
}
|
||||
|
||||
if (maxp)
|
||||
if (maxp) {
|
||||
xasprintf(&data, "%s%" PRIu64, data, maxv);
|
||||
}
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
char *perfdata_int64(const char *label, int64_t val, const char *uom, int warnp, /* Warning present */
|
||||
int64_t warn, int critp, /* Critical present */
|
||||
int64_t crit, int minp, /* Minimum present */
|
||||
int64_t minv, int maxp, /* Maximum present */
|
||||
char *perfdata_int64(const char *label, int64_t val, const char *uom, bool warnp, /* Warning present */
|
||||
int64_t warn, bool critp, /* Critical present */
|
||||
int64_t crit, bool minp, /* Minimum present */
|
||||
int64_t minv, bool maxp, /* Maximum present */
|
||||
int64_t maxv) {
|
||||
char *data = NULL;
|
||||
|
||||
if (strpbrk(label, "'= "))
|
||||
if (strpbrk(label, "'= ")) {
|
||||
xasprintf(&data, "'%s'=%" PRId64 "%s;", label, val, uom);
|
||||
else
|
||||
} else {
|
||||
xasprintf(&data, "%s=%" PRId64 "%s;", label, val, uom);
|
||||
}
|
||||
|
||||
if (warnp)
|
||||
if (warnp) {
|
||||
xasprintf(&data, "%s%" PRId64 ";", data, warn);
|
||||
else
|
||||
} else {
|
||||
xasprintf(&data, "%s;", data);
|
||||
}
|
||||
|
||||
if (critp)
|
||||
if (critp) {
|
||||
xasprintf(&data, "%s%" PRId64 ";", data, crit);
|
||||
else
|
||||
} else {
|
||||
xasprintf(&data, "%s;", data);
|
||||
}
|
||||
|
||||
if (minp)
|
||||
if (minp) {
|
||||
xasprintf(&data, "%s%" PRId64 ";", data, minv);
|
||||
else
|
||||
} else {
|
||||
xasprintf(&data, "%s;", data);
|
||||
}
|
||||
|
||||
if (maxp)
|
||||
if (maxp) {
|
||||
xasprintf(&data, "%s%" PRId64, data, maxv);
|
||||
}
|
||||
|
||||
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 *fperfdata(const char *label, double val, const char *uom, bool warnp, double warn, bool critp, double crit, bool minp, double minv,
|
||||
bool maxp, double maxv) {
|
||||
char *data = NULL;
|
||||
|
||||
if (strpbrk(label, "'= "))
|
||||
if (strpbrk(label, "'= ")) {
|
||||
xasprintf(&data, "'%s'=", label);
|
||||
else
|
||||
} else {
|
||||
xasprintf(&data, "%s=", label);
|
||||
}
|
||||
|
||||
xasprintf(&data, "%s%f", data, val);
|
||||
xasprintf(&data, "%s%s;", data, uom);
|
||||
|
||||
if (warnp)
|
||||
if (warnp) {
|
||||
xasprintf(&data, "%s%f", data, warn);
|
||||
}
|
||||
|
||||
xasprintf(&data, "%s;", data);
|
||||
|
||||
if (critp)
|
||||
if (critp) {
|
||||
xasprintf(&data, "%s%f", data, crit);
|
||||
}
|
||||
|
||||
xasprintf(&data, "%s;", data);
|
||||
|
||||
if (minp)
|
||||
if (minp) {
|
||||
xasprintf(&data, "%s%f", data, minv);
|
||||
}
|
||||
|
||||
if (maxp) {
|
||||
xasprintf(&data, "%s;", data);
|
||||
|
|
@ -612,28 +655,32 @@ char *fperfdata(const char *label, double val, const char *uom, int warnp, doubl
|
|||
return data;
|
||||
}
|
||||
|
||||
char *sperfdata(const char *label, double val, const char *uom, char *warn, char *crit, int minp, double minv, int maxp, double maxv) {
|
||||
char *sperfdata(const char *label, double val, const char *uom, char *warn, char *crit, bool minp, double minv, bool maxp, double maxv) {
|
||||
char *data = NULL;
|
||||
if (strpbrk(label, "'= "))
|
||||
if (strpbrk(label, "'= ")) {
|
||||
xasprintf(&data, "'%s'=", label);
|
||||
else
|
||||
} else {
|
||||
xasprintf(&data, "%s=", label);
|
||||
}
|
||||
|
||||
xasprintf(&data, "%s%f", data, val);
|
||||
xasprintf(&data, "%s%s;", data, uom);
|
||||
|
||||
if (warn != NULL)
|
||||
if (warn != NULL) {
|
||||
xasprintf(&data, "%s%s", data, warn);
|
||||
}
|
||||
|
||||
xasprintf(&data, "%s;", data);
|
||||
|
||||
if (crit != NULL)
|
||||
if (crit != NULL) {
|
||||
xasprintf(&data, "%s%s", data, crit);
|
||||
}
|
||||
|
||||
xasprintf(&data, "%s;", data);
|
||||
|
||||
if (minp)
|
||||
if (minp) {
|
||||
xasprintf(&data, "%s%f", data, minv);
|
||||
}
|
||||
|
||||
if (maxp) {
|
||||
xasprintf(&data, "%s;", data);
|
||||
|
|
@ -643,28 +690,32 @@ char *sperfdata(const char *label, double val, const char *uom, char *warn, char
|
|||
return data;
|
||||
}
|
||||
|
||||
char *sperfdata_int(const char *label, int val, const char *uom, char *warn, char *crit, int minp, int minv, int maxp, int maxv) {
|
||||
char *sperfdata_int(const char *label, int val, const char *uom, char *warn, char *crit, bool minp, int minv, bool maxp, int maxv) {
|
||||
char *data = NULL;
|
||||
if (strpbrk(label, "'= "))
|
||||
if (strpbrk(label, "'= ")) {
|
||||
xasprintf(&data, "'%s'=", label);
|
||||
else
|
||||
} else {
|
||||
xasprintf(&data, "%s=", label);
|
||||
}
|
||||
|
||||
xasprintf(&data, "%s%d", data, val);
|
||||
xasprintf(&data, "%s%s;", data, uom);
|
||||
|
||||
if (warn != NULL)
|
||||
if (warn != NULL) {
|
||||
xasprintf(&data, "%s%s", data, warn);
|
||||
}
|
||||
|
||||
xasprintf(&data, "%s;", data);
|
||||
|
||||
if (crit != NULL)
|
||||
if (crit != NULL) {
|
||||
xasprintf(&data, "%s%s", data, crit);
|
||||
}
|
||||
|
||||
xasprintf(&data, "%s;", data);
|
||||
|
||||
if (minp)
|
||||
if (minp) {
|
||||
xasprintf(&data, "%s%d", data, minv);
|
||||
}
|
||||
|
||||
if (maxp) {
|
||||
xasprintf(&data, "%s;", data);
|
||||
|
|
|
|||
141
plugins/utils.h
141
plugins/utils.h
|
|
@ -21,43 +21,43 @@ suite of plugins. */
|
|||
|
||||
#ifdef NP_EXTRA_OPTS
|
||||
/* Include extra-opts functions if compiled in */
|
||||
#include "extra_opts.h"
|
||||
# include "extra_opts.h"
|
||||
#else
|
||||
/* else, fake np_extra_opts */
|
||||
#define np_extra_opts(acptr,av,pr) av
|
||||
# define np_extra_opts(acptr, av, pr) av
|
||||
#endif
|
||||
|
||||
/* Standardize version information, termination */
|
||||
|
||||
void support (void);
|
||||
void print_revision (const char *, const char *);
|
||||
void support(void);
|
||||
void print_revision(const char *, const char *);
|
||||
|
||||
extern time_t start_time, end_time;
|
||||
|
||||
/* Test input types */
|
||||
|
||||
bool is_integer (char *);
|
||||
bool is_intpos (char *);
|
||||
bool is_intneg (char *);
|
||||
bool is_intnonneg (char *);
|
||||
bool is_intpercent (char *);
|
||||
bool is_integer(char *);
|
||||
bool is_intpos(char *);
|
||||
bool is_intneg(char *);
|
||||
bool is_intnonneg(char *);
|
||||
bool is_intpercent(char *);
|
||||
bool is_uint64(char *number, uint64_t *target);
|
||||
bool is_int64(char *number, int64_t *target);
|
||||
|
||||
bool is_numeric (char *);
|
||||
bool is_positive (char *);
|
||||
bool is_negative (char *);
|
||||
bool is_nonnegative (char *);
|
||||
bool is_percentage (char *);
|
||||
bool is_percentage_expression (const char[]);
|
||||
bool is_numeric(char *);
|
||||
bool is_positive(char *);
|
||||
bool is_negative(char *);
|
||||
bool is_nonnegative(char *);
|
||||
bool is_percentage(char *);
|
||||
bool is_percentage_expression(const char[]);
|
||||
|
||||
bool is_option (char *);
|
||||
bool is_option(char *);
|
||||
|
||||
/* Generalized timer that will do milliseconds if available */
|
||||
#ifndef HAVE_STRUCT_TIMEVAL
|
||||
struct timeval {
|
||||
long tv_sec; /* seconds */
|
||||
long tv_usec; /* microseconds */
|
||||
long tv_sec; /* seconds */
|
||||
long tv_usec; /* microseconds */
|
||||
};
|
||||
#endif
|
||||
|
||||
|
|
@ -65,137 +65,142 @@ struct timeval {
|
|||
int gettimeofday(struct timeval *, struct timezone *);
|
||||
#endif
|
||||
|
||||
double delta_time (struct timeval tv);
|
||||
long deltime (struct timeval tv);
|
||||
double delta_time(struct timeval tv);
|
||||
long deltime(struct timeval tv);
|
||||
|
||||
/* Handle strings safely */
|
||||
|
||||
void strip (char *);
|
||||
char *strscpy (char *, const char *);
|
||||
char *strnl (char *);
|
||||
char *strpcpy (char *, const char *, const char *);
|
||||
char *strpcat (char *, const char *, const char *);
|
||||
int xvasprintf (char **strp, const char *fmt, va_list ap);
|
||||
int xasprintf (char **strp, const char *fmt, ...);
|
||||
void strip(char *);
|
||||
char *strscpy(char *, const char *);
|
||||
char *strnl(char *);
|
||||
char *strpcpy(char *, const char *, const char *);
|
||||
char *strpcat(char *, const char *, const char *);
|
||||
int xvasprintf(char **strp, const char *fmt, va_list ap);
|
||||
int xasprintf(char **strp, const char *fmt, ...);
|
||||
|
||||
void usage (const char *) __attribute__((noreturn));
|
||||
void usage(const char *) __attribute__((noreturn));
|
||||
void usage2(const char *, const char *) __attribute__((noreturn));
|
||||
void usage3(const char *, int) __attribute__((noreturn));
|
||||
void usage4(const char *) __attribute__((noreturn));
|
||||
void usage5(void) __attribute__((noreturn));
|
||||
void usage_va(const char *fmt, ...) __attribute__((noreturn));
|
||||
|
||||
#define max(a,b) (((a)>(b))?(a):(b))
|
||||
#define min(a,b) (((a)<(b))?(a):(b))
|
||||
#define max(a, b) (((a) > (b)) ? (a) : (b))
|
||||
#define min(a, b) (((a) < (b)) ? (a) : (b))
|
||||
|
||||
char *perfdata (const char *, long int, const char *, int, long int,
|
||||
int, long int, int, long int, int, long int);
|
||||
char *perfdata(const char *, long int, const char *, bool, long int, bool, long int, bool, long int, bool, long int);
|
||||
|
||||
char *perfdata_uint64 (const char *, uint64_t , const char *, int, uint64_t,
|
||||
int, uint64_t, int, uint64_t, int, uint64_t);
|
||||
char *perfdata_uint64(const char *, uint64_t, const char *, bool, uint64_t, bool, uint64_t, bool, uint64_t, bool, uint64_t);
|
||||
|
||||
char *perfdata_int64 (const char *, int64_t, const char *, int, int64_t,
|
||||
int, int64_t, int, int64_t, int, int64_t);
|
||||
char *perfdata_int64(const char *, int64_t, const char *, bool, int64_t, bool, int64_t, bool, int64_t, bool, int64_t);
|
||||
|
||||
char *fperfdata (const char *, double, const char *, int, double,
|
||||
int, double, int, double, int, double);
|
||||
char *fperfdata(const char *, double, const char *, bool, double, bool, double, bool, double, bool, double);
|
||||
|
||||
char *sperfdata (const char *, double, const char *, char *, char *,
|
||||
int, double, int, double);
|
||||
char *sperfdata(const char *, double, const char *, char *, char *, bool, double, bool, double);
|
||||
|
||||
char *sperfdata_int (const char *, int, const char *, char *, char *,
|
||||
int, int, int, int);
|
||||
char *sperfdata_int(const char *, int, const char *, char *, char *, bool, int, bool, int);
|
||||
|
||||
/* The idea here is that, although not every plugin will use all of these,
|
||||
most will or should. Therefore, for consistency, these very common
|
||||
/* 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 */
|
||||
|
||||
#define STD_LONG_OPTS \
|
||||
{"version",no_argument,0,'V'},\
|
||||
{"verbose",no_argument,0,'v'},\
|
||||
{"help",no_argument,0,'h'},\
|
||||
{"timeout",required_argument,0,'t'},\
|
||||
{"critical",required_argument,0,'c'},\
|
||||
{"warning",required_argument,0,'w'},\
|
||||
{"hostname",required_argument,0,'H'}
|
||||
#define STD_LONG_OPTS \
|
||||
{"version", no_argument, 0, 'V'}, {"verbose", no_argument, 0, 'v'}, {"help", no_argument, 0, 'h'}, \
|
||||
{"timeout", required_argument, 0, 't'}, {"critical", required_argument, 0, 'c'}, {"warning", required_argument, 0, 'w'}, \
|
||||
{"hostname", required_argument, 0, 'H'}
|
||||
|
||||
#define COPYRIGHT "Copyright (c) %s Monitoring Plugins Development Team\n\
|
||||
#define COPYRIGHT \
|
||||
"Copyright (c) %s Monitoring Plugins Development Team\n\
|
||||
\t<%s>\n\n"
|
||||
|
||||
#define UT_HLP_VRS _("\
|
||||
#define UT_HLP_VRS \
|
||||
_("\
|
||||
%s (-h | --help) for detailed help\n\
|
||||
%s (-V | --version) for version information\n")
|
||||
|
||||
#define UT_HELP_VRSN _("\
|
||||
#define UT_HELP_VRSN \
|
||||
_("\
|
||||
\nOptions:\n\
|
||||
-h, --help\n\
|
||||
Print detailed help screen\n\
|
||||
-V, --version\n\
|
||||
Print version information\n")
|
||||
|
||||
#define UT_HOST_PORT _("\
|
||||
#define UT_HOST_PORT \
|
||||
_("\
|
||||
-H, --hostname=ADDRESS\n\
|
||||
Host name, IP Address, or unix socket (must be an absolute path)\n\
|
||||
-%c, --port=INTEGER\n\
|
||||
Port number (default: %s)\n")
|
||||
|
||||
#define UT_IPv46 _("\
|
||||
#define UT_IPv46 \
|
||||
_("\
|
||||
-4, --use-ipv4\n\
|
||||
Use IPv4 connection\n\
|
||||
-6, --use-ipv6\n\
|
||||
Use IPv6 connection\n")
|
||||
|
||||
#define UT_VERBOSE _("\
|
||||
#define UT_VERBOSE \
|
||||
_("\
|
||||
-v, --verbose\n\
|
||||
Show details for command-line debugging (output may be truncated by\n\
|
||||
the monitoring system)\n")
|
||||
|
||||
#define UT_WARN_CRIT _("\
|
||||
#define UT_WARN_CRIT \
|
||||
_("\
|
||||
-w, --warning=DOUBLE\n\
|
||||
Response time to result in warning status (seconds)\n\
|
||||
-c, --critical=DOUBLE\n\
|
||||
Response time to result in critical status (seconds)\n")
|
||||
|
||||
#define UT_WARN_CRIT_RANGE _("\
|
||||
#define UT_WARN_CRIT_RANGE \
|
||||
_("\
|
||||
-w, --warning=RANGE\n\
|
||||
Warning range (format: start:end). Alert if outside this range\n\
|
||||
-c, --critical=RANGE\n\
|
||||
Critical range\n")
|
||||
|
||||
#define UT_CONN_TIMEOUT _("\
|
||||
#define UT_CONN_TIMEOUT \
|
||||
_("\
|
||||
-t, --timeout=INTEGER\n\
|
||||
Seconds before connection times out (default: %d)\n")
|
||||
|
||||
#define UT_PLUG_TIMEOUT _("\
|
||||
#define UT_PLUG_TIMEOUT \
|
||||
_("\
|
||||
-t, --timeout=INTEGER\n\
|
||||
Seconds before plugin times out (default: %d)\n")
|
||||
|
||||
#ifdef NP_EXTRA_OPTS
|
||||
#define UT_EXTRA_OPTS _("\
|
||||
# define UT_EXTRA_OPTS \
|
||||
_("\
|
||||
--extra-opts=[section][@file]\n\
|
||||
Read options from an ini file. See\n\
|
||||
https://www.monitoring-plugins.org/doc/extra-opts.html\n\
|
||||
for usage and examples.\n")
|
||||
#else
|
||||
#define UT_EXTRA_OPTS " \b"
|
||||
# define UT_EXTRA_OPTS " \b"
|
||||
#endif
|
||||
|
||||
#define UT_THRESHOLDS_NOTES _("\
|
||||
#define UT_THRESHOLDS_NOTES \
|
||||
_("\
|
||||
See:\n\
|
||||
https://www.monitoring-plugins.org/doc/guidelines.html#THRESHOLDFORMAT\n\
|
||||
for THRESHOLD format and examples.\n")
|
||||
|
||||
#define UT_SUPPORT _("\n\
|
||||
#define UT_SUPPORT \
|
||||
_("\n\
|
||||
Send email to help@monitoring-plugins.org if you have questions regarding\n\
|
||||
use of this software. To submit patches or suggest improvements, send email\n\
|
||||
to devel@monitoring-plugins.org\n\n")
|
||||
|
||||
#define UT_NOWARRANTY _("\n\
|
||||
#define UT_NOWARRANTY \
|
||||
_("\n\
|
||||
The Monitoring Plugins come with ABSOLUTELY NO WARRANTY. You may redistribute\n\
|
||||
copies of the plugins under the terms of the GNU General Public License.\n\
|
||||
For more information about these matters, see the file named COPYING.\n")
|
||||
|
||||
#define UT_OUTPUT_FORMAT _("\
|
||||
#define UT_OUTPUT_FORMAT \
|
||||
_("\
|
||||
--output-format=OUTPUT_FORMAT\n\
|
||||
Select output format. Valid values: \"multi-line\", \"mp-test-json\"\n")
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue