diff options
author | Ton Voon <ton.voon@opsera.com> | 2010-06-17 10:16:43 +0100 |
---|---|---|
committer | tonvoon <ton.voon@opsera.com> | 2010-06-23 13:30:34 +0000 |
commit | 18f6835edaf7d640a2c9e476cb1babdbdadbfd9b (patch) | |
tree | ae11f40e48dc34658445c99012726f32bfb45c56 /lib/utils_base.h | |
parent | f61412478ceb7c821793c8356b936f64066508bf (diff) | |
download | monitoring-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.h | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/lib/utils_base.h b/lib/utils_base.h index 49e40a63..0cb371fd 100644 --- a/lib/utils_base.h +++ b/lib/utils_base.h @@ -2,6 +2,8 @@ #define _UTILS_BASE_ /* Header file for nagios plugins utils_base.c */ +#include "sha1.h" + /* This file holds header information for thresholds - use this in preference to individual plugin logic */ @@ -28,6 +30,30 @@ typedef struct thresholds_struct { range *critical; } thresholds; +#define NP_STATE_FORMAT_VERSION 1 + +typedef struct state_data_struct { + time_t time; + void *data; + int length; /* Of binary data */ + } state_data; + + +typedef struct state_key_struct { + char *name; + char *plugin_name; + int data_version; + char *_filename; + state_data *state_data; + } state_key; + +typedef struct np_struct { + char *plugin_name; + state_key *state; + int argc; + char **argv; + } nagios_plugin; + range *parse_range_string (char *); int _set_thresholds(thresholds **, char *, char *); void set_thresholds(thresholds **, char *, char *); @@ -67,4 +93,13 @@ char *np_extract_value(const char*, const char*, char); */ #define np_extract_ntpvar(l, n) np_extract_value(l, n, ',') + +void np_enable_state(char *, int); +state_data *np_state_read(); +void np_state_write_string(time_t, char *); + +void np_init(char *, int argc, char **argv); +void np_set_args(int argc, char **argv); +void np_cleanup(); + #endif /* _UTILS_BASE_ */ |