Module: check_mk
Branch: master
Commit: c47249c6f7114c4817bdc688f70ecbabbdbb08a9
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=c47249c6f7114c…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Thu Aug 2 20:06:08 2018 +0200
6424 FIX LDAP: Only set SSL/TLS specific options when SSL is enabled (Fix 1.4.0p34 regression)
In some environments, especially when using older linux distributions, a change
in 1.4.0p34 (#6184) could break already working LDAP setups.
An error like this could occur when trying to perform the LDAP sync: "ValueError: option error".
Change-Id: I7cbebf857dcffdd48a5189212922cbb662d5ad4f
---
.werks/6424 | 14 ++++++++++++++
cmk/gui/plugins/userdb/ldap_connector.py | 5 +++--
2 files changed, 17 insertions(+), 2 deletions(-)
diff --git a/.werks/6424 b/.werks/6424
new file mode 100644
index 0000000..42eafc6
--- /dev/null
+++ b/.werks/6424
@@ -0,0 +1,14 @@
+Title: LDAP: Only set SSL/TLS specific options when SSL is enabled
+Level: 1
+Component: multisite
+Class: fix
+Compatible: compat
+Edition: cre
+State: unknown
+Version: 1.6.0i1
+Date: 1533232961
+
+In some environments, especially when using older linux distributions, a change
+in 1.5.0b6 (#6184) could break already working LDAP setups.
+
+An error like this could occur when trying to perform the LDAP sync: "ValueError: option error".
diff --git a/cmk/gui/plugins/userdb/ldap_connector.py b/cmk/gui/plugins/userdb/ldap_connector.py
index c7cdc40..e6470d7 100644
--- a/cmk/gui/plugins/userdb/ldap_connector.py
+++ b/cmk/gui/plugins/userdb/ldap_connector.py
@@ -233,10 +233,11 @@ class LDAPUserConnector(UserConnector):
if self.is_active_directory():
conn.set_option(ldap.OPT_REFERRALS, 0)
- conn.set_option(ldap.OPT_X_TLS_CACERTFILE,
+ if 'use_ssl' in self._config:
+ conn.set_option(ldap.OPT_X_TLS_CACERTFILE,
"%s/var/ssl/ca-certificates.crt" % cmk.paths.omd_root)
- conn.set_option(ldap.OPT_X_TLS_NEWCTX, 0)
+ conn.set_option(ldap.OPT_X_TLS_NEWCTX, 0)
self.default_bind(conn)
return conn, None
Module: check_mk
Branch: master
Commit: 1cac03aae6a801a5fdce10e806c325194033ec40
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=1cac03aae6a801…
Author: Simon Betz <si(a)mathias-kettner.de>
Date: Wed Aug 1 11:59:47 2018 +0200
6390 Check_MK service: Missing section state for specific agent sections is configurable
Change-Id: I0fe579fcab4f31ddaf3fc37ee25d8ee6aa9d4cf8
---
.werks/6390 | 27 +++++++++++++++++++++
cmk/gui/plugins/wato/check_mk_configuration.py | 12 ++++++++++
cmk_base/checking.py | 33 ++++++++++++++++++++++++--
3 files changed, 70 insertions(+), 2 deletions(-)
diff --git a/.werks/6390 b/.werks/6390
new file mode 100644
index 0000000..09e9944
--- /dev/null
+++ b/.werks/6390
@@ -0,0 +1,27 @@
+Title: Check_MK service: The monitoring state for each missing section is configurable
+Level: 1
+Component: checks
+Compatible: compat
+Edition: cre
+Version: 1.6.0i1
+Date: 1533117549
+Class: feature
+
+Previously only the generic monitoring state was configurable
+if {{some}} agent section were missing. But there was no
+differentiation between these sections.
+
+Now beside of setting the generic "Missing sections" state in the
+ruleset {{State of the Check_MK services}} you can specify
+a regex pattern to match specific section names and give them
+an individual state in case they are missing.
+Note that the first match is used.
+
+The section name can be found in the {{Service check command}} row in
+the details view of a service:
+Without the prefix {{check_mk-}} and the suffix after the dot (incl.).
+
+For example the section name of the service check command
+{{check_mk-cpu.loads}} is {{cpu}}.
+
+This applies only for passive check types.
diff --git a/cmk/gui/plugins/wato/check_mk_configuration.py b/cmk/gui/plugins/wato/check_mk_configuration.py
index 2913370..e05d9a7 100644
--- a/cmk/gui/plugins/wato/check_mk_configuration.py
+++ b/cmk/gui/plugins/wato/check_mk_configuration.py
@@ -2659,6 +2659,18 @@ register_rule(group,
default_value = 1,
title = _("State if just <i>some</i> agent sections are missing")),
),
+ ("specific_missing_sections", ListOf(
+ Tuple(elements=[
+ RegExpUnicode(
+ help = _('Beside of setting the generic "Missing sections" state above'
+ 'you can specify a regex pattern to match specific section names and'
+ 'give them an individual state in case they are missing.'
+ 'Note that the first match is used.'),
+ mode = RegExpUnicode.prefix),
+ MonitoringState(),
+ ], orientation="horizontal"),
+ title=_("State if specific sections are missing"),
+ )),
]
)),
("individual", Dictionary(
diff --git a/cmk_base/checking.py b/cmk_base/checking.py
index 6e36211..97a9919 100644
--- a/cmk_base/checking.py
+++ b/cmk_base/checking.py
@@ -36,6 +36,7 @@ import cmk.defines as defines
import cmk.tty as tty
import cmk.cpu_tracking as cpu_tracking
from cmk.exceptions import MKGeneralException
+from cmk.regex import regex
import cmk_base.utils
import cmk_base.crash_reporting
@@ -114,8 +115,10 @@ def do_check(hostname, ipaddress, only_check_plugin_names=None):
perfdata.extend(source_perfdata)
if missing_sections and num_success > 0:
- infotexts.append("Missing agent sections: %s" % ", ".join(missing_sections))
- status = max(status, exit_spec.get("missing_sections", 1))
+ missing_sections_status, missing_sections_infotext = \
+ _check_missing_sections(missing_sections, exit_spec)
+ status = max(status, missing_sections_status)
+ infotexts.append(missing_sections_infotext)
elif missing_sections:
infotexts.append("Got no information from host")
@@ -153,6 +156,32 @@ def do_check(hostname, ipaddress, only_check_plugin_names=None):
cmk_base.cee.inline_snmp.save_snmp_stats()
+def _check_missing_sections(missing_sections, exit_spec):
+ specific_missing_sections_spec = exit_spec.get("specific_missing_sections", [])
+ specific_missing_sections, generic_missing_sections = set(), set()
+ for section in missing_sections:
+ match = False
+ for pattern, status in specific_missing_sections_spec:
+ reg = regex(pattern)
+ if reg.match(section):
+ match = True
+ specific_missing_sections.add((section, status))
+ break
+ if not match:
+ generic_missing_sections.add(section)
+
+ generic_missing_sections_status = exit_spec.get("missing_sections", 1)
+ infotexts = ["Missing agent sections: %s%s" % (
+ ", ".join(sorted(generic_missing_sections)),
+ check_api_utils.state_markers[generic_missing_sections_status])]
+
+ for section, status in sorted(specific_missing_sections):
+ infotexts.append("%s%s" % (section, check_api_utils.state_markers[status]))
+ generic_missing_sections_status = max(generic_missing_sections_status, status)
+
+ return generic_missing_sections_status, ", ".join(infotexts)
+
+
# Loops over all checks for ANY host (cluster, real host), gets the data, calls the check
# function that examines that data and sends the result to the Core.
def _do_all_checks_on_host(sources, hostname, ipaddress, only_check_plugin_names=None):