Module: check_mk
Branch: master
Commit: e257db11bc491fc0159cc24296541784b90900d0
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=e257db11bc491f…
Author: Simon Betz <si(a)mathias-kettner.de>
Date: Thu Dec 15 14:35:51 2016 +0100
4166 New view command: archive events of hosts
Change-Id: Ia85172e91714b0335cf79c72e8cdfdab08d3399b
---
.werks/4166 | 11 +++++++++++
ChangeLog | 1 +
web/plugins/views/mkeventd.py | 36 ++++++++++++++++++++++++++++++++++++
3 files changed, 48 insertions(+)
diff --git a/.werks/4166 b/.werks/4166
new file mode 100644
index 0000000..4489cfb
--- /dev/null
+++ b/.werks/4166
@@ -0,0 +1,11 @@
+Title: New view command: archive events of hosts
+Level: 1
+Component: ec
+Compatible: compat
+Version: 1.4.0i3
+Date: 1481808898
+Class: feature
+
+In hosts or services views you can now archive all events
+at once by using the view command archive events below
+various commands.
diff --git a/ChangeLog b/ChangeLog
index fd8a9d5..68736f9 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -134,6 +134,7 @@
Event Console:
* 4132 Monitoring notifications: Add EC_ORIG_HOST to notifiation context...
* 4148 EC: reorder entries in Performance snapin, add overflows and load
+ * 4166 New view command: archive events of hosts...
* 4151 Use notification fallback also for hosts not known to the monitoring...
* 4097 FIX: Event console: Make writing of status file more robust...
* 4147 FIX: Always show rule analyser result on Generate, not only after previous Try
out...
diff --git a/web/plugins/views/mkeventd.py b/web/plugins/views/mkeventd.py
index c450b3d..bf8b8ed 100644
--- a/web/plugins/views/mkeventd.py
+++ b/web/plugins/views/mkeventd.py
@@ -564,6 +564,42 @@ if mkeventd_enabled:
"executor" : command_executor_mkeventd,
})
+
+ config.declare_permission("mkeventd.archive_events_of_hosts",
+ _("Archive events of hosts"),
+ _("Archive all open events of all hosts shown in host
views"),
+ [ "user", "admin" ])
+
+
+ def command_archive_events_of_hosts(cmdtag, spec, row):
+ if html.var("_archive_events_of_hosts"):
+ if cmdtag == "HOST":
+ tag = "host"
+ elif cmdtag == "SVC":
+ tag = "service"
+ else:
+ tag = None
+
+ commands = []
+ if tag and row.get('%s_check_command' % tag,
"").startswith('check_mk_active-mkevents'):
+ data = sites.live().query("GET eventconsoleevents\n" +\
+ "Columns: event_id\n" +\
+ "Filter: host_name = %s" % \
+ row['host_name'])
+ commands = [ "DELETE;%s;%s" % (entry[0], config.user.id) for
entry in data ]
+ return commands, "<b>archive all events of all hosts</b>
of"
+
+
+ multisite_commands.append({
+ "tables" : [ "host", "service" ],
+ "permission" : "mkeventd.archive_events_of_hosts",
+ "title" : _("Archive events of hosts"),
+ "render" : lambda:
html.button("_archive_events_of_hosts", _('Archive events')),
+ "action" : command_archive_events_of_hosts,
+ "executor" : command_executor_mkeventd,
+ })
+
+
#.
# .--Sorters-------------------------------------------------------------.
# | ____ _ |