Module: check_mk
Branch: master
Commit: ce4e768ca69a9c4fa473ffff21425277c6800a7f
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=ce4e768ca69a9c…
Author: Simon Betz <si(a)mathias-kettner.de>
Date: Thu Dec 20 10:37:41 2018 +0100
aws_elb_summary, aws_elb_health: Checks for AWS/ELB (elastic load balancer)
Change-Id: Iec15456770c2a91c1f238aef8de66b9372804fbc
---
checkman/aws_elb_health | 15 ++++++++++
checkman/aws_elb_summary | 12 ++++++++
checks/aws_elb_health | 72 ++++++++++++++++++++++++++++++++++++++++++++++
checks/aws_elb_summary | 74 ++++++++++++++++++++++++++++++++++++++++++++++++
4 files changed, 173 insertions(+)
diff --git a/checkman/aws_elb_health b/checkman/aws_elb_health
new file mode 100644
index 0000000..e8dc160
--- /dev/null
+++ b/checkman/aws_elb_health
@@ -0,0 +1,15 @@
+title: AWS ELB Health
+agents: aws
+catalog: cloud/aws
+license: GPL
+distribution: check_mk
+description:
+ This check monitors all AWS ELB and reports a summary of their states.
+ To make this check work you have to configure the related special agent
+ {{Amazon Web Services (AWS)}}.
+
+ If the elastic load balancer is "in service" the check stats is OK,
+ if it is "out of service" the check state is WARN, otherwise UNKNOWN.
+
+inventory:
+ One service is created.
diff --git a/checkman/aws_elb_summary b/checkman/aws_elb_summary
new file mode 100644
index 0000000..d5a2596
--- /dev/null
+++ b/checkman/aws_elb_summary
@@ -0,0 +1,12 @@
+title: AWS ELB Summary
+agents: aws
+catalog: cloud/aws
+license: GPL
+distribution: check_mk
+description:
+ This check monitors all AWS ELB and reports a summary of their states.
+ To make this check work you have to configure the related special agent
+ {{Amazon Web Services (AWS)}}.
+
+inventory:
+ One summary service is created.
diff --git a/checks/aws_elb_health b/checks/aws_elb_health
new file mode 100644
index 0000000..99570c2
--- /dev/null
+++ b/checks/aws_elb_health
@@ -0,0 +1,72 @@
+#!/usr/bin/python
+# -*- encoding: utf-8; py-indent-offset: 4 -*-
+# +------------------------------------------------------------------+
+# | ____ _ _ __ __ _ __ |
+# | / ___| |__ ___ ___| | __ | \/ | |/ / |
+# | | | | '_ \ / _ \/ __| |/ / | |\/| | ' / |
+# | | |___| | | | __/ (__| < | | | | . \ |
+# | \____|_| |_|\___|\___|_|\_\___|_| |_|_|\_\ |
+# | |
+# | Copyright Mathias Kettner 2018 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-
+# tails. 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.
+
+AWSELBHealthMap = {
+ "InService": "in service",
+ "OutOfService": "out of service",
+ "Unknown": "unknown",
+}
+
+
+def parse_aws_elb_health(info):
+ try:
+ return parse_aws(info)[-1]
+ except IndexError:
+ return {}
+
+
+def inventory_aws_elb_health(parsed):
+ if parsed:
+ return [(None, {})]
+
+
+def check_aws_elb_health(item, params, parsed):
+ state_readable = AWSELBHealthMap[parsed['State']]
+ if state_readable == "in service":
+ state = 0
+ elif state_readable == "out of service":
+ state = 1
+ else:
+ state = 3
+ yield state, 'Status: %s' % state_readable
+ yield 0, 'Instance: %s' % parsed['InstanceId']
+
+ reason_code = parsed['ReasonCode']
+ if reason_code not in [None, "", "N/A"]:
+ yield 0, 'Reason: %s' % reason_code
+
+ description = parsed['Description']
+ if description not in [None, "", "N/A"]:
+ yield 0, 'Description: %s' % description
+
+
+check_info['aws_elb_health'] = {
+ 'parse_function': parse_aws_elb_health,
+ 'inventory_function': inventory_aws_elb_health,
+ 'check_function': check_aws_elb_health,
+ 'service_description': 'AWS/ELB Health ',
+ 'includes': ['aws.include'],
+}
diff --git a/checks/aws_elb_summary b/checks/aws_elb_summary
new file mode 100644
index 0000000..49e7ed6
--- /dev/null
+++ b/checks/aws_elb_summary
@@ -0,0 +1,74 @@
+#!/usr/bin/python
+# -*- encoding: utf-8; py-indent-offset: 4 -*-
+# +------------------------------------------------------------------+
+# | ____ _ _ __ __ _ __ |
+# | / ___| |__ ___ ___| | __ | \/ | |/ / |
+# | | | | '_ \ / _ \/ __| |/ / | |\/| | ' / |
+# | | |___| | | | __/ (__| < | | | | . \ |
+# | \____|_| |_|\___|\___|_|\_\___|_| |_|_|\_\ |
+# | |
+# | Copyright Mathias Kettner 2018 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-
+# tails. 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.
+
+AWSAvailabilityZoneMap = {
+ "us-east-1": "Virginia",
+ "us-west-1": "N. California",
+ "us-west-2": "Oregon",
+ "eu-west-1": "Ireland",
+ "eu-central-1": "Frankfurt",
+ "ap-southeast-1": "Singapore",
+ "ap-southeast-2": "Sydney",
+ "ap-northeast-1": "Tokyo",
+ "sa-east-1": "Sao Paulo",
+}
+
+
+def inventory_aws_elb_summary(parsed):
+ if parsed:
+ return [(None, {})]
+
+
+def check_aws_elb_summary(item, params, parsed):
+ yield 0, "Balancers: %s" % len(parsed)
+
+ balancers_by_avail_zone = {}
+ long_output = []
+ for row in parsed:
+ balancer_name = row['LoadBalancerName']
+ avail_zones_txt = []
+ for avail_zone in row['AvailabilityZones']:
+ avail_zone_readable = "%s (%s)" % (AWSAvailabilityZoneMap[avail_zone[:-1]],
+ avail_zone[-1])
+ balancers_by_avail_zone.setdefault(avail_zone_readable, []).append(balancer_name)
+ avail_zones_txt.append(avail_zone_readable)
+ long_output.append("Balancer: %s, Availability zones: %s"\
+ % (balancer_name, ", ".join(avail_zones_txt)))
+
+ for avail_zone, balancers in balancers_by_avail_zone.iteritems():
+ yield 0, "%s: %s" % (avail_zone, len(balancers))
+
+ if long_output:
+ yield 0, '\n%s' % '\n'.join(long_output)
+
+
+check_info['aws_elb_summary'] = {
+ 'parse_function': parse_aws,
+ 'inventory_function': inventory_aws_elb_summary,
+ 'check_function': check_aws_elb_summary,
+ 'service_description': 'AWS/ELB Summary',
+ 'includes': ['aws.include'],
+}
Module: check_mk
Branch: master
Commit: 3443fe05b997e127b1f968fcc2aa42cedad45b1f
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=3443fe05b997e1…
Author: Sven Panne <sp(a)mathias-kettner.de>
Date: Tue Jan 8 11:44:00 2019 +0100
Removed MultiSelect ValueSpec.
It has been dead for 7 years now and has probably bit-rotted. Furthermore,
it is one of the two remaining list_var() callers.
Change-Id: I75bcb9513311dfb1cf589d82feb7416804bcf51d
---
cmk/gui/valuespec.py | 29 -----------------------------
1 file changed, 29 deletions(-)
diff --git a/cmk/gui/valuespec.py b/cmk/gui/valuespec.py
index f822c93..e1d7b38 100644
--- a/cmk/gui/valuespec.py
+++ b/cmk/gui/valuespec.py
@@ -2229,35 +2229,6 @@ class ListChoice(ValueSpec):
return value not in d
-# A alternative way of editing list choices
-class MultiSelect(ListChoice):
- def __init__(self, **kwargs):
- ListChoice.__init__(self, **kwargs)
-
- def _render_field(self, name, choices, selected=None):
- if selected is None:
- selected = []
- html.open_select(multiple="", name=name)
- for key, title in choices:
- html.option(title, value=key, selected='' if key in selected else None)
-
- html.close_select()
-
- def render_input(self, varprefix, value):
- self.classtype_info()
- self.load_elements()
- self._render_field(varprefix, self._elements, value)
-
- def from_html_vars(self, varprefix):
- self.load_elements()
- value = []
- hv = html.request.list_var(varprefix)
- for key, _title in self._elements:
- if key in hv:
- value.append(key)
- return value
-
-
# Implements a choice of items which is realized with
# two ListChoices select fields. One contains all available
# items and one contains all selected items.
Module: check_mk
Branch: master
Commit: 7771d591e0b3fef7f7d89cebe60b05a340b3e2d4
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=7771d591e0b3fe…
Author: Sven Panne <sp(a)mathias-kettner.de>
Date: Tue Jan 8 11:55:03 2019 +0100
Make test_start_job a bit more stable.
Basically the test is fundamentally broken, we just make it a bit more
likely that it succeeds, see a similar commit for test_locking... :-P
Change-Id: I0a8bb6d74e0fefbce00e657a668e88c119d68bdf
---
tests/unit/cmk/gui/test_background_job.py | 1 +
1 file changed, 1 insertion(+)
diff --git a/tests/unit/cmk/gui/test_background_job.py b/tests/unit/cmk/gui/test_background_job.py
index 4a17e82..fadd6a0 100644
--- a/tests/unit/cmk/gui/test_background_job.py
+++ b/tests/unit/cmk/gui/test_background_job.py
@@ -67,6 +67,7 @@ def test_start_job():
assert status["state"] == background_job.JobStatus.state_initialized
job.start()
+ time.sleep(0.2)
assert job.is_running()
with pytest.raises(background_job.BackgroundJobAlreadyRunning):
Module: check_mk
Branch: master
Commit: 39be35628be1e25fc71bcc077ca37c09a3992d56
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=39be35628be1e2…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Tue Jan 8 11:54:06 2019 +0100
Updated haproxy section to also handle /var/lib/haproxy/stats
Change-Id: I4741861de154bc449ea24a2ad780ea255aa2684f
---
agents/check_mk_agent.linux | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)
diff --git a/agents/check_mk_agent.linux b/agents/check_mk_agent.linux
index 8e895b0..5e42273 100755
--- a/agents/check_mk_agent.linux
+++ b/agents/check_mk_agent.linux
@@ -1032,10 +1032,12 @@ if type pvecm > /dev/null 2>&1 ; then
pvecm nodes
fi
-if [ -r /run/haproxy/admin.sock ] && type socat >/dev/null 2>&1; then
- echo "<<<haproxy:sep(44)>>>"
- echo "show stat" | socat - UNIX-CONNECT:/run/haproxy/admin.sock
-fi
+for HAPROXY_SOCK in /run/haproxy/admin.sock /var/lib/haproxy/stats; do
+ if [ -r "$HAPROXY_SOCK" ] && type socat >/dev/null 2>&1; then
+ echo "<<<haproxy:sep(44)>>>"
+ echo "show stat" | socat - "UNIX-CONNECT:$HAPROXY_SOCK"
+ fi
+done
# Start new liveupdate process in background on each agent execution. Starting
# a new live update process will terminate the old one automatically after
Module: check_mk
Branch: master
Commit: 8c8917b84efdd5d3cd62ba06c97daae465f7a9fe
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=8c8917b84efdd5…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Tue Jan 8 11:12:58 2019 +0100
Fix new styled dropdowns for dropdowns added dynamically (e.g. with ListOf)
Initialize select2 only for the visible dropdowns and call the
initialization dynamically after adding the new dropdown in ListOf code
CMK-1504
Change-Id: I2509640158ac635a85e22a95023c4608cf21ddd0
---
web/htdocs/js/modules/forms.js | 10 ++++++++--
web/htdocs/js/modules/valuespecs.js | 2 ++
2 files changed, 10 insertions(+), 2 deletions(-)
diff --git a/web/htdocs/js/modules/forms.js b/web/htdocs/js/modules/forms.js
index 29f65cb..a81ab30 100644
--- a/web/htdocs/js/modules/forms.js
+++ b/web/htdocs/js/modules/forms.js
@@ -29,8 +29,14 @@ import * as utils from "utils";
// html.dropdown() adds the .select2-enable class for all dropdowns
// that should use the select2 powered dropdowns
-export function enable_select2() {
- $(".select2-enable").select2({
+export function enable_select2(container=null) {
+ let elements;
+ if (container)
+ elements = $(container).find(".select2-enable:visible");
+ else
+ elements = $(".select2-enable:visible");
+
+ elements.select2({
dropdownAutoWidth : true,
minimumResultsForSearch: 5
});
diff --git a/web/htdocs/js/modules/valuespecs.js b/web/htdocs/js/modules/valuespecs.js
index 4f31d33..57d9318 100644
--- a/web/htdocs/js/modules/valuespecs.js
+++ b/web/htdocs/js/modules/valuespecs.js
@@ -25,6 +25,7 @@
import * as utils from "utils";
import * as popup_menu from "popup_menu";
import * as ajax from "ajax";
+import * as forms from "forms";
import * as colorpicker from "colorpicker";
//# +--------------------------------------------------------------------+
@@ -209,6 +210,7 @@ export function listof_add(varprefix, magic, style)
container.appendChild(new_child);
utils.execute_javascript_by_object(new_child);
+ forms.enable_select2(new_child);
listof_update_indices(varprefix);
}