Module: check_mk
Branch: master
Commit: b6476a2e09c01909178d8ac7fe6bffc66c621a56
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=b6476a2e09c019…
Author: Marcel Arentz <ma(a)mathias-kettner.de>
Date: Wed Feb 8 17:07:34 2017 +0100
4193 FIX check_mail: Fixed bug with fetching mails
Previously the active check was not able to handle response messages containing
more information than expected. Additionally the check was not closing the
connection afterwards, so the messages never have been deleted.
Change-Id: I92ace2716b15d31549d79f9160315fafade59dd0
---
.werks/4193 | 11 +++++++++++
active_checks/check_mail | 17 ++++++++++-------
2 files changed, 21 insertions(+), 7 deletions(-)
diff --git a/.werks/4193 b/.werks/4193
new file mode 100644
index 0000000..511fa06
--- /dev/null
+++ b/.werks/4193
@@ -0,0 +1,11 @@
+Title: check_mail: Fixed bug with fetching mails
+Level: 1
+Component: checks
+Compatible: compat
+Version: 1.4.0i4
+Date: 1486569909
+Class: fix
+
+Previously the active check was not able to handle response messages containing
+more information than expected. Additionally the check was not closing the
+connection afterwards, so the messages never have been deleted.
diff --git a/active_checks/check_mail b/active_checks/check_mail
index a07861c..44f2751 100755
--- a/active_checks/check_mail
+++ b/active_checks/check_mail
@@ -245,8 +245,8 @@ def cleanup_mailbox():
for index in g_forwarded:
if fetch_proto == 'POP3':
if cleanup_messages == 'delete':
- response = g_M.dele(index)
- if response != "+OK":
+ response = g_M.dele(index+1)
+ if not response.startswith("+OK"):
raise Exception("Response from server: [%s]" % response)
else:
if cleanup_messages != 'delete':
@@ -398,11 +398,14 @@ def main():
if opt_debug:
imaplib.Debug = 4
- connect()
- if forward_ec:
- forward_to_ec(fetch_mails())
- else:
- bail_out(0, 'Successfully logged in to mailbox')
+ try:
+ connect()
+ if forward_ec:
+ forward_to_ec(fetch_mails())
+ else:
+ bail_out(0, 'Successfully logged in to mailbox')
+ finally:
+ close_mailbox()
socket.setdefaulttimeout(conn_timeout)
Module: check_mk
Branch: master
Commit: 1f98022545b03e2863bc5c4bfcbcecdee13778fa
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=1f98022545b03e…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Mon Feb 13 16:25:30 2017 +0100
Failed notification check: Advance acknowledgement time when no issues have been found on any site
Change-Id: I8e06ef4901de5f276bca0e23b6c7e3f87a4a05d5
---
web/htdocs/notifications.py | 12 +++++++++++-
web/plugins/sidebar/shipped.py | 3 ---
2 files changed, 11 insertions(+), 4 deletions(-)
diff --git a/web/htdocs/notifications.py b/web/htdocs/notifications.py
index 21fc2d9..3457238 100644
--- a/web/htdocs/notifications.py
+++ b/web/htdocs/notifications.py
@@ -123,7 +123,17 @@ def load_failed_notifications(before=None, after=None, stat_only=False, extra_he
query += extra_headers
if stat_only:
- return sites.live().query_summed_stats(query)
+ result = sites.live().query_summed_stats(query)
+ if result is None:
+ result = [0] # Normalize the result when no site answered
+
+ if result[0] == 0 and not sites.live().dead_sites():
+ # In case there are no errors and all sites are reachable:
+ # advance the users acknowledgement time
+ acknowledge_failed_notifications(time.time())
+
+ return result
+
else:
return sites.live().query(query)
diff --git a/web/plugins/sidebar/shipped.py b/web/plugins/sidebar/shipped.py
index d325b8b..1b41fbb 100644
--- a/web/plugins/sidebar/shipped.py
+++ b/web/plugins/sidebar/shipped.py
@@ -634,9 +634,6 @@ def get_tactical_overview_data(extra_filter_headers):
stat_only=True,
extra_headers=extra_filter_headers)
- if notdata is None:
- notdata = [0]
-
try:
event_data = sites.live().query_summed_stats(event_query)
except livestatus.MKLivestatusNotFoundError: