diff options
Diffstat (limited to 'plugins/check_snmp.d/config.h')
| -rw-r--r-- | plugins/check_snmp.d/config.h | 81 |
1 files changed, 81 insertions, 0 deletions
diff --git a/plugins/check_snmp.d/config.h b/plugins/check_snmp.d/config.h new file mode 100644 index 00000000..e7b6d1b3 --- /dev/null +++ b/plugins/check_snmp.d/config.h | |||
| @@ -0,0 +1,81 @@ | |||
| 1 | #pragma once | ||
| 2 | |||
| 3 | #include "../../lib/thresholds.h" | ||
| 4 | #include "../../lib/states.h" | ||
| 5 | #include <stdlib.h> | ||
| 6 | #include <stdbool.h> | ||
| 7 | #include <regex.h> | ||
| 8 | #include "../common.h" | ||
| 9 | |||
| 10 | // defines for snmp libs | ||
| 11 | #define u_char unsigned char | ||
| 12 | #define u_long unsigned long | ||
| 13 | #define u_short unsigned short | ||
| 14 | #define u_int unsigned int | ||
| 15 | |||
| 16 | #include <net-snmp/net-snmp-config.h> | ||
| 17 | #include <net-snmp/net-snmp-includes.h> | ||
| 18 | #include <net-snmp/library/snmp.h> | ||
| 19 | #include <net-snmp/session_api.h> | ||
| 20 | |||
| 21 | #define DEFAULT_PORT "161" | ||
| 22 | #define DEFAULT_RETRIES 5 | ||
| 23 | |||
| 24 | typedef struct eval_method { | ||
| 25 | bool crit_string; | ||
| 26 | bool crit_regex; | ||
| 27 | } eval_method; | ||
| 28 | |||
| 29 | typedef struct check_snmp_test_unit { | ||
| 30 | char *oid; | ||
| 31 | char *label; | ||
| 32 | char *unit_value; | ||
| 33 | eval_method eval_mthd; | ||
| 34 | mp_thresholds threshold; | ||
| 35 | } check_snmp_test_unit; | ||
| 36 | |||
| 37 | typedef struct { | ||
| 38 | struct snmp_session snmp_session; | ||
| 39 | // use getnet instead of get | ||
| 40 | bool use_getnext; | ||
| 41 | |||
| 42 | // TODO actually make these useful | ||
| 43 | bool ignore_mib_parsing_errors; | ||
| 44 | bool need_mibs; | ||
| 45 | |||
| 46 | check_snmp_test_unit *test_units; | ||
| 47 | size_t num_of_test_units; | ||
| 48 | } check_snmp_config_snmp_parameters; | ||
| 49 | |||
| 50 | typedef struct { | ||
| 51 | // State if an empty value is encountered | ||
| 52 | mp_state_enum nulloid_result; | ||
| 53 | |||
| 54 | // String evaluation stuff | ||
| 55 | bool invert_search; | ||
| 56 | regex_t regex_cmp_value; // regex to match query results against | ||
| 57 | char string_cmp_value[MAX_INPUT_BUFFER]; | ||
| 58 | |||
| 59 | // Modify data | ||
| 60 | double multiplier; | ||
| 61 | bool multiplier_set; | ||
| 62 | double offset; | ||
| 63 | bool offset_set; | ||
| 64 | |||
| 65 | // Modify output | ||
| 66 | bool use_oid_as_perf_data_label; | ||
| 67 | |||
| 68 | // activate rate calculation | ||
| 69 | bool calculate_rate; | ||
| 70 | unsigned int rate_multiplier; | ||
| 71 | } check_snmp_evaluation_parameters; | ||
| 72 | |||
| 73 | typedef struct check_snmp_config { | ||
| 74 | // SNMP session to use | ||
| 75 | check_snmp_config_snmp_parameters snmp_params; | ||
| 76 | |||
| 77 | check_snmp_evaluation_parameters evaluation_params; | ||
| 78 | |||
| 79 | mp_output_format output_format; | ||
| 80 | bool output_format_is_set; | ||
| 81 | } check_snmp_config; | ||
