Module: check_mk
Branch: master
Commit: 6215222f3b2244100d596dc202bd9c27ee4b0a1b
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=6215222f3b2244…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Thu May 7 12:48:55 2015 +0200
#2250 Added download page for shipped agents and plugins
It is now possible to download the Check_MK agents and plugins
shipped with your version directly from the WEB GUI. The page
<i>Monitoring Agents</i> can be opened from the Configuration
snapin.
This page has been added only to the Check_MK Raw edition. The
Enterprise Edition has the agent bakery which offers a lot of
more features like generating customized agents.
---
.werks/2250 | 17 +++++
ChangeLog | 1 +
web/htdocs/images/icon_download_agents.png | Bin 0 -> 3383 bytes
web/plugins/wato/agents.py | 110 ++++++++++++++++++++++++++++
4 files changed, 128 insertions(+)
diff --git a/.werks/2250 b/.werks/2250
new file mode 100644
index 0000000..b231626
--- /dev/null
+++ b/.werks/2250
@@ -0,0 +1,17 @@
+Title: Added download page for shipped agents and plugins
+Level: 1
+Component: wato
+Class: feature
+Compatible: compat
+State: unknown
+Version: 1.2.7i1
+Date: 1430995542
+
+It is now possible to download the Check_MK agents and plugins
+shipped with your version directly from the WEB GUI. The page
+<i>Monitoring Agents</i> can be opened from the Configuration
+snapin.
+
+This page has been added only to the Check_MK Raw edition. The
+Enterprise Edition has the agent bakery which offers a lot of
+more features like generating customized agents.
diff --git a/ChangeLog b/ChangeLog
index cd28fca..c70a930 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -440,6 +440,7 @@
* 1951 check_http: now able to configure warning and critical limit for certificate
age...
* 2136 Unify headers of Host/Service rules, EC rules and notification rules...
* 2176 One custom icon or action can be configured per process/service...
+ * 2250 Added download page for shipped agents and plugins...
* 1761 FIX: Ruleset search is now consistent for host & serviceparameters and
manual checks
* 1765 FIX: Fixed bug when generating nagvis backends while having sites with
livestatus proxy configured...
* 1789 FIX: Fix preview of passive checks in WATO list of services
diff --git a/web/htdocs/images/icon_download_agents.png
b/web/htdocs/images/icon_download_agents.png
new file mode 100644
index 0000000..c8a65a7
Binary files /dev/null and b/web/htdocs/images/icon_download_agents.png differ
diff --git a/web/plugins/wato/agents.py b/web/plugins/wato/agents.py
new file mode 100644
index 0000000..f6c5018
--- /dev/null
+++ b/web/plugins/wato/agents.py
@@ -0,0 +1,110 @@
+#!/usr/bin/python
+# -*- encoding: utf-8; py-indent-offset: 4 -*-
+# +------------------------------------------------------------------+
+# | ____ _ _ __ __ _ __ |
+# | / ___| |__ ___ ___| | __ | \/ | |/ / |
+# | | | | '_ \ / _ \/ __| |/ / | |\/| | ' / |
+# | | |___| | | | __/ (__| < | | | | . \ |
+# | \____|_| |_|\___|\___|_|\_\___|_| |_|_|\_\ |
+# | |
+# | Copyright Mathias Kettner 2014 mk(a)mathias-kettner.de |
+# +------------------------------------------------------------------+
+#
+# This file is part of Check_MK.
+# The official homepage is at
http://mathias-kettner.de/check_mk.
+#
+# check_mk is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License as published by
+# the Free Software Foundation in version 2. check_mk is distributed
+# in the hope that it will be useful, but WITHOUT ANY WARRANTY; with-
+# out even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE. See the GNU General Public License for more de-
+# ails. You should have received a copy of the GNU General Public
+# License along with GNU Make; see the file COPYING. If not, write
+# to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+# Boston, MA 02110-1301 USA.
+
+import glob
+
+def download_table(title, paths):
+ forms.header(title)
+ forms.container()
+ for path in paths:
+ os_path = path
+ relpath = path.replace(defaults.agents_dir+'/', '')
+ filename = path.split('/')[-1]
+
+ size_kb = os.stat(os_path).st_size / 1024.0
+
+ # FIXME: Rename classes etc. to something generic
+ html.write('<div class="ruleset"><div
class="text" style="width:250px;">')
+ html.write('<a href="agents/%s">%s</a>' % (relpath,
filename))
+ html.write('<span class=dots>%s</span></div>' %
("." * 100))
+ html.write('<div class="rulecount"
style="width:30px;">%d KB</div>' % size_kb)
+ html.write('</div></div>')
+ forms.end()
+
+def mode_download_agents(phase):
+ if phase == "title":
+ return _("Monitoring Agents")
+
+ elif phase == "buttons":
+ global_buttons()
+ return
+
+ elif phase == "action":
+ return
+
+ html.write('<div class="rulesets">')
+ packed = glob.glob(defaults.agents_dir + "/*.deb") \
+ + glob.glob(defaults.agents_dir + "/*.rpm") \
+ + glob.glob(defaults.agents_dir + "/windows/c*.msi")
+
+ download_table(_("Packed Agents"), packed)
+
+ titles = {
+ '' : _('Linux / Unix Agents'),
+ '/plugins' : _('Linux / Unix Plugins'),
+ '/windows' : _('Windows Agent'),
+ '/windows/plugins' : _('Windows Plugins'),
+ '/windows/mrpe' : _('Windows MRPE Scripts'),
+ '/cfg_examples' : _('Example Configurations'),
+ '/z_os' : _('z/OS'),
+ '/sap' : _('SAP'),
+ '/special' : _('Special Agents'),
+ }
+
+ others = []
+ for root, dirs, files in os.walk(defaults.agents_dir):
+ file_paths = []
+ relpath = root.split('agents')[1]
+ title = titles.get(relpath, relpath)
+ for filename in files:
+ path = root + '/' + filename
+ if path not in packed and 'deprecated' not in path:
+ file_paths.append(path)
+
+ others.append((title, file_paths))
+
+ others.sort()
+
+ for title, file_paths in others:
+ if file_paths:
+ download_table(title, sorted(file_paths))
+ html.write('</div>')
+
+# Don't do anything when the agent bakery exists. Otherwise register
+# a simple download page for the default agents
+if "agents" not in modes:
+ modules.append(
+ ("download_agents", _("Monitoring Agents"),
"download_agents", "download_agents",
+ _("Downloads the Check_MK monitoring agents"))
+ )
+
+ modes["download_agents"] = (["download_agents"],
mode_download_agents)
+
+ config.declare_permission("wato.download_agents",
+ _("Monitoring Agents"),
+ _("Download the default Check_MK monitoring agents for Linux, i"
+ "Windows and other operating systems."),
+ [ "admin", "user", "guest" ])