diff options
| author | Lorenz Kästle <12514511+RincewindsHat@users.noreply.github.com> | 2025-03-11 12:12:32 +0100 |
|---|---|---|
| committer | Lorenz Kästle <12514511+RincewindsHat@users.noreply.github.com> | 2025-03-11 12:12:32 +0100 |
| commit | 7a518f99a57a6ee169cedd062e4e2e1e7c3fc2d2 (patch) | |
| tree | 6b7eee63a99f8ecb1f20fa20c3e2baa3437099c2 /plugins/check_ldap.d/config.h | |
| parent | 590c190bd88d5907b9e649fc45f8d8997227c4c4 (diff) | |
| download | monitoring-plugins-7a518f99a57a6ee169cedd062e4e2e1e7c3fc2d2.tar.gz | |
Refactor check_ldap
Diffstat (limited to 'plugins/check_ldap.d/config.h')
| -rw-r--r-- | plugins/check_ldap.d/config.h | 61 |
1 files changed, 61 insertions, 0 deletions
diff --git a/plugins/check_ldap.d/config.h b/plugins/check_ldap.d/config.h new file mode 100644 index 00000000..97a9cfa7 --- /dev/null +++ b/plugins/check_ldap.d/config.h | |||
| @@ -0,0 +1,61 @@ | |||
| 1 | #pragma once | ||
| 2 | |||
| 3 | #include "../../config.h" | ||
| 4 | #include "thresholds.h" | ||
| 5 | #include <mysql/udf_registration_types.h> | ||
| 6 | #include <stddef.h> | ||
| 7 | |||
| 8 | static char ld_defattr[] = "(objectclass=*)"; | ||
| 9 | |||
| 10 | enum { | ||
| 11 | #ifdef HAVE_LDAP_SET_OPTION | ||
| 12 | DEFAULT_PROTOCOL = 2, | ||
| 13 | #endif | ||
| 14 | }; | ||
| 15 | |||
| 16 | typedef struct { | ||
| 17 | char *ld_host; | ||
| 18 | char *ld_base; | ||
| 19 | char *ld_passwd; | ||
| 20 | char *ld_binddn; | ||
| 21 | char *ld_attr; | ||
| 22 | int ld_port; | ||
| 23 | bool starttls; | ||
| 24 | bool ssl_on_connect; | ||
| 25 | #ifdef HAVE_LDAP_SET_OPTION | ||
| 26 | int ld_protocol; | ||
| 27 | #endif | ||
| 28 | |||
| 29 | char *warn_entries; | ||
| 30 | char *crit_entries; | ||
| 31 | thresholds *entries_thresholds; | ||
| 32 | bool warn_time_set; | ||
| 33 | double warn_time; | ||
| 34 | bool crit_time_set; | ||
| 35 | double crit_time; | ||
| 36 | } check_ldap_config; | ||
| 37 | |||
| 38 | check_ldap_config check_ldap_config_init() { | ||
| 39 | check_ldap_config tmp = { | ||
| 40 | .ld_host = NULL, | ||
| 41 | .ld_base = NULL, | ||
| 42 | .ld_passwd = NULL, | ||
| 43 | .ld_binddn = NULL, | ||
| 44 | .ld_attr = ld_defattr, | ||
| 45 | .ld_port = -1, | ||
| 46 | .starttls = false, | ||
| 47 | .ssl_on_connect = false, | ||
| 48 | #ifdef HAVE_LDAP_SET_OPTION | ||
| 49 | .ld_protocol = DEFAULT_PROTOCOL, | ||
| 50 | #endif | ||
| 51 | |||
| 52 | .warn_entries = NULL, | ||
| 53 | .crit_entries = NULL, | ||
| 54 | .entries_thresholds = NULL, | ||
| 55 | .warn_time_set = false, | ||
| 56 | .warn_time = 0, | ||
| 57 | .crit_time_set = false, | ||
| 58 | .crit_time = 0, | ||
| 59 | }; | ||
| 60 | return tmp; | ||
| 61 | } | ||
