3 /* Header file for nagios plugins utils_base.c */
5 /* This file holds header information for thresholds - use this in preference to
6 individual plugin logic */
8 /* This has not been merged with utils.h because of problems with
9 timeout_interval when other utils_*.h files use utils.h */
11 /* Long term, add new functions to utils_base.h for common routines
12 and utils_*.h for specific to plugin routines. If routines are
13 placed in utils_*.h, then these can be tested with libtap */
18 typedef struct range_struct
{
20 int start_infinity
; /* FALSE (default) or TRUE */
23 int alert_on
; /* OUTSIDE (default) or INSIDE */
26 typedef struct thresholds_struct
{
31 range
*parse_range_string (char *);
32 int _set_thresholds(thresholds
**, char *, char *);
33 void set_thresholds(thresholds
**, char *, char *);
34 void print_thresholds(const char *, thresholds
*);
35 int check_range(double, range
*);
36 int get_status(double, thresholds
*);
38 char *np_escaped_string (const char *);
40 void die (int, const char *, ...) __attribute__((noreturn
,format(printf
, 2, 3)));
42 /* Return codes for _set_thresholds */
43 #define NP_RANGE_UNPARSEABLE 1
44 #define NP_WARN_WITHIN_CRIT 2
46 /* a simple check to see if we're running as root.
47 * returns zero on failure, nonzero on success */
48 int np_check_if_root(void);
49 /* and a helpful wrapper around that. it returns the same status
50 * code from the above function, in case it's helpful for testing */
51 int np_warn_if_not_root(void);
53 #endif /* _UTILS_BASE_ */