exception when using LDAP over SSL on some distros
Message-ID: <5b895a66.QwoCcTjISYNP8aqa%lm(a)mathias-kettner.de>
User-Agent: Heirloom mailx 12.5 6/20/10
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Module: check_mk
Branch: master
Commit: 43fe038a43feb1b15b8c38067f45611a12cabd64
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=43fe038a43feb1…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Fri Aug 31 16:06:39 2018 +0200
6526 FIX LDAP: Fixed another "ValueError: option error" exception when using LDAP over SSL on some distros
This addition to werk #6424 fixes another case where ValueErrors could occur while setting up LDAP connections
over SSL.
Change-Id: Ia41d687def304d64094ffa6aff8c8f4d9b1dc9a5
---
.werks/6526 | 12 ++++++++++++
cmk/gui/plugins/userdb/ldap_connector.py | 10 +++++++++-
2 files changed, 21 insertions(+), 1 deletion(-)
diff --git a/.werks/6526 b/.werks/6526
new file mode 100644
index 0000000..f51598a
--- /dev/null
+++ b/.werks/6526
@@ -0,0 +1,12 @@
+Title: LDAP: Fixed another "ValueError: option error" exception when using LDAP over SSL on some distros
+Level: 1
+Component: multisite
+Class: fix
+Compatible: compat
+Edition: cre
+State: unknown
+Version: 1.6.0i1
+Date: 1535725756
+
+This addition to werk #6424 fixes another case where ValueErrors could occur while setting up LDAP connections
+over SSL.
diff --git a/cmk/gui/plugins/userdb/ldap_connector.py b/cmk/gui/plugins/userdb/ldap_connector.py
index bed2629..5e7c836 100644
--- a/cmk/gui/plugins/userdb/ldap_connector.py
+++ b/cmk/gui/plugins/userdb/ldap_connector.py
@@ -237,7 +237,15 @@ class LDAPUserConnector(UserConnector):
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)
+ # Caused trouble on older systems or systems with some special configuration or set of
+ # libraries. For example we saw a Ubuntu 17.10 system with libldap 2.4.45+dfsg-1ubuntu1 and
+ # libgnutls30 3.5.8-6ubuntu3 raising "ValueError: option error" while another system with
+ # the exact same liraries did not. Try to do this on systems that support this call and ignore
+ # the errors on other systems.
+ try:
+ conn.set_option(ldap.OPT_X_TLS_NEWCTX, 0)
+ except ValueError:
+ pass
self.default_bind(conn)
return conn, None
Module: check_mk
Branch: master
Commit: be5fbb1e34cbc625553ebf9c717cd4f7fe4e3fde
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=be5fbb1e34cbc6…
Author: Moritz Kiemer <mo(a)mathias-kettner.de>
Date: Fri Aug 31 13:49:33 2018 +0200
6218 FIX mgmt_ipmi_sensors: Wrong battery / power supply WARN state
Due to a bug in pyghmi (https://bugs.launchpad.net/pyghmi/+bug/1790120)
a WARN state was reported for sensors of type "battery" and "power supply".
A workaroud has been added to mitigate this problem.
FEED-943
Change-Id: I9af116870b977706305ab9ae6253b8c0d61d7893
---
.werks/6218 | 12 ++++++++++++
checks/ipmi_sensors.include | 8 ++++----
cmk_base/data_sources/ipmi.py | 34 ++++++++++++++++++++++++++++++++++
3 files changed, 50 insertions(+), 4 deletions(-)
diff --git a/.werks/6218 b/.werks/6218
new file mode 100644
index 0000000..81c0695
--- /dev/null
+++ b/.werks/6218
@@ -0,0 +1,12 @@
+Title: mgmt_ipmi_sensors: Wrong battery / power supply WARN state
+Level: 1
+Component: checks
+Compatible: compat
+Edition: cre
+Version: 1.6.0i1
+Date: 1535715823
+Class: fix
+
+Due to a bug in pyghmi (https://bugs.launchpad.net/pyghmi/+bug/1790120)
+a WARN state was reported for sensors of type "battery" and "power supply".
+A workaroud has been added to mitigate this problem.
diff --git a/checks/ipmi_sensors.include b/checks/ipmi_sensors.include
index 7b36483..adaf1d2 100644
--- a/checks/ipmi_sensors.include
+++ b/checks/ipmi_sensors.include
@@ -198,10 +198,10 @@ def freeipmi_status_txt_mapping(status_txt):
if state is not None:
return state
- if status_txt in [
- "Entity Present", "battery presence detected",
- "Drive Presence", "transition to Running", "Device Enabled",
- "System full operational, working", "System Restart",
+ if status_txt.lower() in [
+ "entity present", "battery presence detected",
+ "drive presence", "transition to running", "device enabled",
+ "system full operational, working", "system restart", "present",
] or \
status_txt.startswith("Fully Redundant") or \
status_txt.endswith("is connected") or \
diff --git a/cmk_base/data_sources/ipmi.py b/cmk_base/data_sources/ipmi.py
index 4b09bcc..1f23c93 100644
--- a/cmk_base/data_sources/ipmi.py
+++ b/cmk_base/data_sources/ipmi.py
@@ -37,6 +37,38 @@ from cmk_base.exceptions import MKAgentError
from .abstract import CheckMKAgentDataSource, ManagementBoardDataSource
+def _handle_false_positive_warnings(reading):
+ """This is a workaround for a pyghmi bug
+ (bug report: https://bugs.launchpad.net/pyghmi/+bug/1790120)
+
+ For some sensors undefined states are looked up, which results in readings of the form
+ {'states': ['Present',
+ 'Unknown state 8 for reading type 111/sensor type 8',
+ 'Unknown state 9 for reading type 111/sensor type 8',
+ 'Unknown state 10 for reading type 111/sensor type 8',
+ 'Unknown state 11 for reading type 111/sensor type 8',
+ 'Unknown state 12 for reading type 111/sensor type 8', ...],
+ 'health': 1, 'name': 'PS Status', 'imprecision': None, 'units': '',
+ 'state_ids': [552704, 552712, 552713, 552714, 552715, 552716, 552717, 552718],
+ 'type': 'Power Supply', 'value': None, 'unavailable': 0}
+
+ The health warning is set, but only due to the lookup errors. We remove the lookup
+ errors, and see whether the remaining states are meaningful.
+ """
+ states = [s for s in reading.states if not s.startswith("Unknown state ")]
+
+ if not states:
+ return "no state reported"
+
+ if any("non-critical" in s for s in states):
+ return "WARNING"
+
+ # just keep all the available info. It should be dealt with in
+ # ipmi_sensors.include (freeipmi_status_txt_mapping),
+ # where it will default to 2(CRIT)
+ return ', '.join(states)
+
+
class IPMIManagementBoardDataSource(ManagementBoardDataSource, CheckMKAgentDataSource):
def id(self):
@@ -126,6 +158,8 @@ class IPMIManagementBoardDataSource(ManagementBoardDataSource, CheckMKAgentDataS
health_txt = "CRITICAL"
elif reading.health >= ipmi_const.Health.Warning:
health_txt = "WARNING"
+ # workaround for pyghmi bug: https://bugs.launchpad.net/pyghmi/+bug/1790120
+ health_txt = _handle_false_positive_warnings(reading)
elif reading.health == ipmi_const.Health.Ok:
health_txt = "OK"
Module: check_mk
Branch: master
Commit: 9945220123e104d6c1a8a6459d70f2a46bdf114e
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=9945220123e104…
Author: Tom Baerwinkel <tb(a)mathias-kettner.de>
Date: Fri Aug 31 11:44:17 2018 +0200
6407 FIX mk_postgres, postgres_instances: output missing instance data
In the agent plugin mk_postgres a command line option for the output
of the postgres_instances check was missing. This resulted in missing
data for the postgres_instances checks.
To apply this fix the mk_postgres plugin on the affected hosts has to
be updated.
Change-Id: I10b8f84103c6f7cdc98571f11e8fc9cd87041190
---
.werks/6407 | 15 +++++++++++++++
agents/plugins/mk_postgres | 2 +-
2 files changed, 16 insertions(+), 1 deletion(-)
diff --git a/.werks/6407 b/.werks/6407
new file mode 100644
index 0000000..049fa41
--- /dev/null
+++ b/.werks/6407
@@ -0,0 +1,15 @@
+Title: mk_postgres, postgres_instances: output missing instance data
+Level: 1
+Component: checks
+Class: fix
+Compatible: incomp
+Edition: cre
+State: unknown
+Version: 1.6.0i1
+Date: 1535708395
+
+In the agent plugin mk_postgres a command line option for the output
+of the postgres_instances check was missing. This resulted in missing
+data for the postgres_instances checks.
+To apply this fix the mk_postgres plugin on the affected hosts has to
+be updated.
diff --git a/agents/plugins/mk_postgres b/agents/plugins/mk_postgres
index 7d5dd08..f981bdf 100755
--- a/agents/plugins/mk_postgres
+++ b/agents/plugins/mk_postgres
@@ -67,7 +67,7 @@ function postgres_instances() {
if [ ! -z "${1}" ]; then
echo "[[[${1}]]]"
fi
- pgrep -lf bin/postgres
+ pgrep -laf bin/postgres
}
Module: check_mk
Branch: master
Commit: 0839c528842ffa70aeaed5cd63c1dc3cea45ee70
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=0839c528842ffa…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Fri Aug 31 10:31:28 2018 +0200
6523 FIX nginx_status: Fixed discovery of running instances on Ubuntu
Nginx instances on Ubuntu based on the official packages were not detected correctly.
To apply this fix you need to update the nginx_status agent plugin.
FEED-834
Change-Id: I5ec539abcc143157980ecffc224608429da1cdac
---
.werks/6523 | 12 ++++++++++++
agents/plugins/nginx_status | 2 +-
2 files changed, 13 insertions(+), 1 deletion(-)
diff --git a/.werks/6523 b/.werks/6523
new file mode 100644
index 0000000..99179fd
--- /dev/null
+++ b/.werks/6523
@@ -0,0 +1,12 @@
+Title: nginx_status: Fixed discovery of running instances on Ubuntu
+Level: 1
+Component: checks
+Class: fix
+Compatible: compat
+Edition: cre
+State: unknown
+Version: 1.6.0i1
+Date: 1535704132
+
+Nginx instances on Ubuntu based on the official packages were not detected correctly.
+To apply this fix you need to update the nginx_status agent plugin.
diff --git a/agents/plugins/nginx_status b/agents/plugins/nginx_status
index becd540..c952783 100755
--- a/agents/plugins/nginx_status
+++ b/agents/plugins/nginx_status
@@ -69,7 +69,7 @@ def try_detect_servers():
to_replace = re.compile('^.*/')
proc = to_replace.sub('', proc)
- procs = [ 'nginx', 'nginx:' ]
+ procs = [ 'nginx', 'nginx:', 'nginx.conf' ]
# the pid/proc field length is limited to 19 chars. Thus in case of
# long PIDs, the process names are stripped of by that length.
# Workaround this problem here
Module: check_mk
Branch: master
Commit: 8976c77dbeee44370c08e1dab63d0502bcca1f11
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=8976c77dbeee44…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Fri Aug 31 09:45:03 2018 +0200
6518 FIX Fixed sorting of dual list choices (like network interface types)
When e.g. editing the network interface port types to discovery in the "Network Interface and Switch Port Discovery" ruleset,
the list of port types was initially not sorted correctly. Even when the list was sorted correctly, the sorting was not kept
when moving options between both fields. Both issues have now been fixed.
Change-Id: Id4a44498c156dbe1fde70dcdb3dba43583c68831
---
.werks/6518 | 13 ++++++++++++
web/htdocs/js/checkmk.js | 52 +++++++++++++++++++++++++++++-------------------
2 files changed, 45 insertions(+), 20 deletions(-)
diff --git a/.werks/6518 b/.werks/6518
new file mode 100644
index 0000000..a7935af
--- /dev/null
+++ b/.werks/6518
@@ -0,0 +1,13 @@
+Title: Fixed sorting of dual list choices (like network interface types)
+Level: 1
+Component: wato
+Class: fix
+Compatible: compat
+Edition: cre
+State: unknown
+Version: 1.6.0i1
+Date: 1535701338
+
+When e.g. editing the network interface port types to discovery in the "Network Interface and Switch Port Discovery" ruleset,
+the list of port types was initially not sorted correctly. Even when the list was sorted correctly, the sorting was not kept
+when moving options between both fields. Both issues have now been fixed.
diff --git a/web/htdocs/js/checkmk.js b/web/htdocs/js/checkmk.js
index 6a781c4..2238a60 100644
--- a/web/htdocs/js/checkmk.js
+++ b/web/htdocs/js/checkmk.js
@@ -235,6 +235,28 @@ function mouse_offset_to_middle(obj, event){
};
}
+function sort_select(select, cmp_func) {
+ var choices = [];
+ for (var i = 0; i < select.options.length;i++) {
+ choices[i] = [];
+ choices[i][0] = select.options[i].text;
+ choices[i][1] = select.options[i].value;
+ }
+
+ choices.sort(cmp_func);
+ while (select.options.length > 0) {
+ select.options[0] = null;
+ }
+
+ for (var i = 0; i < choices.length;i++) {
+ var op = new Option(choices[i][0], choices[i][1]);
+ select.options[i] = op;
+ }
+
+ return;
+}
+
+
//#.
//# .-Events-------------------------------------------------------------.
//# | _____ _ |
@@ -2408,30 +2430,20 @@ function vs_duallist_switch(field_suffix, varprefix, keeporder) {
for (var i = 0; i < selected.length; i++) {
// remove option from origin
field.removeChild(selected[i]);
-
- // Determine the correct child to insert. If keeporder is being set,
- // then new elements will aways be appended. That way the user can
- // create an order of his choice. This is being used if DualListChoice
- // has the option custom_order = True
- var sibling = false;
-
- if (!keeporder) {
- sibling = other_field.children[0];
- while (sibling != null) {
- if (sibling.nodeType == 1 && sibling.label.toLowerCase() > selected[i].label.toLowerCase())
- break;
- sibling = sibling.nextSibling;
- }
- }
-
- if (sibling)
- other_field.insertBefore(selected[i], sibling);
- else
- other_field.appendChild(selected[i]);
+ other_field.appendChild(selected[i]);
selected[i].selected = false;
}
+ // Determine the correct child to insert. If keeporder is being set,
+ // then new elements will aways be appended. That way the user can
+ // create an order of his choice. This is being used if DualListChoice
+ // has the option custom_order = True
+ if (!keeporder) {
+ var collator = new Intl.Collator(undefined, {numeric: true, sensitivity: 'base'});
+ sort_select(other_field, collator.compare);
+ }
+
// Update internal helper field which contains a list of all selected keys
var pos_field = positive ? other_field : field;