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.h51
1 files changed, 12 insertions, 39 deletions
diff --git a/lib/utils_base.h b/lib/utils_base.h
index a209cb6d..27884bf0 100644
--- a/lib/utils_base.h
+++ b/lib/utils_base.h
@@ -2,6 +2,13 @@
2#define _UTILS_BASE_ 2#define _UTILS_BASE_
3/* Header file for Monitoring Plugins utils_base.c */ 3/* Header file for Monitoring Plugins utils_base.c */
4 4
5#include "../config.h"
6#include <time.h>
7
8#include "./perfdata.h"
9#include "./thresholds.h"
10#include "states.h"
11
5#ifndef USE_OPENSSL 12#ifndef USE_OPENSSL
6# include "sha256.h" 13# include "sha256.h"
7#endif 14#endif
@@ -19,39 +26,8 @@
19#define OUTSIDE 0 26#define OUTSIDE 0
20#define INSIDE 1 27#define INSIDE 1
21 28
22typedef struct range_struct {
23 double start;
24 bool start_infinity;
25 double end;
26 int end_infinity;
27 int alert_on; /* OUTSIDE (default) or INSIDE */
28 char *text; /* original unparsed text input */
29} range;
30
31typedef struct thresholds_struct {
32 range *warning;
33 range *critical;
34} thresholds;
35
36#define NP_STATE_FORMAT_VERSION 1
37
38typedef struct state_data_struct {
39 time_t time;
40 void *data;
41 int length; /* Of binary data */
42} state_data;
43
44typedef struct state_key_struct {
45 char *name;
46 char *plugin_name;
47 int data_version;
48 char *_filename;
49 state_data *state_data;
50} state_key;
51
52typedef struct np_struct { 29typedef struct np_struct {
53 char *plugin_name; 30 char *plugin_name;
54 state_key *state;
55 int argc; 31 int argc;
56 char **argv; 32 char **argv;
57} monitoring_plugin; 33} monitoring_plugin;
@@ -61,10 +37,11 @@ int _set_thresholds(thresholds **, char *, char *);
61void set_thresholds(thresholds **, char *, char *); 37void set_thresholds(thresholds **, char *, char *);
62void print_thresholds(const char *, thresholds *); 38void print_thresholds(const char *, thresholds *);
63bool check_range(double, range *); 39bool check_range(double, range *);
64int get_status(double, thresholds *); 40bool mp_check_range(mp_perfdata_value, mp_range);
41mp_state_enum get_status(double, thresholds *);
65 42
66/* Handle timeouts */ 43/* Handle timeouts */
67extern int timeout_state; 44extern mp_state_enum timeout_state;
68extern unsigned int timeout_interval; 45extern unsigned int timeout_interval;
69 46
70/* All possible characters in a threshold range */ 47/* All possible characters in a threshold range */
@@ -106,13 +83,9 @@ char *np_extract_value(const char *, const char *, char);
106 */ 83 */
107int mp_translate_state(char *); 84int mp_translate_state(char *);
108 85
109void np_enable_state(char *, int);
110state_data *np_state_read();
111void np_state_write_string(time_t, char *);
112
113void np_init(char *, int argc, char **argv); 86void np_init(char *, int argc, char **argv);
114void np_set_args(int argc, char **argv); 87void np_set_args(int argc, char **argv);
115void np_cleanup(); 88void np_cleanup(void);
116const char *state_text(int); 89const char *state_text(mp_state_enum);
117 90
118#endif /* _UTILS_BASE_ */ 91#endif /* _UTILS_BASE_ */