Module: check_mk
Branch: master
Commit: 96e37d8a45c256c3ab08e60a26704600c2989c2c
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=96e37d8a45c256…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Fri Mar 15 12:32:14 2019 +0100
Tags of hosts are now available in core and livestatus context
* The previously existing host custom variable TAGS did contain a list
of configured host tags of a host. The problem here is that it is not
clear which tag groups the tags are assigned with. Each consumer of the
tags (e.g. the GUI) had to reverese lookup the tags in the groups. This
only worked because the tags had to be unique accross all tag groups.
* This commit is introducsing a new host / service attribute "tags".
The attribute contains a dictionary of all configured tags of that
object. Each entry in this dictionary is built out of the tag group ID
which is used as key and the choosen tag ID, which is used as value.
* This new attribute is handled in a different way than the TAGS custom
variable. It allows the tag groups and tags to be defined in a less
restrictive way. It is, for example, possible to use non ASCII
characters in the tag groups or tags from the livestatus perspective.
This enables us to adapt a wider range of tags from external systems
like AWS, Azure, Kubernetes and so on. More on this in later commits.
* The new column also allows a lot easier and more flexible filtering
on livestatus protocol layer.
* The quicksearch host tag filter is now using the tag keys and values.
To search all productive hosts use: "tg:criticality:prod" instead of
"tg:prod". It' still compatible to the old syntax, but that may be
dropped as of version 1.7.
* All GUI parts working with tags have been updated to work with the new
"tags" column.
CMK-1814
Change-Id: Ifce1376a9eb31dbd84c57542720f328921625281
---
cmk/gui/plugins/sidebar/quicksearch.py | 27 ++++--
cmk/gui/plugins/views/__init__.py | 3 +-
cmk/gui/plugins/views/painters.py | 44 ++++-----
cmk/gui/plugins/views/sorters.py | 12 ++-
cmk/gui/plugins/views/utils.py | 19 +---
cmk/gui/plugins/visuals/filters.py | 59 +++++-------
cmk/gui/plugins/wato/builtin_attributes.py | 12 ++-
cmk/gui/tags.py | 12 +++
cmk/gui/view_utils.py | 7 ++
cmk/gui/views.py | 45 ++++-----
cmk/gui/wato/pages/folders.py | 12 +--
cmk/gui/wato/pages/hosts.py | 2 +-
cmk/gui/watolib/host_attributes.py | 46 +++++----
cmk/gui/watolib/hosts_and_folders.py | 103 +++++++++------------
cmk_base/automations/check_mk.py | 3 +-
cmk_base/config.py | 7 ++
cmk_base/core_config.py | 13 ++-
cmk_base/core_nagios.py | 13 ++-
cmk_base/data_sources/programs.py | 3 +-
cmk_base/default_config/base.py | 1 +
cmk_base/dump_host.py | 4 +-
cmk_base/modes/__init__.py | 3 +-
tests/integration/livestatus/test_livestatus.py | 28 +++++-
.../unit/cmk/gui/watolib/test_hosts_and_folders.py | 72 ++++++++++++++
tests/unit/cmk_base/test_config.py | 23 +++++
tests/unit/cmk_base/test_core_config.py | 51 +++++++++-
web/htdocs/themes/classic/scss/_pages.scss | 15 ++-
web/htdocs/themes/classic/scss/_wato.scss | 4 -
web/htdocs/themes/facelift/scss/_pages.scss | 46 +++++++++
web/htdocs/themes/facelift/theme.scss | 1 +
30 files changed, 456 insertions(+), 234 deletions(-)
Diff: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commitdiff;h=96e37d8a45…
Module: check_mk
Branch: master
Commit: 2ddbccb3e9d49b124f3da169583620567bddef70
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=2ddbccb3e9d49b…
Author: Moritz Kiemer <mo(a)mathias-kettner.de>
Date: Mon Apr 1 14:31:01 2019 +0200
apache_status: refactor III
Change-Id: Icde1c8653de6335a1f2ee97a5a6b5877ffb37a3a
---
agents/plugins/apache_status | 47 ++++++++++++++++++++++----------------------
1 file changed, 24 insertions(+), 23 deletions(-)
diff --git a/agents/plugins/apache_status b/agents/plugins/apache_status
index 191e368..671d30a 100755
--- a/agents/plugins/apache_status
+++ b/agents/plugins/apache_status
@@ -133,6 +133,28 @@ def no_cert_verification():
return context
+def get_response(proto, address, portspec, page):
+ is_local = address in ("127.0.0.1", "[::1]", "localhost")
+ url = '%s://%s%s/%s?auto' % (proto, address, portspec, page)
+ # Try to fetch the status page for each server
+ try:
+ request = urllib2.Request(url, headers={"Accept": "text/plain"})
+ return urllib2.urlopen(request)
+ except urllib2.URLError, e:
+ if 'unknown protocol' in str(e):
+ # HACK: workaround misconfigurations where port 443 is used for
+ # serving non ssl secured http
+ url = 'http://%s%s/server-status?auto' % (address, portspec)
+ return urllib2.urlopen(url)
+ raise
+ except Exception, e:
+ if 'doesn\'t match' in str(e) and is_local:
+ # HACK: workaround if SSL port is found and localhost is using
+ # SSL connections but certificate does not match
+ return urllib2.urlopen(url, context=no_cert_verification())
+ raise
+
+
def main():
config = get_config()
servers = config["servers"]
@@ -148,31 +170,10 @@ def main():
for server in servers:
proto, address, port, page = _unpack_server(server)
portspec = ':%d' % port if port else ''
- is_local = address in ("127.0.0.1", "[::1]", "localhost")
try:
- url = '%s://%s%s/%s?auto' % (proto, address, portspec, page)
- # Try to fetch the status page for each server
- try:
- request = urllib2.Request(url, headers={"Accept": "text/plain"})
- fd = urllib2.urlopen(request)
- except urllib2.URLError, e:
- if 'unknown protocol' in str(e):
- # HACK: workaround misconfigurations where port 443 is used for
- # serving non ssl secured http
- url = 'http://%s%s/server-status?auto' % (address, portspec)
- fd = urllib2.urlopen(url)
- else:
- raise
- except Exception, e:
- if 'doesn\'t match' in str(e) and is_local:
- # HACK: workaround if SSL port is found and localhost is using
- # SSL connections but certificate does not match
- fd = urllib2.urlopen(url, context=no_cert_verification())
- else:
- raise
-
- for line in fd.read().split('\n'):
+ response = get_response(proto, address, portspec, page)
+ for line in response.read().split('\n'):
if not line.strip():
continue
if line.lstrip()[0] == '<':