Module: check_mk
Branch: master
Commit: 6fda98fb8cc91a507e486c84860eadf0b8b7f709
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=6fda98fb8cc91a…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Wed Apr 11 11:48:16 2018 +0200
5970 Cascading livestatus proxy is now possible
It is now possible to cascade livestatus proxy configurations. This comes in
handy to build cascaded distributed GUI (status GUI) setups.
The feature has been build for a scenario like this:
<ul>
<li>A distributed setup where you have remote sites that are not directly
reachable</li> <li>These remote sites are only reachable through a single
"location master" site</li> <li>You use the "location masters" for
configuration of all the related sites</li> <li>The central site is only used
as central operating site (overview, reporting) and not for configuration</li>
</ul>
To get a cascading setup, configure Check_MK like this:
<ul>
<li>Location master: Create one site in "Distributed configuration" for each
local site. Configure the connection parameters to use the Livestatus Proxy.
Set the new option to open a TCP port for this connection and insert a TCP port
that is currently not used on the local machine (e.g. 6560).</li> <li>Central
viewer site: Create one site in "Distributed configuration" for each remote
site. Configure it to use the Livestatus Proxy. Set the destination IP address
to the IP address of the "Location master" server and set the TCP port to the
port you configured for the site in the previous step.</li>
</ul>
After this you should be able to connect to your cascaded remote sites through
the Livestatus Proxy of the "Location master".
Change-Id: I28bf7940ad6ee63462fb3bd59da0c6c1727583a4
---
.werks/5970 | 37 +++++++++++++++++++++++++++++++++++
web/htdocs/wato.py | 3 ++-
web/htdocs/watolib.py | 22 +++++++++++++++++++++
web/plugins/wato/omd_configuration.py | 22 +--------------------
4 files changed, 62 insertions(+), 22 deletions(-)
diff --git a/.werks/5970 b/.werks/5970
new file mode 100644
index 0000000..7872423
--- /dev/null
+++ b/.werks/5970
@@ -0,0 +1,37 @@
+Title: Cascading livestatus proxy is now possible
+Level: 2
+Component: liveproxy
+Compatible: compat
+Edition: cee
+Version: 1.5.0b2
+Date: 1523438853
+Class: feature
+
+It is now possible to cascade livestatus proxy configurations. This comes in
+handy to build cascaded distributed GUI (status GUI) setups.
+
+The feature has been build for a scenario like this:
+
+<ul>
+<li>A distributed setup where you have remote sites that are not directly
+reachable</li> <li>These remote sites are only reachable through a single
+"location master" site</li> <li>You use the "location masters" for
+configuration of all the related sites</li> <li>The central site is only used
+as central operating site (overview, reporting) and not for configuration</li>
+</ul>
+
+To get a cascading setup, configure Check_MK like this:
+
+<ul>
+<li>Location master: Create one site in "Distributed configuration" for each
+local site. Configure the connection parameters to use the Livestatus Proxy.
+Set the new option to open a TCP port for this connection and insert a TCP port
+that is currently not used on the local machine (e.g. 6560).</li> <li>Central
+viewer site: Create one site in "Distributed configuration" for each remote
+site. Configure it to use the Livestatus Proxy. Set the destination IP address
+to the IP address of the "Location master" server and set the TCP port to the
+port you configured for the site in the previous step.</li>
+</ul>
+
+After this you should be able to connect to your cascaded remote sites through
+the Livestatus Proxy of the "Location master".
diff --git a/web/htdocs/wato.py b/web/htdocs/wato.py
index 1570cca..103ed30 100644
--- a/web/htdocs/wato.py
+++ b/web/htdocs/wato.py
@@ -17471,7 +17471,8 @@ from watolib import \
ACTest, \
ACResultCRIT, \
ACResultWARN, \
- ACResultOK
+ ACResultOK, \
+ LivestatusViaTCP
def make_action_link(vars):
diff --git a/web/htdocs/watolib.py b/web/htdocs/watolib.py
index aef3b35..f345c05 100644
--- a/web/htdocs/watolib.py
+++ b/web/htdocs/watolib.py
@@ -10024,3 +10024,25 @@ def format_config_value(value):
return format_func(value)
+class LivestatusViaTCP(Dictionary):
+ def __init__(self, **kwargs):
+ kwargs["elements"] = [
+ ("port", Integer(
+ title = _("TCP port"),
+ minvalue = 1,
+ maxvalue = 65535,
+ default_value = kwargs.get("tcp_port", 6557),
+ )),
+ ("only_from", ListOfStrings(
+ title = _("Restrict access to IP addresses"),
+ help = _("The access to Livestatus via TCP will only be allowed from the "
+ "configured source IP addresses. You can either configure specific "
+ "IP addresses or networks in the syntax <tt>10.3.3.0/24</tt>."),
+
+ valuespec = IPv4Network(),
+ orientation = "horizontal",
+ allow_empty = False,
+ )),
+ ]
+ kwargs["optional_keys"] = [ "only_from" ]
+ super(LivestatusViaTCP, self).__init__(**kwargs)
diff --git a/web/plugins/wato/omd_configuration.py b/web/plugins/wato/omd_configuration.py
index 6933ad5..6905396 100644
--- a/web/plugins/wato/omd_configuration.py
+++ b/web/plugins/wato/omd_configuration.py
@@ -83,27 +83,7 @@ register_configvar(group,
register_configvar(group,
"site_livestatus_tcp",
Optional(
- Dictionary(
- elements = [
- ("port", Integer(
- title = _("TCP port"),
- minvalue = 1,
- maxvalue = 65535,
- default_value = 6557,
- )),
- ("only_from", ListOfStrings(
- title = _("Restrict access to IP addresses"),
- help = _("The access to Livestatus via TCP will only be allowed from the "
- "configured source IP addresses. You can either configure specific "
- "IP addresses or networks in the syntax <tt>10.3.3.0/24</tt>."),
-
- valuespec = IPv4Network(),
- orientation = "horizontal",
- allow_empty = False,
- )),
- ],
- optional_keys = [ "only_from" ],
- ),
+ LivestatusViaTCP(),
title = _("Access to Livestatus via TCP"),
help = _("Check_MK Livestatus usually listens only on a local UNIX socket - "
"for reasons of performance and security. This option is used "
Module: check_mk
Branch: master
Commit: 7e3a87fb2fb256e4e69798de546e5a7d48e1cd1c
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=7e3a87fb2fb256…
Author: Tom Baerwinkel <tb(a)mathias-kettner.de>
Date: Wed Apr 11 15:43:56 2018 +0200
Make _what an instance attribute for custom host/user attributes
Previously, _what was a class attribute defined in subclasses, but was
used already in the base classes. Now, _what is made an instance
attribute defined in the base class itself. This makes the use of _what
more explicit. This is sufficient to make pylint happy again.
In the long run _what has to be moved to the subclasses, because
base classes should not now implementation details of child classes.
Change-Id: I19edbe611a115aab26a28009e337981636b8e405
---
web/htdocs/wato.py | 32 +++++++++++++++++++++++++-------
1 file changed, 25 insertions(+), 7 deletions(-)
diff --git a/web/htdocs/wato.py b/web/htdocs/wato.py
index d6adb02..1570cca 100644
--- a/web/htdocs/wato.py
+++ b/web/htdocs/wato.py
@@ -15522,6 +15522,15 @@ class ModePatternEditor(WatoMode):
# '----------------------------------------------------------------------'
class CustomAttrMode(WatoMode):
+ def __init__(self, what):
+ # TODO: move _what to the subclasses.
+ # Note: _what is used in _from_vars defined in the subclass
+ # ModeEditCustomAttr but called in the base class WatoMode.
+ # Therefore, we have to set it before init right now.
+ self._what = what
+ super(CustomAttrMode, self).__init__()
+
+
@classmethod
def custom_attr_types(cls):
return [
@@ -15572,6 +15581,10 @@ class CustomAttrMode(WatoMode):
class ModeEditCustomAttr(CustomAttrMode):
+ def __init__(self, what):
+ super(ModeEditCustomAttr, self).__init__(what)
+
+
def _from_vars(self):
self._name = html.var("edit") # missing -> new custom attr
self._new = self._name == None
@@ -15733,8 +15746,8 @@ class ModeEditCustomAttr(CustomAttrMode):
class ModeEditCustomUserAttr(ModeEditCustomAttr):
- # TODO: Cleanup "what" variable
- _what = "user"
+ def __init__(self):
+ super(ModeEditCustomUserAttr, self).__init__('user')
def title(self):
if self._new:
@@ -15749,7 +15762,8 @@ class ModeEditCustomUserAttr(ModeEditCustomAttr):
class ModeEditCustomHostAttr(ModeEditCustomAttr):
- _what = "host"
+ def __init__(self):
+ super(ModeEditCustomHostAttr, self).__init__('host')
def title(self):
if self._new:
@@ -15765,8 +15779,8 @@ class ModeEditCustomHostAttr(ModeEditCustomAttr):
class ModeCustomAttrs(CustomAttrMode):
- def __init__(self):
- super(ModeCustomAttrs, self).__init__()
+ def __init__(self, what):
+ super(ModeCustomAttrs, self).__init__(what)
self._load_attributes(lock=html.is_transaction())
@@ -15822,7 +15836,9 @@ class ModeCustomAttrs(CustomAttrMode):
class ModeCustomUserAttrs(ModeCustomAttrs):
- _what = "user"
+ def __init__(self):
+ super(ModeCustomUserAttrs, self).__init__('user')
+
def title(self):
return _("Custom User Attributes")
@@ -15835,7 +15851,9 @@ class ModeCustomUserAttrs(ModeCustomAttrs):
class ModeCustomHostAttrs(ModeCustomAttrs):
- _what = "host"
+ def __init__(self):
+ super(ModeCustomHostAttrs, self).__init__('host')
+
def title(self):
return _("Custom Host Attributes")
Module: check_mk
Branch: master
Commit: aefe581c22d47811b66b3c2fe62ebd205e44d6d7
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=aefe581c22d478…
Author: Tom Baerwinkel <tb(a)mathias-kettner.de>
Date: Wed Apr 11 17:50:19 2018 +0200
Make pylint happy in cmk/schedule.py
Change-Id: Iec0fbcc9ab91078f926283a79deb903ab2e368ed
---
cmk/schedule.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/cmk/schedule.py b/cmk/schedule.py
index 9ece34a..9aedec7 100644
--- a/cmk/schedule.py
+++ b/cmk/schedule.py
@@ -37,7 +37,7 @@ from dateutil.relativedelta import relativedelta
from dateutil.rrule import rrule, DAILY, WEEKLY, MONTHLY
-class Schedule:
+class Schedule(object):
"""
Abstract base class for schedules. A default implementation
for the last and next event at a given datetime are provided.