[checkmk-commits] Check_MK Git: check_mk: Added multisite plugin that can be used to open tickets

Bastian Kuhn bk at mathias-kettner.de
Fri Apr 24 10:04:00 CEST 2015


Module: check_mk
Branch: master
Commit: 29eab0d2d1812f0da18364912d1fd5825cdf73f2
URL:    http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=29eab0d2d1812f0da18364912d1fd5825cdf73f2

Author: Bastian Kuhn <bk at mathias-kettner.de>
Date:   Fri Apr 24 10:03:55 2015 +0200

Added multisite plugin that can be used to open tickets

---

 doc/treasures/webapps/open_ticket.py |   34 ++++++++++++++++++++++++++++++++++
 1 file changed, 34 insertions(+)

diff --git a/doc/treasures/webapps/open_ticket.py b/doc/treasures/webapps/open_ticket.py
new file mode 100644
index 0000000..d10907f
--- /dev/null
+++ b/doc/treasures/webapps/open_ticket.py
@@ -0,0 +1,34 @@
+#!/usr/bin/python
+
+# Custom command for creating support tickets
+
+config.declare_permission("action.sap_openticket",
+        _("Open Support Ticket"),
+        _("Open a support ticket for this host/service"),
+        [ "user", "admin" ])
+
+def command_open_ticket(cmdtag, spec, row):
+    if html.var("_sap_openticket"):
+        comment = u"OPENTICKET:" + html.var_utf8("_sap_ticket_comment")
+        broadcast = 0
+        forced = 2
+        command = "SEND_CUSTOM_%s_NOTIFICATION;%s;%s;%s;%s" % \
+                ( cmdtag, spec, broadcast + forced, config.user_id, lqencode(comment))
+        title = _("<b>open a support ticket</b> regarding")
+        return command, title
+
+
+multisite_commands.append({
+    "tables"      : [ "host", "service" ],
+    "permission"  : "action.sap_openticket",
+    "title"       : _("Open support ticket"),
+    "render"      : lambda: \
+        html.write(_('Comment') + ": ") == \
+        html.text_input("_sap_ticket_comment", "", size=50, submit="_sap_openticket") == \
+        html.write("   ") == \
+        html.button("_sap_openticket", _('Open Ticket')),
+    "action"      : command_open_ticket,
+    "group"       : _("SAP Ticket"),
+})
+
+



More information about the checkmk-commits mailing list