Module: check_mk
Branch: master
Commit: 5241b9bae259b6c8e5dc45503d5ebef7b39d892f
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=5241b9bae259b6…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Tue Dec 4 13:12:20 2018 +0100
6921 FIX pushover: Fixed not working proxy setting
The proxy setting of the pushover notification script was not working at all
since its implementation with werk #4592.
Change-Id: Ib229e70d2d4befec323accb775fe85305f032790
---
.werks/6921 | 12 ++++++++++++
cmk/notification_plugins/pushover.py | 8 ++------
2 files changed, 14 insertions(+), 6 deletions(-)
diff --git a/.werks/6921 b/.werks/6921
new file mode 100644
index 0000000..97eadc9
--- /dev/null
+++ b/.werks/6921
@@ -0,0 +1,12 @@
+Title: pushover: Fixed not working proxy setting
+Level: 1
+Component: notifications
+Class: fix
+Compatible: compat
+Edition: cre
+State: unknown
+Version: 1.6.0i1
+Date: 1543914154
+
+The proxy setting of the pushover notification script was not working at all
+since its implementation with werk #4592.
diff --git a/cmk/notification_plugins/pushover.py b/cmk/notification_plugins/pushover.py
index 17c1fb4..aa458da 100644
--- a/cmk/notification_plugins/pushover.py
+++ b/cmk/notification_plugins/pushover.py
@@ -113,12 +113,8 @@ def send_push_notification(api_key, recipient_key, subject, text, context):
params.append(("sound", context["PARAMETER_SOUND"]))
s = requests.Session()
- if context.get("PARAMETER_PROXY"):
- if context["PARAMETER_PROXY"].startswith('https'):
- protocol = 'https'
- else:
- protocol = 'http'
- r = s.post(api_url, params=dict(params), proxies={protocol: context["PARAMETER_PROXY"]})
+ if context.get("PARAMETER_PROXY_URL"):
+ r = s.post(api_url, params=dict(params), proxies={"https": context["PARAMETER_PROXY_URL"]})
else:
r = s.post(api_url, params=dict(params))
Module: check_mk
Branch: master
Commit: b71dfdf954ce946e67b545e650062b962008a3ca
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=b71dfdf954ce94…
Author: Tom Baerwinkel <tb(a)mathias-kettner.de>
Date: Tue Nov 27 17:06:57 2018 +0100
k8s_conditions: new check to monitor the condition of a node
CMK-1406
Change-Id: I12aeb10c5afbc7125b461f1f54138d259d6346e0
---
agents/special/agent_kubernetes | 1 +
checkman/k8s_conditions | 13 +++++
checks/k8s_conditions | 64 ++++++++++++++++++++++
.../datasets/k8s_conditions_regression.py | 22 ++++++++
4 files changed, 100 insertions(+)
diff --git a/agents/special/agent_kubernetes b/agents/special/agent_kubernetes
index 85ea7ca..f0a52c6 100755
--- a/agents/special/agent_kubernetes
+++ b/agents/special/agent_kubernetes
@@ -613,6 +613,7 @@ class ApiData(object):
g.join('k8s_resources', self.nodes.resources())
g.join('k8s_resources', self.pods.resources_per_node())
g.join('k8s_resources', self.pods.pods_per_node())
+ g.join('k8s_conditions', self.nodes.conditions())
return '\n'.join(g.output())
diff --git a/checkman/k8s_conditions b/checkman/k8s_conditions
new file mode 100644
index 0000000..af804d0
--- /dev/null
+++ b/checkman/k8s_conditions
@@ -0,0 +1,13 @@
+title: Kubernetes conditions
+agents: linux
+catalog: app/kubernetes
+license: GPL
+distribution: check_mk
+description:
+ This check monitors different error conditions like disk pressure, kernel
+ deadlocks as well as the readiness status of nodes in a kubernetes cluster.
+ If an error condition is detected or a node is not ready the check returns
+ {CRIT} otherwise {OK}.
+
+inventory:
+ One service is created for each condition and one for the readiness status.
\ No newline at end of file
diff --git a/checks/k8s_conditions b/checks/k8s_conditions
new file mode 100644
index 0000000..fb6007b
--- /dev/null
+++ b/checks/k8s_conditions
@@ -0,0 +1,64 @@
+#!/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.
+
+
+def parse_k8s_conditions(info):
+ import json
+ return json.loads(info[0][0])
+
+
+@discover
+def inventory_k8s_conditions(condition, _value):
+ return condition in {
+ "DiskPressure",
+ "OutOfDisk",
+ "MemoryPressure",
+ "Ready",
+ "NetworkUnavailable",
+ "KernelDeadlock",
+ }
+
+
+@get_parsed_item_data
+def check_k8s_conditions(item, _no_params, value):
+ expected_values = {
+ "DiskPressure": "False",
+ "OutOfDisk": "False",
+ "MemoryPressure": "False",
+ "Ready": "True",
+ "NetworkUnavailable": "False",
+ "KernelDeadlock": "False",
+ }
+ status = 0 if value == expected_values[item] else 2
+ return status, value
+
+
+check_info['k8s_conditions'] = {
+ 'parse_function': parse_k8s_conditions,
+ 'inventory_function': inventory_k8s_conditions,
+ 'check_function': check_k8s_conditions,
+ 'service_description': 'Condition %s',
+}
diff --git a/tests/unit/checks/generictests/datasets/k8s_conditions_regression.py b/tests/unit/checks/generictests/datasets/k8s_conditions_regression.py
new file mode 100644
index 0000000..2084b7f
--- /dev/null
+++ b/tests/unit/checks/generictests/datasets/k8s_conditions_regression.py
@@ -0,0 +1,22 @@
+
+
+checkname = 'k8s_conditions'
+
+
+info = [[u'{"DiskPressure": "False", "OutOfDisk": "False", "MemoryPressure": "False", "Ready": "False", "NetworkUnavailable": "False", "KernelDeadlock": "True"}']]
+
+
+discovery = {'': [(u'DiskPressure', {}),
+ (u'KernelDeadlock', {}),
+ (u'MemoryPressure', {}),
+ (u'NetworkUnavailable', {}),
+ (u'OutOfDisk', {}),
+ (u'Ready', {})]}
+
+
+checks = {'': [(u'DiskPressure', 'default', [(0, u'False', [])]),
+ (u'KernelDeadlock', 'default', [(2, u'True', [])]),
+ (u'MemoryPressure', 'default', [(0, u'False', [])]),
+ (u'NetworkUnavailable', 'default', [(0, u'False', [])]),
+ (u'OutOfDisk', 'default', [(0, u'False', [])]),
+ (u'Ready', 'default', [(2, u'False', [])])]}