Module: check_mk
Branch: master
Commit: 4cc14c2c077a6e2030f5c3b52ce48f73302b60db
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=4cc14c2c077a6e…
Author: Óscar Nájera <on(a)mathias-kettner.de>
Date: Wed Oct 31 17:10:40 2018 +0100
6648 VictorOPS: Notification plugin for VictorOPS
It is now possible to configure Check_MK notifications to be sent to
VictorOPS by using their REST API integration.
In VictorOPS the REST integration for alerts needs to be enabled and the
routing keys defined. Then in Check_MK for every routing key a notification
can be set up under WATO->Notifications. Copy your VictorOPS REST API URL
with the corresponding routing key in the URL. Optionaly to include the URL
of Check_MK's enable the URL prefix field. (VictorOPS does not support
links in their timeline at the time of this writing, thus the full URL is
displayed in the message)
CMK-1187
Change-Id: If002982cde6fe4ecab6235fcde6468e53b7eb8af
---
.werks/6648 | 19 +++++++
cmk/gui/plugins/wato/notifications.py | 55 +++++++++++++++++++
cmk/notification_plugins/slack.py | 32 ++---------
cmk/notification_plugins/utils.py | 30 +++++++++--
cmk/notification_plugins/victorops.py | 73 ++++++++++++++++++++++++++
notifications/slack | 5 +-
notifications/victorops | 7 +++
tests/unit/cmk/notifications/test_slack.py | 9 ++--
tests/unit/cmk/notifications/test_utils.py | 6 +--
tests/unit/cmk/notifications/test_victorops.py | 70 ++++++++++++++++++++++++
10 files changed, 268 insertions(+), 38 deletions(-)
Diff: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commitdiff;h=4cc14c2c07…
Module: check_mk
Branch: master
Commit: 4128badc3a3b72b24b02120fac17ad1c7773ee6c
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=4128badc3a3b72…
Author: Óscar Nájera <on(a)mathias-kettner.de>
Date: Mon Nov 5 10:52:46 2018 +0100
Work around for delete failed notifications bug
The delete failed notifications link sits on the sidebar and has no access
to the content in the main frame, thus can't know about the previous
page. As such it fail looking for it. An empty string bypasses the issue.
Change-Id: Iee280b33379b88a2abe9bc941e23f88de9da98e1
---
cmk/gui/notifications.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/cmk/gui/notifications.py b/cmk/gui/notifications.py
index 5476b98..5953353 100644
--- a/cmk/gui/notifications.py
+++ b/cmk/gui/notifications.py
@@ -196,7 +196,7 @@ def page_clear():
else:
acktime = float(acktime)
- prev_url = html.get_url_input('prev_url')
+ prev_url = html.get_url_input('prev_url', '')
if html.var('_confirm'):
acknowledge_failed_notifications(acktime)
html.reload_sidebar()
Module: check_mk
Branch: master
Commit: 92894c9fcf805bb6f016bc466d8987124469e4fc
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=92894c9fcf805b…
Author: Tom Baerwinkel <tb(a)mathias-kettner.de>
Date: Wed Oct 31 08:53:16 2018 +0100
mk_logwatch: extract function status_filename and simplify logic
Change-Id: I5c593206267f53b15853c500d9b01dd85e8464d1
---
agents/plugins/mk_logwatch | 36 +++++++++++++++++-------------------
1 file changed, 17 insertions(+), 19 deletions(-)
diff --git a/agents/plugins/mk_logwatch b/agents/plugins/mk_logwatch
index 299f5be..b6179b4 100755
--- a/agents/plugins/mk_logwatch
+++ b/agents/plugins/mk_logwatch
@@ -148,25 +148,23 @@ sys.stdout.write("<<<logwatch>>>\n")
config_filename = mk_confdir + "/logwatch.cfg"
config_dir = mk_confdir + "/logwatch.d/*.cfg"
-
-# Determine the name of the state file
-# $REMOTE set -> logwatch.state.$REMOTE
-# $REMOTE not set and a tty -> logwatch.state.local
-# $REMOTE not set and not a tty -> logwatch.state
-remote_hostname = os.getenv("REMOTE", "")
-remote_hostname = remote_hostname.replace(":", "_")
-if remote_hostname != "":
- status_filename = "%s/logwatch.state.%s" % (mk_vardir, remote_hostname)
-else:
- if sys.stdout.isatty():
- status_filename = "%s/logwatch.state.local" % mk_vardir
- else:
- status_filename = "%s/logwatch.state" % mk_vardir
-
# Copy the last known state from the logwatch.state when there is no status_filename yet.
-if not os.path.exists(status_filename) and os.path.exists("%s/logwatch.state" % mk_vardir):
+if not os.path.exists(status_filename()) and os.path.exists("%s/logwatch.state" % mk_vardir):
import shutil
- shutil.copy("%s/logwatch.state" % mk_vardir, status_filename)
+ shutil.copy("%s/logwatch.state" % mk_vardir, status_filename())
+
+
+def status_filename():
+ # Determine the name of the state file
+ # $REMOTE set -> logwatch.state.$REMOTE
+ # $REMOTE not set and a tty -> logwatch.state.local
+ # $REMOTE not set and not a tty -> logwatch.state
+ remote_hostname = os.getenv("REMOTE", "").replace(":", "_")
+ if remote_hostname != "":
+ return "%s/logwatch.state.%s" % (mk_vardir, remote_hostname)
+ if sys.stdout.isatty():
+ return "%s/logwatch.state.local" % mk_vardir
+ return "%s/logwatch.state" % mk_vardir
def is_not_comment(line):
if line.lstrip().startswith('#') or \
@@ -251,7 +249,7 @@ def read_status():
return {}
status = {}
- for line in file(status_filename):
+ for line in file(status_filename()):
# TODO: Remove variants with spaces. rsplit is
# not portable. split fails if logfilename contains
# spaces
@@ -272,7 +270,7 @@ def read_status():
return status
def save_status(status):
- f = file(status_filename, "w")
+ f = file(status_filename(), "w")
for filename, (offset, inode) in status.items():
f.write("%s|%d|%d\n" % (filename, offset, inode))