Module: check_mk
Branch: master
Commit: 1a70ae121f139ea02a729b682f55d73834265534
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=1a70ae121f139e…
Author: Simon Betz <si(a)mathias-kettner.de>
Date: Mon Jun 26 13:29:12 2017 +0200
4874 FIX cisco_power: Improved discovery of power supplies
Before not all power supplies were discovered or had
an incorrect description, eg. status code was included.
This has been fixed now but you have to re-discover on the
affected hosts.
Change-Id: I274a81171d4c195ebd03b10c75aec68603d70c68
---
.werks/4874 | 14 ++++++++++++++
checks/cisco_sensor_item.include | 16 +++++++++-------
2 files changed, 23 insertions(+), 7 deletions(-)
diff --git a/.werks/4874 b/.werks/4874
new file mode 100644
index 0000000..617c9de
--- /dev/null
+++ b/.werks/4874
@@ -0,0 +1,14 @@
+Title: cisco_power: Improved discovery of power supplies
+Level: 1
+Component: checks
+Class: fix
+Compatible: incomp
+Edition: cre
+State: unknown
+Version: 1.5.0i1
+Date: 1498476261
+
+Before not all power supplies were discovered or had
+an incorrect description, eg. status code was included.
+This has been fixed now but you have to re-discover on the
+affected hosts.
diff --git a/checks/cisco_sensor_item.include b/checks/cisco_sensor_item.include
index d4ea595..93f5d9c 100644
--- a/checks/cisco_sensor_item.include
+++ b/checks/cisco_sensor_item.include
@@ -34,18 +34,20 @@ def cisco_sensor_item(trial_string, fall_back):
# -> Depends on the device model
try:
# Try to handle all cases found in mkzeug/walks
- splited = [ x.strip() for x in trial_string.split(',')]
- if len(splited) == 1:
+ splitted = [ x.strip() for x in trial_string.split(',')]
+ if len(splitted) == 1:
item = trial_string
# If the last part contains # or Power, take the complete string
- elif '#' in splited[-1] or 'Power' in splited[-1]:
- item = " ".join(splited)
+ elif '#' in splitted[-1] or 'Power' in splitted[-1]:
+ item = " ".join(splitted)
# If second last part start with Status, remove that part
- elif splited[-2].startswith("Status") or splited[-2].startswith("PS1"):
- item = " ".join(splited[:-2])
+ elif splitted[-2].startswith("PS"):
+ item = " ".join(splitted[:-2] + splitted[-2].split(" ")[:-1])
+ elif splitted[-2].startswith("Status"):
+ item = " ".join(splitted[:-2])
# Take anything, but without last part
else:
- item = " ".join(splited[:-1])
+ item = " ".join(splitted[:-1])
# Maye there a multiple Items, but always the same string.
# Try to prevent that by adding the fall_back number to the end
if not item[-1].isdigit():
Module: check_mk
Branch: master
Commit: 24e9d3aa19221afd22b8b7bb308baae3f46ea30a
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=24e9d3aa19221a…
Author: Marcel Arentz <ma(a)mathias-kettner.de>
Date: Mon Jun 26 11:59:00 2017 +0200
4823 FIX netapp_api_cpu: Fixed crash if data for node is missing
The checkplugin does not crash anymore if the cpu data for a node is
missing. Instead the state will now change to UNKNOWN.
Change-Id: I1054e9a0d9e4ab04d82fd91fd871f8157fbdaf9c
---
.werks/4823 | 11 +++++++++++
checks/netapp_api_cpu | 2 ++
2 files changed, 13 insertions(+)
diff --git a/.werks/4823 b/.werks/4823
new file mode 100644
index 0000000..f555ff2
--- /dev/null
+++ b/.werks/4823
@@ -0,0 +1,11 @@
+Title: netapp_api_cpu: Fixed crash if data for node is missing
+Level: 1
+Component: checks
+Compatible: compat
+Edition: cre
+Version: 1.5.0i1
+Date: 1498471053
+Class: fix
+
+The checkplugin does not crash anymore if the cpu data for a node is
+missing. Instead the state will now change to UNKNOWN.
diff --git a/checks/netapp_api_cpu b/checks/netapp_api_cpu
index a72f767..e689d8f 100644
--- a/checks/netapp_api_cpu
+++ b/checks/netapp_api_cpu
@@ -69,6 +69,8 @@ def check_netapp_api_cpu_utilization(item, params, parsed, mode):
mode_data = parsed.get(mode)
if item:
data = mode_data.get(item)
+ if data == None:
+ return 3, "No data available!"
else:
data = mode_data
Module: check_mk
Branch: master
Commit: 68ee4716145e871785e5aba177ce25fa49e8e30c
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=68ee4716145e87…
Author: Sven Panne <sp(a)mathias-kettner.de>
Date: Fri Jun 23 13:42:57 2017 +0200
4695 FIX Make communication with event console more robust
When the monitoring core connects to the event console very rapidly, a "No
buffer space available" error could happen intermittently. This can be seen
in the log, and the corresponding command fails, too, e.g. archiving an
event. This has been fixed, the connection is simply retried when this
rare but harmless error happens.
Change-Id: Id382dfe9f4267bb7d660ac306a963a3e622a8041
---
.werks/4695 | 14 ++++++++++++++
livestatus/src/EventConsoleConnection.cc | 23 ++++++++++++++++++++++-
2 files changed, 36 insertions(+), 1 deletion(-)
diff --git a/.werks/4695 b/.werks/4695
new file mode 100644
index 0000000..793fecd
--- /dev/null
+++ b/.werks/4695
@@ -0,0 +1,14 @@
+Title: Make communication with event console more robust
+Level: 1
+Component: livestatus
+Compatible: compat
+Edition: cre
+Version: 1.5.0i1
+Date: 1498217686
+Class: fix
+
+When the monitoring core connects to the event console very rapidly, a "No
+buffer space available" error could happen intermittently. This can be seen
+in the log, and the corresponding command fails, too, e.g. archiving an
+event. This has been fixed, the connection is simply retried when this
+rare but harmless error happens.
diff --git a/livestatus/src/EventConsoleConnection.cc b/livestatus/src/EventConsoleConnection.cc
index 61fbb61..474d31f 100644
--- a/livestatus/src/EventConsoleConnection.cc
+++ b/livestatus/src/EventConsoleConnection.cc
@@ -26,8 +26,12 @@
// IWYU pragma: no_include <boost/asio/basic_socket_streambuf.hpp>
#include "EventConsoleConnection.h"
#include <boost/asio/socket_base.hpp>
+#include <boost/system/error_code.hpp>
#include <boost/system/system_error.hpp>
+#include <chrono>
#include <ostream>
+#include <ratio>
+#include <thread>
#include <utility>
#include "Logger.h"
@@ -43,7 +47,24 @@ EventConsoleConnection::~EventConsoleConnection() {
void EventConsoleConnection::run() {
boost::asio::local::stream_protocol::endpoint ep(_path);
- boost::asio::local::stream_protocol::iostream stream(ep);
+ // Attention, tricky timing-dependent stuff ahead: When we connect very
+ // rapidly, a no_buffer_space (= ENOBUFS) error can happen. This is probably
+ // caused by some internal Boost Kung Fu, remapping EGAIN to ENOBUFS, and
+ // looks like a bug in Boost, but that's a bit unclear. So instead of
+ // relying on Boost to retry under these circumstances, we do it ourselves.
+ boost::asio::local::stream_protocol::iostream stream;
+ while (true) {
+ stream.connect(ep);
+ if (stream.error() !=
+ boost::system::error_code(boost::system::errc::no_buffer_space,
+ boost::system::system_category())) {
+ break;
+ }
+ Debug(_logger) << "retrying to connect";
+ stream.clear();
+ std::this_thread::sleep_for(std::chrono::milliseconds(1));
+ }
+
check(stream, "connect");
Debug(_logger) << prefix("successfully connected");
Module: check_mk
Branch: master
Commit: fda61f8ba29dee8a64ba4b9d368e26cd77d602e9
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=fda61f8ba29dee…
Author: Simon Betz <si(a)mathias-kettner.de>
Date: Fri Jun 23 12:43:47 2017 +0200
Updated werk 4782
Change-Id: Iab2e291bc4a1f05231a59a2e337b3cb4c4dd0e7f
---
web/htdocs/watolib.py | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/web/htdocs/watolib.py b/web/htdocs/watolib.py
index 1d1bc97..13d53a5 100644
--- a/web/htdocs/watolib.py
+++ b/web/htdocs/watolib.py
@@ -1939,12 +1939,12 @@ class CREFolder(BaseFolder):
def _get_parents_of_hosts(self, host_names):
- # Note: Deletion of chosen hosts which are a parent
+ # Note: Deletion of chosen hosts which are parents
# is possible if and only if all children are chosen, too.
hosts_with_children = {}
for child_key, child in Folder.root_folder().all_hosts_recursively().items():
for host_name in host_names:
- if host_name in child.host_names():
+ if host_name in child.parents():
hosts_with_children.setdefault(host_name, [])
hosts_with_children[host_name].append(child_key)
Module: check_mk
Branch: master
Commit: cf2f3d124a72b6c7ba0b18cffddfebed081e56ce
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=cf2f3d124a72b6…
Author: Simon Betz <si(a)mathias-kettner.de>
Date: Mon Jun 12 09:21:09 2017 +0200
4782 Prevent deletion of parent host
Change-Id: I08dc31201d1f361344fd3fe3802c96aa7b191ccc
---
.werks/4782 | 13 +++++++++++++
web/htdocs/wato.py | 1 -
web/htdocs/watolib.py | 41 ++++++++++++++++++++++++++++++++++++-----
3 files changed, 49 insertions(+), 6 deletions(-)
diff --git a/.werks/4782 b/.werks/4782
new file mode 100644
index 0000000..37ffaaf
--- /dev/null
+++ b/.werks/4782
@@ -0,0 +1,13 @@
+Title: Prevent deletion of parent host
+Level: 1
+Component: wato
+Compatible: compat
+Edition: cre
+Version: 1.5.0i1
+Date: 1497251963
+Class: feature
+
+If you want to delete hosts which have parents, an error is
+raised and the deletion of these hosts won't be executed.
+Either you have to resolve the parent-child relationships
+or all related hosts are chosen.
diff --git a/web/htdocs/wato.py b/web/htdocs/wato.py
index 95d112e..6e07a6e 100644
--- a/web/htdocs/wato.py
+++ b/web/htdocs/wato.py
@@ -1336,7 +1336,6 @@ def mode_edit_host(phase, new, is_cluster):
return action_edit_host(mode, hostname, is_cluster)
-
# Show outcome of host validation. Do not validate new hosts
errors = None
if new:
diff --git a/web/htdocs/watolib.py b/web/htdocs/watolib.py
index 4e0bdbef..1d1bc97 100644
--- a/web/htdocs/watolib.py
+++ b/web/htdocs/watolib.py
@@ -1801,8 +1801,15 @@ class CREFolder(BaseFolder):
self.need_permission("write")
self.need_unlocked_subfolders()
- # 2. Actual modification
+ # 2. check if hosts have parents
subfolder = self.subfolder(name)
+ hosts_with_children = self._get_parents_of_hosts(subfolder.all_hosts_recursively().keys())
+ if hosts_with_children:
+ raise MKUserError("delete_host", _("You cannot delete these hosts: %s") % \
+ ", ".join([_("%s is parent of %s.") % (parent, ", ".join(children))
+ for parent, children in sorted(hosts_with_children.items())]))
+
+ # 3. Actual modification
call_hook_folder_deleted(subfolder)
add_change("delete-folder", _("Deleted folder %s") % subfolder.alias_path(),
obj=self,
@@ -1908,10 +1915,17 @@ class CREFolder(BaseFolder):
self.need_unlocked_hosts()
self.need_permission("write")
- # 2. Delete host specific files (caches, tempfiles, ...)
+ # 2. check if hosts have parents
+ hosts_with_children = self._get_parents_of_hosts(host_names)
+ if hosts_with_children:
+ raise MKUserError("delete_host", _("You cannot delete these hosts: %s") % \
+ ", ".join([_("%s is parent of %s.") % (parent, ", ".join(children))
+ for parent, children in sorted(hosts_with_children.items())]))
+
+ # 3. Delete host specific files (caches, tempfiles, ...)
self._delete_host_files(host_names)
- # 3. Actual modification
+ # 4. Actual modification
for host_name in host_names:
host = self.hosts()[host_name]
del self._hosts[host_name]
@@ -1924,6 +1938,23 @@ class CREFolder(BaseFolder):
self.save_hosts()
+ def _get_parents_of_hosts(self, host_names):
+ # Note: Deletion of chosen hosts which are a parent
+ # is possible if and only if all children are chosen, too.
+ hosts_with_children = {}
+ for child_key, child in Folder.root_folder().all_hosts_recursively().items():
+ for host_name in host_names:
+ if host_name in child.host_names():
+ hosts_with_children.setdefault(host_name, [])
+ hosts_with_children[host_name].append(child_key)
+
+ result = {}
+ for parent, children in hosts_with_children.items():
+ if not set(children) < set(host_names):
+ result.setdefault(parent, children)
+ return result
+
+
# Group the given host names by their site and delete their files
def _delete_host_files(self, host_names):
hosts_by_site = {}
@@ -2209,9 +2240,9 @@ class SearchFolder(BaseFolder):
def delete_hosts(self, host_names):
auth_errors = []
- for folder, host_names in self._group_hostnames_by_folder(host_names):
+ for folder, these_host_names in self._group_hostnames_by_folder(host_names):
try:
- folder.delete_hosts(host_names)
+ folder.delete_hosts(these_host_names)
except MKAuthException, e:
auth_errors.append(_("<li>Cannot delete hosts in folder %s: %s</li>") % (folder.alias_path(), e))
self._invalidate_search()