Module: check_mk
Branch: master
Commit: e3b8e5a316f722d746c7be679b5aba022cf6316c
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=e3b8e5a316f722…
Author: Sven Rueß <sr(a)mathias-kettner.de>
Date: Fri Mar 3 16:09:32 2017 +0100
Updated werk 8285
Change-Id: Iecbdbe5a619ff791d01e8d94a4545a208289e106
---
.werks/8285 | 18 +++++++++++-------
1 file changed, 11 insertions(+), 7 deletions(-)
diff --git a/.werks/8285 b/.werks/8285
index 555462b..c2dfc50 100644
--- a/.werks/8285
+++ b/.werks/8285
@@ -15,20 +15,24 @@ Service description for IPv6 Apache status information services will change,
because the general CIDR notation will be used as new service description.
In version 1.2.8 and 1.4.0:
-Apache ::1:80 Status
-Apache 2001:cdba::3257:9652:443 Status
+<ul>
+ <li>Apache ::1:80 Status</li>
+ <li>Apache 2001:cdba::3257:9652:443 Status</li>
+</ul>
Since version 1.5.0:
-Apache [::1]:80 Status
-Apache [2001:cdba::3257:9652]:443 Status
+<ul>
+ <li>Apache [::1]:80 Status</li>
+ <li>Apache [2001:cdba::3257:9652]:443 Status</li>
+</ul>
If historic information should not be lost and graphs should be continued,
then you have to follow three steps:
<ul>
- <li>Rename existing RRDs to new service description:
- Example:
- mv Apache___1_80_Status.rrd Apache_[__1]_80_Status.rrd
+ <li>Rename existing RRDs to new service description:<br>
+ Example:<br>
+ mv Apache___1_80_Status.rrd Apache_[__1]_80_Status.rrd<br>
mv Apache_2001_cdba__3257_9652_443_Status.rrd Apache_[2001_cdba__3257_9652]_443_Status.rrd
</li>
<li>Update apache_status plugin on monitored hosts</li>
Module: check_mk
Branch: master
Commit: 64c6e23f074ba9ce45702cfa7cd57688f1ceef57
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=64c6e23f074ba9…
Author: Sven Rueß <sr(a)mathias-kettner.de>
Date: Fri Mar 3 15:42:10 2017 +0100
8285 FIX apache_status: Fixed wrong IPv6 URLs to query the information
If the information from Apache is queried by IPv6, the request was denied,
because we created a bad request. Now IPv6 addresses are surrounded by
square bracket.
Service description for IPv6 Apache status information services will change,
because the general CIDR notation will be used as new service description.
In version 1.2.8 and 1.4.0:
Apache ::1:80 Status
Apache 2001:cdba::3257:9652:443 Status
Since version 1.5.0:
Apache [::1]:80 Status
Apache [2001:cdba::3257:9652]:443 Status
If historic information should not be lost and graphs should be continued,
then you have to follow three steps:
<ul>
<li>Rename existing RRDs to new service description:
Example:
mv Apache___1_80_Status.rrd Apache_[__1]_80_Status.rrd
mv Apache_2001_cdba__3257_9652_443_Status.rrd Apache_[2001_cdba__3257_9652]_443_Status.rrd
</li>
<li>Update apache_status plugin on monitored hosts</li>
<li>Make a service discovery of the affected hosts</li>
</ul>
Change-Id: I59ba71ed27a445dc4606cc986bb3e34a1901edc6
---
.werks/8285 | 36 ++++++++++++++++++++++++++++++++++++
agents/plugins/apache_status | 16 ++++++++++++----
2 files changed, 48 insertions(+), 4 deletions(-)
diff --git a/.werks/8285 b/.werks/8285
new file mode 100644
index 0000000..555462b
--- /dev/null
+++ b/.werks/8285
@@ -0,0 +1,36 @@
+Title: apache_status: Fixed wrong IPv6 URLs to query the information
+Level: 1
+Component: checks
+Compatible: incomp
+Edition: cee
+Version: 1.5.0i1
+Date: 1488549674
+Class: fix
+
+If the information from Apache is queried by IPv6, the request was denied,
+because we created a bad request. Now IPv6 addresses are surrounded by
+square bracket.
+
+Service description for IPv6 Apache status information services will change,
+because the general CIDR notation will be used as new service description.
+
+In version 1.2.8 and 1.4.0:
+Apache ::1:80 Status
+Apache 2001:cdba::3257:9652:443 Status
+
+Since version 1.5.0:
+Apache [::1]:80 Status
+Apache [2001:cdba::3257:9652]:443 Status
+
+If historic information should not be lost and graphs should be continued,
+then you have to follow three steps:
+
+<ul>
+ <li>Rename existing RRDs to new service description:
+ Example:
+ mv Apache___1_80_Status.rrd Apache_[__1]_80_Status.rrd
+ mv Apache_2001_cdba__3257_9652_443_Status.rrd Apache_[2001_cdba__3257_9652]_443_Status.rrd
+ </li>
+ <li>Update apache_status plugin on monitored hosts</li>
+ <li>Make a service discovery of the affected hosts</li>
+</ul>
diff --git a/agents/plugins/apache_status b/agents/plugins/apache_status
index 2c986f9..d92f15d 100755
--- a/agents/plugins/apache_status
+++ b/agents/plugins/apache_status
@@ -63,9 +63,11 @@ ssl_ports = [ 443, ]
if os.path.exists(config_file):
execfile(config_file)
+
def try_detect_servers():
pids = []
results = []
+
for line in os.popen('netstat -tlnp 2>/dev/null').readlines():
parts = line.split()
# Skip lines with wrong format
@@ -91,7 +93,6 @@ def try_detect_servers():
continue
pids.append(pid)
- proto = 'http'
address, port = parts[3].rsplit(':', 1)
port = int(port)
@@ -99,17 +100,22 @@ def try_detect_servers():
if address == '0.0.0.0':
address = '127.0.0.1'
elif address == '::':
- address = '::1'
+ address = '[::1]'
+ elif ':' in address:
+ address = '[%s]' % address
# Switch protocol if port is SSL port. In case you use SSL on another
# port you would have to change/extend the ssl_port list
if port in ssl_ports:
proto = 'https'
+ else:
+ proto = 'http'
results.append((proto, address, port))
return results
+
if servers is None:
servers = try_detect_servers()
@@ -117,6 +123,7 @@ if servers is None:
if not servers:
sys.exit(0)
+
sys.stdout.write('<<<apache_status>>>\n')
for server in servers:
if isinstance(server, tuple):
@@ -147,7 +154,7 @@ for server in servers:
except Exception, e:
if 'doesn\'t match' in str(e):
# HACK: workaround if SSL port is found and localhost is using
- # SSL connections but certifiacte is mismatched
+ # SSL connections but certificate does not match
portspec = ':80'
url = 'http://%s%s/server-status?auto' % (address, portspec)
fd = urllib2.urlopen(url)
@@ -158,8 +165,9 @@ for server in servers:
if not line.strip():
continue
if line.lstrip()[0] == '<':
- # seems to be html output. Skip this server.
+ # Seems to be html output. Skip this server.
break
+
sys.stdout.write("%s %s %s\n" % (address, port, line))
except urllib2.HTTPError, e:
sys.stderr.write('HTTP-Error (%s%s): %s %s\n' % (address, portspec, e.code, e))
Module: check_mk
Branch: master
Commit: 53dcc0828bf2caa1062881bd47982fb5f8c259d3
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=53dcc0828bf2ca…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Fri Mar 3 13:10:42 2017 +0100
4423 FIX Availability of service filtered views was showing services multiple times
When a service is in multiple service groups and a view is filtered by a single service
group and the availability view is grouped by service groups, a single service was
shown multiple times. Once for each service group membership.
The service is now shown only for the filtered service group memberships.
Change-Id: I9ad374abe29d6f7cf1dca24201281ddb99be3e87
---
.werks/4423 | 15 +++++++++++
web/htdocs/availability.py | 56 ++++++++++++++++++++++++++++++++++++++-
web/htdocs/views.py | 6 ++++-
web/plugins/views/availability.py | 4 +--
4 files changed, 77 insertions(+), 4 deletions(-)
diff --git a/.werks/4423 b/.werks/4423
new file mode 100644
index 0000000..22d2bf6
--- /dev/null
+++ b/.werks/4423
@@ -0,0 +1,15 @@
+Title: Availability of service filtered views was showing services multiple times
+Level: 1
+Component: multisite
+Class: fix
+Compatible: compat
+Edition: cre
+State: unknown
+Version: 1.5.0i1
+Date: 1488542925
+
+When a service is in multiple service groups and a view is filtered by a single service
+group and the availability view is grouped by service groups, a single service was
+shown multiple times. Once for each service group membership.
+
+The service is now shown only for the filtered service group memberships.
diff --git a/web/htdocs/availability.py b/web/htdocs/availability.py
index 6b4dba0..54dbbdc 100644
--- a/web/htdocs/availability.py
+++ b/web/htdocs/availability.py
@@ -640,7 +640,7 @@ def get_outage_statistic_options(avoptions):
# of spans. Each span is a dictionary that describes one span of time where
# a specific host or service has one specific state.
# what is either "host" or "service" or "bi".
-def get_availability_rawdata(what, filterheaders, only_sites, av_object, include_output, avoptions):
+def get_availability_rawdata(what, context, filterheaders, only_sites, av_object, include_output, avoptions):
if what == "bi":
return get_bi_availability_rawdata(filterheaders, only_sites, av_object, include_output, avoptions)
@@ -692,6 +692,10 @@ def get_availability_rawdata(what, filterheaders, only_sites, av_object, include
columns = ["site"] + columns
spans = [ dict(zip(columns, span)) for span in data ]
+ # When a group filter is set, only care about these groups in the group fields
+ if avoptions["grouping"] not in [ None, "host" ]:
+ filter_groups_of_entries(context, avoptions, spans)
+
# Now we find out if the log row limit was exceeded or
# if the log's length is the limit by accident.
# If this limit was exceeded then we cut off the last element
@@ -702,6 +706,56 @@ def get_availability_rawdata(what, filterheaders, only_sites, av_object, include
return spans_by_object(spans, logrow_limit_reached_entry)
+
+def filter_groups_of_entries(context, avoptions, spans):
+ group_by = avoptions["grouping"]
+
+ only_groups = set()
+ # TODO: This is a dirty hack. The logic of the filters needs to be moved to the filters.
+ # They need to be able to filter the list of all groups.
+ # TODO: Negated filters are not handled here. :(
+ if group_by == "service_groups":
+ # Extract from context:
+ # 'servicegroups': {'servicegroups': 'cpu|disk', 'neg_servicegroups': 'off'},
+ # 'optservicegroup': {'optservice_group': '', 'neg_optservice_group': 'off'},
+ negated = context.get("servicegroups", {}).get("neg_servicegroups") == "on"
+ if negated:
+ return
+
+ only_groups.update([ e for e in context.get("servicegroups", {}).get("servicegroups", "").split("|") if e ])
+
+ negated = context.get("optservicegroup", {}).get("neg_optservice_group") == "on"
+ if negated:
+ return
+
+ group_name = context.get("optservicegroup", {}).get("optservice_group")
+ if group_name and not negated:
+ only_groups.add(group_name)
+
+ elif group_by == "host_groups":
+ html.log(repr(context))
+ negated = context.get("hostgroups", {}).get("neg_hostgroups") == "on"
+ if negated:
+ return
+
+ only_groups.update([ e for e in context.get("hostgroups", {}).get("hostgroups", "").split("|") if e ])
+
+ negated = context.get("opthostgroup", {}).get("neg_opthost_group") == "on"
+ if negated:
+ return
+
+ group_name = context.get("opthostgroup", {}).get("opthost_group")
+ if group_name and not negated:
+ only_groups.add(group_name)
+
+ else:
+ raise NotImplementedError()
+
+ for span in spans:
+ filtered_groups = list(set(span[group_by]).intersection(only_groups))
+ span[group_by] = filtered_groups
+
+
# Sort the raw spans into a tree of dicts, so that we
# have easy access to the timeline of each object
def spans_by_object(spans, logrow_limit_reached_entry):
diff --git a/web/htdocs/views.py b/web/htdocs/views.py
index 7d1de2d..384f3a7 100644
--- a/web/htdocs/views.py
+++ b/web/htdocs/views.py
@@ -1544,7 +1544,11 @@ def show_view(view, show_heading = False, show_buttons = True,
# hosts and service table, but "statehist". This is *not* true for BI availability, though (see later)
if html.var("mode") == "availability" and (
"aggr" not in datasource["infos"] or html.var("timeline_aggr")):
- return render_availability_page(view, datasource, filterheaders, only_sites, limit)
+
+ context = visuals.get_context_from_uri_vars(datasource['infos'])
+ context.update(visuals.get_singlecontext_html_vars(view))
+
+ return render_availability_page(view, datasource, context, filterheaders, only_sites, limit)
query = filterheaders + view.get("add_headers", "")
diff --git a/web/plugins/views/availability.py b/web/plugins/views/availability.py
index 4b7e974..4447439 100644
--- a/web/plugins/views/availability.py
+++ b/web/plugins/views/availability.py
@@ -138,7 +138,7 @@ def render_availability_options(what):
# Render the page showing availability table or timelines. It
# is (currently) called by views.py, when showing a view but
# availability mode is activated.
-def render_availability_page(view, datasource, filterheaders, only_sites, limit):
+def render_availability_page(view, datasource, context, filterheaders, only_sites, limit):
if handle_edit_annotations():
return
@@ -191,7 +191,7 @@ def render_availability_page(view, datasource, filterheaders, only_sites, limit)
# Now compute all data, we need this also for CSV export
if not html.has_user_errors():
av_rawdata, has_reached_logrow_limit = \
- availability.get_availability_rawdata(what, filterheaders, only_sites,
+ availability.get_availability_rawdata(what, context, filterheaders, only_sites,
av_object, av_mode == "timeline", avoptions)
av_data = availability.compute_availability(what, av_rawdata, avoptions)