From 7a518f99a57a6ee169cedd062e4e2e1e7c3fc2d2 Mon Sep 17 00:00:00 2001 From: Lorenz Kästle <12514511+RincewindsHat@users.noreply.github.com> Date: Tue, 11 Mar 2025 12:12:32 +0100 Subject: Refactor check_ldap --- plugins/check_ldap.d/config.h | 61 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 61 insertions(+) create mode 100644 plugins/check_ldap.d/config.h (limited to 'plugins/check_ldap.d/config.h') 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 @@ +#pragma once + +#include "../../config.h" +#include "thresholds.h" +#include +#include + +static char ld_defattr[] = "(objectclass=*)"; + +enum { +#ifdef HAVE_LDAP_SET_OPTION + DEFAULT_PROTOCOL = 2, +#endif +}; + +typedef struct { + char *ld_host; + char *ld_base; + char *ld_passwd; + char *ld_binddn; + char *ld_attr; + int ld_port; + bool starttls; + bool ssl_on_connect; +#ifdef HAVE_LDAP_SET_OPTION + int ld_protocol; +#endif + + char *warn_entries; + char *crit_entries; + thresholds *entries_thresholds; + bool warn_time_set; + double warn_time; + bool crit_time_set; + double crit_time; +} check_ldap_config; + +check_ldap_config check_ldap_config_init() { + check_ldap_config tmp = { + .ld_host = NULL, + .ld_base = NULL, + .ld_passwd = NULL, + .ld_binddn = NULL, + .ld_attr = ld_defattr, + .ld_port = -1, + .starttls = false, + .ssl_on_connect = false, +#ifdef HAVE_LDAP_SET_OPTION + .ld_protocol = DEFAULT_PROTOCOL, +#endif + + .warn_entries = NULL, + .crit_entries = NULL, + .entries_thresholds = NULL, + .warn_time_set = false, + .warn_time = 0, + .crit_time_set = false, + .crit_time = 0, + }; + return tmp; +} -- cgit v1.2.3-74-g34f1 From e2b806ebf51c443909bea24a8f3a1daa6afe9723 Mon Sep 17 00:00:00 2001 From: Lorenz Kästle <12514511+RincewindsHat@users.noreply.github.com> Date: Tue, 11 Mar 2025 12:40:32 +0100 Subject: Remove unintented import --- plugins/check_ldap.d/config.h | 1 - 1 file changed, 1 deletion(-) (limited to 'plugins/check_ldap.d/config.h') diff --git a/plugins/check_ldap.d/config.h b/plugins/check_ldap.d/config.h index 97a9cfa7..c8a40610 100644 --- a/plugins/check_ldap.d/config.h +++ b/plugins/check_ldap.d/config.h @@ -2,7 +2,6 @@ #include "../../config.h" #include "thresholds.h" -#include #include static char ld_defattr[] = "(objectclass=*)"; -- cgit v1.2.3-74-g34f1