summaryrefslogtreecommitdiffstats
path: root/lib/utils_base.h
diff options
context:
space:
mode:
authorTon Voon <ton.voon@opsera.com>2010-06-17 09:16:43 (GMT)
committertonvoon <ton.voon@opsera.com>2010-06-23 13:30:34 (GMT)
commit18f6835edaf7d640a2c9e476cb1babdbdadbfd9b (patch)
treeae11f40e48dc34658445c99012726f32bfb45c56 /lib/utils_base.h
parentf61412478ceb7c821793c8356b936f64066508bf (diff)
downloadmonitoring-plugins-18f6835edaf7d640a2c9e476cb1babdbdadbfd9b.tar.gz
Added state retention APIs. Implemented for check_snmp with --rate option.
See http://nagiosplugin.org/c-api-private for more details on the API. Also updated check_snmp -l option to change the perfdata label.
Diffstat (limited to 'lib/utils_base.h')
-rw-r--r--lib/utils_base.h35
1 files changed, 35 insertions, 0 deletions
diff --git a/lib/utils_base.h b/lib/utils_base.h
index 49e40a6..0cb371f 100644
--- a/lib/utils_base.h
+++ b/lib/utils_base.h
@@ -2,6 +2,8 @@
2#define _UTILS_BASE_ 2#define _UTILS_BASE_
3/* Header file for nagios plugins utils_base.c */ 3/* Header file for nagios plugins utils_base.c */
4 4
5#include "sha1.h"
6
5/* This file holds header information for thresholds - use this in preference to 7/* This file holds header information for thresholds - use this in preference to
6 individual plugin logic */ 8 individual plugin logic */
7 9
@@ -28,6 +30,30 @@ typedef struct thresholds_struct {
28 range *critical; 30 range *critical;
29 } thresholds; 31 } thresholds;
30 32
33#define NP_STATE_FORMAT_VERSION 1
34
35typedef struct state_data_struct {
36 time_t time;
37 void *data;
38 int length; /* Of binary data */
39 } state_data;
40
41
42typedef struct state_key_struct {
43 char *name;
44 char *plugin_name;
45 int data_version;
46 char *_filename;
47 state_data *state_data;
48 } state_key;
49
50typedef struct np_struct {
51 char *plugin_name;
52 state_key *state;
53 int argc;
54 char **argv;
55 } nagios_plugin;
56
31range *parse_range_string (char *); 57range *parse_range_string (char *);
32int _set_thresholds(thresholds **, char *, char *); 58int _set_thresholds(thresholds **, char *, char *);
33void set_thresholds(thresholds **, char *, char *); 59void set_thresholds(thresholds **, char *, char *);
@@ -67,4 +93,13 @@ char *np_extract_value(const char*, const char*, char);
67 */ 93 */
68#define np_extract_ntpvar(l, n) np_extract_value(l, n, ',') 94#define np_extract_ntpvar(l, n) np_extract_value(l, n, ',')
69 95
96
97void np_enable_state(char *, int);
98state_data *np_state_read();
99void np_state_write_string(time_t, char *);
100
101void np_init(char *, int argc, char **argv);
102void np_set_args(int argc, char **argv);
103void np_cleanup();
104
70#endif /* _UTILS_BASE_ */ 105#endif /* _UTILS_BASE_ */