Module: check_mk
Branch: master
Commit: 80e15e05d1d147579e80fc5c5f8762fa72c42323
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=80e15e05d1d147…
Author: Moritz Kiemer <mo(a)mathias-kettner.de>
Date: Tue Oct 23 15:22:11 2018 +0200
agent_azure: Add piggyback option for VM info
CMK-1028
Change-Id: I4243138e36b9e314e9a5de3c1fa5f3c3deaef8fc
---
agents/special/agent_azure | 27 ++++++++++++++++++---------
cmk/gui/plugins/wato/datasource_programs.py | 14 +++++++++++++-
2 files changed, 31 insertions(+), 10 deletions(-)
diff --git a/agents/special/agent_azure b/agents/special/agent_azure
index 739f3b9..7675ef0 100755
--- a/agents/special/agent_azure
+++ b/agents/special/agent_azure
@@ -83,6 +83,12 @@ def parse_arguments(argv):
type=int,
help='''Timeout for process joining in seconds
(default 10)''')
+ parser.add_argument(
+ "--piggyback-vms",
+ default="",
+ choices=["agenthost", "self", "all"],
+ help='''Additionally create VM piggyback data for the host running the agent,
+ the VM iteself, or both''')
# REQUIRED
parser.add_argument("--subscription-id", required=True, help="Azure subscription ID")
@@ -319,13 +325,18 @@ class AzureComputeClient(object):
super(AzureComputeClient, self).__init__()
self._client = ComputeManagementClient(creds, subs)
- def process(self, vm):
+ def process(self, vm, args):
use_keys = ('statuses',)
inst_view = self._client.virtual_machines.get(
vm.info["group"], vm.info["name"], expand='instanceView').instance_view.as_dict()
items = ((k, inst_view.get(k)) for k in use_keys)
vm.info["specific_info"] = {k: v for k, v in items if v is not None}
+ if args.piggyback_vms in ("agenthost", "all"):
+ vm.piggytargets.append('')
+ if args.piggyback_vms in ("self", "all"):
+ vm.piggytargets.append(vm.info["name"])
+
class IssueCollecter(list):
# basically a list of strings, just fancy appending.
@@ -343,16 +354,15 @@ class AzureClient(object):
def __init__(self, args):
super(AzureClient, self).__init__()
- self.debug = args.debug
+ self.args = args
self.remaining_reads = "unknown (no metrics fetched)"
- self.subscription = args.subscription_id
self._creds = ServicePrincipalCredentials(
client_id=args.client_id, secret=args.secret, tenant=args.tenant_id)
# azure-api-call
- self._monitor_client = MonitorManagementClient(self._creds, self.subscription)
+ self._monitor_client = MonitorManagementClient(self._creds, self.args.subscription_id)
# azure-api-call
- self._resource_client = ResourceManagementClient(self._creds, self.subscription)
+ self._resource_client = ResourceManagementClient(self._creds, self.args.subscription_id)
self.specific_clients = {}
@@ -373,13 +383,13 @@ class AzureClient(object):
for rtp in r_types:
client_class = AzureClient.SPECIFIC_CLIENTS.get(rtp)
if client_class is not None:
- self.specific_clients[rtp] = client_class(self._creds, self.subscription)
+ self.specific_clients[rtp] = client_class(self._creds, self.args.subscription_id)
def process_specific(self, resource):
client = self.specific_clients.get(resource.info["type"])
if client is None:
return
- client.process(resource)
+ client.process(resource, self.args)
def discover_resources(self):
if self.resources_cache is None:
@@ -485,7 +495,7 @@ class AzureClient(object):
]
LOG.debug("fetched metrics: %s", metricnames)
except ErrorResponseException as exc:
- if self.debug:
+ if self.args.debug:
raise exc
err.append("exception", rid, exc.message)
LOG.exception(exc)
@@ -532,7 +542,6 @@ class Threads(object):
atexit.register(self.terminate)
def run(self, resources, client, config):
-
if self.sequential:
self._run_sequential(resources, client, config)
else:
diff --git a/cmk/gui/plugins/wato/datasource_programs.py b/cmk/gui/plugins/wato/datasource_programs.py
index ae3a4e5..4acd44f 100644
--- a/cmk/gui/plugins/wato/datasource_programs.py
+++ b/cmk/gui/plugins/wato/datasource_programs.py
@@ -1364,13 +1364,25 @@ register_rule('datasource_programs',
)),
],
)),
+ ("--piggyback-vms", DropdownChoice(
+ title = _("Create piggyback VM data"),
+ help = _("You can choose to <i>additionally</i> send data concerning VMs to"
+ " the host that is associated with the special agent, to a piggyback"
+ " host with name of the VM itself, or both. By default data is sent"
+ " to the corresponding resource group only."),
+ choices = [
+ ("agenthost", _("Send data to agent host")),
+ ("self", _("Send data to the VM itself")),
+ ("all", _("Send data to both the agent host and the VM itself")),
+ ],
+ )),
("--sequential", Checkbox(
title = _("Run in single thread"),
help = _("Check this to avoid multiprocessing. "
"Recommended for debugging purposes only."),
)),
],
- optional_keys = False,
+ optional_keys = ["--piggyback-vms"],
),
match = 'first',
)
Module: check_mk
Branch: master
Commit: 167db3b67d9ac05a5cb361558f3786991b3698d3
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=167db3b67d9ac0…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Wed Oct 24 15:14:44 2018 +0200
6849 FIX Analyze configuration: Fixed wrong results for liveproxyd and persistent connection tests
Previously all analyze configuration tests were executed locally on each site.
In case of the liveproxyd tests and persistent connection tests this was wrong
because the tests have to check the connection configuration for a specific
site on the central site.
Change-Id: I93949f039ef24a44533fb1834dba9184970be2b4
---
.werks/6849 | 14 ++++++++++++++
1 file changed, 14 insertions(+)
diff --git a/.werks/6849 b/.werks/6849
new file mode 100644
index 0000000..08a6edd
--- /dev/null
+++ b/.werks/6849
@@ -0,0 +1,14 @@
+Title: Analyze configuration: Fixed wrong results for liveproxyd and persistent connection tests
+Level: 1
+Component: wato
+Class: fix
+Compatible: compat
+Edition: cre
+State: unknown
+Version: 1.6.0i1
+Date: 1540386842
+
+Previously all analyze configuration tests were executed locally on each site.
+In case of the liveproxyd tests and persistent connection tests this was wrong
+because the tests have to check the connection configuration for a specific
+site on the central site.
Module: check_mk
Branch: master
Commit: a289dff1a63265a7d751741580647d22937ae5a7
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=a289dff1a63265…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Wed Oct 24 10:10:33 2018 +0200
6846 SEC More secure password hashing
Passwords of local users of the Check_MK GUI are now hashed using SHA256
(salted, 535000 rounds) to increase the security of the stored user logon
passwords.
All existing users will still be able to login using their already hashed
passwords. Once a user changes his password or a new user is created, these
will be hashed using the new algorithm.
Why SHA256? Check_MK supports different authentication frontends for verifying
the local credentials: a) basic authentication (done by apache) and b) the GUI
form + cookie based authentication.
The default is b). This option is toggled with the "omd config" option
MULTISITE_COOKIE_AUTH. In case the basic authentication is chosen it is only
possible to use hashing algorithms that are supported by apache which
performs the authentication in this situation.
For best compatibility in all mentioned situations we use the SHA256 scheme.
CMK-1151
Change-Id: I3e8ea4bdfe813e5d290ef94406340b89c73bfc9a
---
.werks/6846 | 27 ++++++
cmk/gui/md5crypt.py | 99 ----------------------
cmk/gui/plugins/userdb/htpasswd.py | 83 ++++++++++++------
omd/packages/omd/omd | 88 +------------------
.../unit/cmk/gui/test_userdb_htpasswd_connector.py | 28 +++++-
5 files changed, 111 insertions(+), 214 deletions(-)
Diff: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commitdiff;h=a289dff1a6…
Module: check_mk
Branch: master
Commit: 30e881cd5789688d232e387b7dbea6fdf396af1e
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=30e881cd578968…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Wed Oct 24 14:47:49 2018 +0200
Analyze configuration: Fixed wrong results for liveproxyd and persistent connection tests
Previously all analyze configuration tests were executed locally on each
site. In case of the liveproxyd tests and persistent connection tests
this was wrong because the tests have to check the connection
configuration for a specific site on the central site.
The following things have been changed:
* These tests are only triggered on the central sites (see is_relevant()).
* Test results produced on one site can now set the site_id attribute to
the site_id of another site.
These results will not be merged together like it is done for multiple
results affecting a single site.
These results will then be shown in the column of the desired site
instead of the site they were executed on
Change-Id: Ie4a6edf0dfcdd7d5b025f244d1f767b987bbfa62
---
cmk/gui/plugins/wato/ac_tests.py | 24 +++++++++++++++++++-----
cmk/gui/watolib.py | 12 +++++++++++-
2 files changed, 30 insertions(+), 6 deletions(-)
diff --git a/cmk/gui/plugins/wato/ac_tests.py b/cmk/gui/plugins/wato/ac_tests.py
index 073656f..c1b2bdd 100644
--- a/cmk/gui/plugins/wato/ac_tests.py
+++ b/cmk/gui/plugins/wato/ac_tests.py
@@ -70,12 +70,19 @@ class ACTestPersistentConnections(ACTest):
def is_relevant(self):
- return True
+ # This check is only executed on the central instance of multisite setups
+ return len(config.sitenames()) > 1
def execute(self):
- site_id = config.omd_site()
- site_config = config.site(site_id)
+ for site_id in config.sitenames():
+ site_config = config.site(site_id)
+ for result in self._check_site(site_id, site_config):
+ result.site_id = site_id
+ yield result
+
+
+ def _check_site(self, site_id, site_config):
persist = site_config.get("persist", False)
if persist and watolib.site_is_using_livestatus_proxy(site_id):
@@ -114,11 +121,18 @@ class ACTestLiveproxyd(ACTest):
def is_relevant(self):
- return True
+ # This check is only executed on the central instance of multisite setups
+ return len(config.sitenames()) > 1
def execute(self):
- site_id = config.omd_site()
+ for site_id in config.sitenames():
+ for result in self._check_site(site_id):
+ result.site_id = site_id
+ yield result
+
+
+ def _check_site(self, site_id):
if watolib.site_is_using_livestatus_proxy(site_id):
yield ACResultOK(_("Site is using the Livestatus Proxy Daemon"))
diff --git a/cmk/gui/watolib.py b/cmk/gui/watolib.py
index 2dae2f4..ba7bc89 100644
--- a/cmk/gui/watolib.py
+++ b/cmk/gui/watolib.py
@@ -10029,6 +10029,7 @@ class ACResult(object):
def __init__(self, text):
super(ACResult, self).__init__()
self.text = text
+ self.site_id = config.omd_site()
def from_test(self, test):
@@ -10036,7 +10037,6 @@ class ACResult(object):
self.category = test.category()
self.title = test.title()
self.help = test.help()
- self.site_id = config.omd_site()
@classmethod
@@ -10172,6 +10172,16 @@ class ACTest(object):
def run(self):
self._executed = True
try:
+ # Do not merge results that have been gathered on one site for different sites
+ results = list(self.execute())
+ num_sites = len(set(r.site_id for r in results))
+ if num_sites > 1:
+ for result in results:
+ result.from_test(self)
+ yield result
+ return
+
+ # Merge multiple results produced for a single site
total_result = ACResult.merge(*list(self.execute()))
total_result.from_test(self)
yield total_result