summaryrefslogtreecommitdiffstats
path: root/lib/utils_base.h
diff options
context:
space:
mode:
Diffstat (limited to 'lib/utils_base.h')
-rw-r--r--lib/utils_base.h15
1 files changed, 12 insertions, 3 deletions
diff --git a/lib/utils_base.h b/lib/utils_base.h
index 0cb371f..d69b0da 100644
--- a/lib/utils_base.h
+++ b/lib/utils_base.h
@@ -1,6 +1,6 @@
1#ifndef _UTILS_BASE_ 1#ifndef _UTILS_BASE_
2#define _UTILS_BASE_ 2#define _UTILS_BASE_
3/* Header file for nagios plugins utils_base.c */ 3/* Header file for Monitoring Plugins utils_base.c */
4 4
5#include "sha1.h" 5#include "sha1.h"
6 6
@@ -52,7 +52,7 @@ typedef struct np_struct {
52 state_key *state; 52 state_key *state;
53 int argc; 53 int argc;
54 char **argv; 54 char **argv;
55 } nagios_plugin; 55 } monitoring_plugin;
56 56
57range *parse_range_string (char *); 57range *parse_range_string (char *);
58int _set_thresholds(thresholds **, char *, char *); 58int _set_thresholds(thresholds **, char *, char *);
@@ -62,7 +62,7 @@ int check_range(double, range *);
62int get_status(double, thresholds *); 62int get_status(double, thresholds *);
63 63
64/* All possible characters in a threshold range */ 64/* All possible characters in a threshold range */
65#define NP_THRESHOLDS_CHARS "0123456789.:@~" 65#define NP_THRESHOLDS_CHARS "-0123456789.:@~"
66 66
67char *np_escaped_string (const char *); 67char *np_escaped_string (const char *);
68 68
@@ -79,6 +79,10 @@ int np_check_if_root(void);
79 * code from the above function, in case it's helpful for testing */ 79 * code from the above function, in case it's helpful for testing */
80int np_warn_if_not_root(void); 80int np_warn_if_not_root(void);
81 81
82/* mp_suid() returns true if the real and effective uids differs, such as when
83 * running a suid plugin */
84#define mp_suid() (getuid() != geteuid())
85
82/* 86/*
83 * Extract the value from key/value pairs, or return NULL. The value returned 87 * Extract the value from key/value pairs, or return NULL. The value returned
84 * can be free()ed. 88 * can be free()ed.
@@ -93,6 +97,11 @@ char *np_extract_value(const char*, const char*, char);
93 */ 97 */
94#define np_extract_ntpvar(l, n) np_extract_value(l, n, ',') 98#define np_extract_ntpvar(l, n) np_extract_value(l, n, ',')
95 99
100/*
101 * Read a string representing a state (ok, warning... or numeric: 0, 1) and
102 * return the corresponding NP_STATE or ERROR)
103 */
104int mp_translate_state (char *);
96 105
97void np_enable_state(char *, int); 106void np_enable_state(char *, int);
98state_data *np_state_read(); 107state_data *np_state_read();