Add remove configuration for matching arguments

The remove_config() function only removes an exact match for
the configured instance.
This will allow removing plugin configuration when all config is
not known.

Use case: A compute node has been removed, so any host_alive
ping checks that are configured for it should be removed.  But at
the time of removal the list of target_hostnames to match are
not known.

Change-Id: I8050e1eed68d7b64f7a968b061afa69fe2e86d72
Story: 2004539
Task: 28287
This commit is contained in:
Joseph Davis 2018-12-07 17:07:42 -08:00
parent a69da1c28d
commit 8d4bd979d5
4 changed files with 530 additions and 6 deletions

View File

@ -108,12 +108,22 @@ All parameters require a '--' before the parameter such as '--verbose'. Run `mon
| skip_detection_plugins | Skip provided space separated list of detection plugins. | system |
| overwrite | This is an optional parameter to overwrite the plugin configuration. Use this if you don't want to keep the original configuration. If this parameter is not specified, the configuration will be appended to the existing configuration, possibly creating duplicate checks. **NOTE:** The agent config file, agent.yaml, will always be overwritten, even if this parameter is not specified. | |
| detection_args | Some detection plugins can be passed arguments. This is a string that will be passed to the detection plugins. | "hostname=ping.me" |
| detection_args_json | A JSON string can be passed to the detection plugin. | '{"process_config":{"process_names":["monasca-api","monasca-notification"],"dimensions":{"service":"monitoring"}}}' |
| detection_args_json | A JSON string can be passed to the detection plugin. | (See example below) |
| max_measurement_buffer_size | Integer value for the maximum number of measurements to buffer locally while unable to connect to the monasca-api. If the queue exceeds this value, measurements will be dropped in batches. A value of '-1' indicates no limit | 100000 |
| backlog_send_rate | Integer value of how many batches of buffered measurements to send each time the forwarder flushes data | 1000 |
| max_batch_size | Maximum batch size of measurements to write to monasca-api, 0 is no limit | 0 |
| monasca_statsd_port | Integer value for statsd daemon port number | 8125 |
| monasca_statsd_interval | Integer value for the statsd metric aggregation interval (seconds) | 20 |
| remove_config | Flag to remove the configuration that exactly matches the other given arguments. [See below](#removing-monasca-agent-monitoring) | |
| remove_matching_args | Flag to search for and remove all configurations that match the given configuration items. WARNING: This option is **not** compatible with --detection_args_json. [See below](#removing-monasca-agent-monitoring) | |
An example of a JSON value which could be used for `--detection_args_json` is:
`'{"process_config":{"process_names":["monasca-api","monasca-notification"],"dimensions":{"service":"monitoring"}}}'`
This example JSON specifies the *monasca-api* and *monasca-notification* processes with the dimension *service:monitoring*.
#### A note around using monasca-agent with different versions of Keystone
@ -282,5 +292,28 @@ The collector is optimized for collecting as many metrics on schedule as possibl
If there is some problem with multiple plugins that end up blocking the entire thread pool, the collector will exit so that it can be restarted by the monasca-agent systemd target. The parameter pool_full_max_retries controls when this happens. If pool_full_max_retries consecutive collection cycles have ended with the Thread Pool completely full, the collector will exit.
Some of the plugins have their own thread pools to handle asynchronous checks. The collector thread pool is separate and has no special interaction with those thread pools.
# Removing Monasca Agent monitoring
There are two flags available in `monasca-setup` for triggering the methods to remove
monitoring when it is no longer needed.
The `--remove_config` flag is used as an opposite operation to creating monitoring configuration.
The same set of parameters must be provided as were used to create a configuration.
If the parameters don't match exactly, no configuration is removed.
The `--remove_matching_args` flag triggers a search for and removal of all configurations that match the given
configuration items. This may be useful when a node has been removed and any monitoring that references that node
needs to be removed. However, it should be used with caution as the search is powerful and if not specified correctly
could match broadly against other monitoring configuration that should not be removed.
**WARNING:** `--remove_matching_args` does not support JSON formatted detection arguments. In other words, this
option is **not** compatible with `--detection_args_json.`
Also see the [Agent Internals](DeveloperDocs/agent_internals.md) Developer Docs.
# License
(C) Copyright 2015-2016, 2018 Hewlett Packard Enterprise Development LP
(C) Copyright 2020 SUSE LLC

View File

@ -13,7 +13,7 @@
<!-- END doctoc generated TOC please keep comment here to allow auto update -->
# Modify_Config
Modify_config is a function in [monasca_setup/main.py](monasca_setup/main.py).
`modify_config` is a function in [monasca_setup/main.py](monasca_setup/main.py).
It compares existing and detected configurations for each check plugin and
writes out the plugin configurations if there are changes.
@ -137,6 +137,27 @@ output_config from modify_config:
}
```
# Remove Config
There are two methods for removing configurations.
The first is `remove_config` which will remove a configuration exactly matching the parameters.
The second is `remove_config_for_matching_args` which will search for any configuration that matches the given
arguments but allows for some variation. This is useful in the use case where a compute node has been removed
and all configuration related to that host should be removed, but all the parameters in configuration used may
not be known (like target_hostname for host_alive checks).
WARNING: JSON support for detection arguments has not been added to `--remove_matching_args`.
Example call to monasca-setup, to remove ping checks of a compute host in host_alive.yaml:
```bash
monasca-setup --user monasca-agent \
--agent_service_name openstack-monasca-agent --remove-matching-args \
-d HostAlive --detection_args "hostname=deletehost-localcloud-mgmt type=ping dimensions=service:compute"
```
REMINDER: Multiple dimensions can be in the form `dimensions=service:compute,tag:east`
# Connector
## Kubernetes Connector
Kubernetes Connector is a class within [monasca-collector utils](monasca_agent/collector/checks/utils.py)
@ -148,5 +169,6 @@ under is mounted to the container file system. This class processes both and all
# License
(C) Copyright 2016,2017 Hewlett Packard Enterprise Development LP
(C) Copyright 2019,2020 SUSE LLC

View File

@ -95,7 +95,10 @@ def main(argv=None):
plugin_names = [p.__name__ for p in plugins]
# Remove entries for each plugin from the various plugin config files.
if args.remove:
if args.remove_matching_args:
LOG.debug("Calling remove configuration for matching arguments.")
changes = remove_config_for_matching_args(args, plugin_names)
elif args.remove:
changes = remove_config(args, plugin_names)
else:
# Run detection for all the plugins, halting on any failures if plugins
@ -384,6 +387,13 @@ def parse_arguments(parser):
help="Rather than add the detected configuration remove it.",
action="store_true",
default=False)
parser.add_argument(
'--remove_matching_args',
help="Remove any configuration that matches all of the supplied arguments."
" Useful when removing a compute node but all the target_hostnames"
" are not known. Implies -r.",
action="store_true",
default=False)
parser.add_argument(
'--skip_enable',
help="By default the service is enabled, " +
@ -451,7 +461,9 @@ def plugin_detection(
:param plugins: A list of detection plugin classes
:param template_dir: Location of plugin configuration templates
:param detection_args: Arguments passed to each detection plugin
:param detection_args_json: Alternate json format for detection arguments, use one or the other
:param skip_failed: When False any detection failure causes the run to halt and return None
:param remove: When True will not log a message indicating the detected name is configuring
:return: An agent_config instance representing the total configuration from all detection
plugins run.
"""
@ -488,17 +500,21 @@ def remove_config(args, plugin_names):
Note there is no concept of overwrite for removal.
:param args: specified arguments
:param plugin_names: A list of the plugin names to remove from the config
:return: True if changes, false otherwise
:return: True if changes, False otherwise
"""
changes = False
existing_config_files = glob(os.path.join(args.config_dir, 'conf.d', '*.yaml'))
existing_config_files = _get_config_yaml_files(args.config_dir)
if existing_config_files == []:
LOG.warning("Found no existing configuration files, no changes will be made!")
detected_plugins = utils.discover_plugins(CUSTOM_PLUGIN_PATH)
plugins = utils.select_plugins(args.detection_plugins, detected_plugins)
LOG.debug("Plugins selected: %s", plugins)
if (args.detection_args or args.detection_args_json):
if args.detection_args or args.detection_args_json:
detected_config = plugin_detection(
plugins, args.template_dir, args.detection_args, args.detection_args_json,
skip_failed=(args.detection_plugins is None), remove=True)
LOG.debug("Detected configuration: %s", detected_config)
for file_path in existing_config_files:
deletes = False
@ -507,8 +523,10 @@ def remove_config(args, plugin_names):
# To avoid odd issues from iterating over a list you delete from, build a new instead
new_instances = []
if args.detection_args is None:
# JSON version of detection_args
for inst in config['instances']:
if 'built_by' in inst and inst['built_by'] in plugin_names:
LOG.debug("Removing %s", inst)
changes = True
deletes = True
continue
@ -518,14 +536,96 @@ def remove_config(args, plugin_names):
for detected_key in detected_config.keys():
for inst in detected_config[detected_key]['instances']:
if inst in config['instances']:
LOG.debug("Removing %s", inst)
changes = True
deletes = True
config['instances'].remove(inst)
# TODO(joadavis) match dry-run functionality like in modify_config
if deletes:
agent_config.delete_from_config(args, config, file_path,
plugin_name)
return changes
def remove_config_for_matching_args(args, plugin_names):
"""Parse all configuration removing any configuration built by plugins in plugin_names
Will use the generated config fields to match against the stored configs
Intended for use when removing all config for a deleted compute host. May delete
more than intended in other uses, so be cautious.
Note there is no concept of overwrite for removal.
:param args: specified arguments. detection_args or detection_args_json are Required.
:param plugin_names: A list of the plugin names to remove from the config
:return: True if changes, False otherwise
"""
changes = False
existing_config_files = _get_config_yaml_files(args.config_dir)
if existing_config_files == []:
LOG.warning("Found no existing configuration files, no changes will be made!")
detected_plugins = utils.discover_plugins(CUSTOM_PLUGIN_PATH)
plugins = utils.select_plugins(args.detection_plugins, detected_plugins)
LOG.debug("Plugins selected: %s", plugins)
if args.detection_args or args.detection_args_json:
detected_config = plugin_detection(
plugins, args.template_dir, args.detection_args, args.detection_args_json,
skip_failed=(args.detection_plugins is None), remove=True)
else:
# this method requires detection_args
LOG.warning("Removing a configuration for matching arguments requires"
" arguments. No changes to configuration will be made!")
return changes
LOG.debug("Detected configuration: %s", detected_config)
for file_path in existing_config_files:
deletes = False
plugin_name = os.path.splitext(os.path.basename(file_path))[0]
config = agent_config.read_plugin_config_from_disk(args.config_dir, plugin_name)
# To avoid odd issues from iterating over a list you delete from, build a new instead
new_instances = []
if args.detection_args is None:
# using detection_args_json
LOG.error("Only key-value argument format is currently supported for removing "
"matching configuration. JSON format is not yet supported. "
"No changes to configuration will be made!")
return False
else:
# here is where it will differ from remove_config()
# detected_config = generated based on args, config = read from disk
# for each field in the detected_config instance, check it matches the one on disk
# note that the one on disk is allowed to have more fields
for exist_inst in config['instances']:
for detected_key in detected_config.keys():
for detected_inst in detected_config[detected_key]['instances']:
if len(detected_inst.keys()) < 1:
new_instances.append(exist_inst)
continue
needs_delete = True
for detect_inst_key in detected_inst.keys():
if detect_inst_key in exist_inst.keys():
if detected_inst[detect_inst_key] != exist_inst[detect_inst_key]:
needs_delete = False
else:
# not a match
needs_delete = False
continue
if needs_delete:
LOG.debug("Removing configuration %s", exist_inst)
changes = True
deletes = True
continue
new_instances.append(exist_inst)
config['instances'] = new_instances
# TODO(joadavis) match dry-run functionality like in modify_config
if deletes:
agent_config.delete_from_config(args, config, file_path,
plugin_name)
return changes
# helper function to make mock testing easier
def _get_config_yaml_files(config_dir):
return glob(os.path.join(config_dir, 'conf.d', '*.yaml'))
if __name__ == "__main__":
sys.exit(main())

369
tests/test_remove_config.py Normal file
View File

@ -0,0 +1,369 @@
# (C) Copyright 2016 Hewlett Packard Enterprise Development LP
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
import collections
import mock
import unittest
import monasca_setup
import monasca_setup.agent_config
DEFAULT_HTTP_CHECK_CONFIG = {
'init_config': None,
'instances': [{'built_by': 'HttpCheck',
'match_pattern': '.*VERSION.*',
'url': 'http://127.0.0.1:9200',
'name': 'logging',
'timeout': '10',
'collect_response_time': True,
'use_keystone': False,
'dimensions': {'service': 'logging'}}]
}
DEFAULT_HTTP_CHECK_2_CONFIG = {
'init_config': None,
'instances': [{'built_by': 'HttpCheck',
'match_pattern': '.*VERSION.*',
'url': 'http://127.0.0.1:9200',
'name': 'logging',
'timeout': '10',
'collect_response_time': True,
'use_keystone': False,
'dimensions': {'service': 'logging'}},
{'built_by': 'HttpCheck',
'match_pattern': '.*VERSION.*',
'url': 'http://127.0.0.2:9200',
'name': 'logging',
'timeout': '10',
'collect_response_time': True,
'use_keystone': False,
'dimensions': {'service': 'logging'}}
]
}
DEFAULT_PROCESS_CHECK_CONFIG = {
'init_config': None,
'instances': [{'built_by': 'MonNotification',
'detailed': True,
'dimensions': {'component': 'monasca-notification'},
'exact_match': False,
'name': 'monasca-notification',
'search_string': ['monasca-notification']
}]
}
DEFAULT_PROCESS_CHECK_CONFIG_2 = {
'init_config': None,
'instances': [{'built_by': 'MonNotification',
'detailed': True,
'dimensions': {'component': 'monasca-notification'},
'exact_match': False,
'name': 'monasca-notification',
'search_string': ['monasca-notification']
},
{'built_by': 'MonAPI',
'detailed': True,
'dimensions': {'component': 'monasca-api'},
'exact_match': False,
'name': 'monasca-api',
'search_string': ['monasca-api']
}
]
}
DEFAULT_PING_CHECK_CONFIG_2COMP = {
'init_config': None,
'instances': [{'built_by': 'HostAlive',
'alive_test': 'ping',
'dimensions': {'service': 'compute'},
'host_name': 'test-test-1-host',
'name': 'test-test-1-host ping',
'target_hostname': 'test-test-1-mgmt'
},
{'built_by': 'HostAlive',
'alive_test': 'ping',
'dimensions': {'service': 'compute'},
'host_name': 'test-test-2-host',
'name': 'test-test-2-host ping',
'target_hostname': 'test-test-2-mgmt'
},
{'built_by': 'HostAlive',
'alive_test': 'ping',
'host_name': 'test-control-1-host',
'name': 'test-control-1-host ping',
'target_hostname': 'test-control-1-mgmt'
}
]
}
DEFAULT_PING_CHECK_CONFIG_ALLCOMP = {
'init_config': None,
'instances': [{'built_by': 'HostAlive',
'alive_test': 'ping',
'dimensions': {'service': 'compute'},
'host_name': 'test-test-1-host',
'name': 'test-test-1-host ping',
'target_hostname': 'test-test-1-mgmt'
},
{'built_by': 'HostAlive',
'alive_test': 'ping',
'dimensions': {'service': 'compute'},
'host_name': 'test-test-2-host',
'name': 'test-test-2-host ping',
'target_hostname': 'test-test-2-mgmt'
},
{'built_by': 'HostAlive',
'alive_test': 'ping',
'dimensions': {'service': 'compute'},
'host_name': 'test-test-3-host',
'name': 'test-test-3-host ping',
'target_hostname': 'test-test-3-mgmt'
},
{'built_by': 'HostAlive',
'alive_test': 'ping',
'host_name': 'test-control-1-host',
'name': 'test-control-1-host ping',
'target_hostname': 'test-control-1-mgmt'
}
]
}
DEFAULT_PING_CHECK_CONFIG_CONTONLY = {
'init_config': None,
'instances': [{'built_by': 'HostAlive',
'alive_test': 'ping',
'host_name': 'test-control-1-host',
'name': 'test-control-1-host ping',
'target_hostname': 'test-control-1-mgmt'
}
]
}
INPUT_ARGS = collections.namedtuple(
"InputArgs", ["overwrite", "user", "config_dir", "detection_args",
"detection_plugins", "dry_run", "detection_args_json",
"template_dir"])
INPUT_ARGS_WITH_DIMENSIONS = collections.namedtuple(
"InputArgs", ["overwrite", "user", "config_dir", "detection_args",
"detection_plugins", "dry_run", "detection_args_json",
"template_dir", "dimensions"])
class TestRemoveConfig(unittest.TestCase):
""" Unit tests for removing_config function in monasca_setup/main.py
More details are documented in:
monasca-agent/docs/DeveloperDocs/agent_internals.md
"""
def setUp(self):
self._config_data = {}
def save_config(self, config_dir, plugin_name, user, data):
self._config_data = data
# to replace save_plugin_config(args.config_dir, plugin_name, args.user, config)
# in delete_config(args, config, file_path, plugin_name)
def delete_config(self, args, config, file_path, plugin_name):
self._config_data = config
@mock.patch('monasca_setup.main.plugin_detection')
@mock.patch('monasca_setup.main.agent_config.delete_from_config')
@mock.patch('monasca_setup.main.agent_config.read_plugin_config_from_disk')
def test_no_remove_process_check_config(self, mock_read_config,
mock_delete_config,
mock_plugin_detection):
mock_read_config.return_value = DEFAULT_PROCESS_CHECK_CONFIG
mock_delete_config.side_effect = self.save_config
# Add a new process check instance
same_built_by = DEFAULT_PROCESS_CHECK_CONFIG['instances'][0][
'built_by']
same_name = DEFAULT_PROCESS_CHECK_CONFIG['instances'][0][
'name']
args, detected_config = self._get_mon_api_check_args_and_config(
same_built_by, same_name)
mock_plugin_detection.return_value = detected_config
self._check_no_change_remove(args, ["HttpCheck"])
@mock.patch('monasca_setup.main._get_config_yaml_files')
@mock.patch('monasca_setup.main.plugin_detection')
@mock.patch('monasca_setup.main.agent_config.delete_from_config')
@mock.patch('monasca_setup.main.agent_config.read_plugin_config_from_disk')
def test_remove_process_check_config(self, mock_read_config,
mock_delete_config,
mock_plugin_detection,
mock_glob):
mock_read_config.return_value = DEFAULT_PROCESS_CHECK_CONFIG_2
mock_delete_config.side_effect = self.delete_config
mock_glob.return_value = ['conf.d--test/process_check-TESTONLY.yaml']
# Trying to remove mon-api part
built_by = 'MonAPI'
name = 'monasca-api'
args, detected_config = self._get_mon_api_check_args_and_config(
built_by, name)
mock_plugin_detection.return_value = detected_config
print("det_conf {0}".format(detected_config))
self._check_changes_remove(args, [built_by], DEFAULT_PROCESS_CHECK_CONFIG)
@mock.patch('monasca_setup.main.agent_config.save_plugin_config')
@mock.patch('monasca_setup.main.agent_config.read_plugin_config_from_disk')
def test_no_modify_http_check_config(self, mock_read_config,
mock_save_config):
mock_read_config.return_value = DEFAULT_HTTP_CHECK_CONFIG
mock_save_config.side_effect = self.save_config
# keep url and match_pattern the same
same_url = DEFAULT_HTTP_CHECK_CONFIG['instances'][0]['url']
same_match_pattern = DEFAULT_HTTP_CHECK_CONFIG['instances'][0][
'match_pattern']
same_name = DEFAULT_HTTP_CHECK_CONFIG['instances'][0]['name']
args, detected_config = self. _get_http_check_args_and_config(
same_url, same_match_pattern, same_name)
self._check_no_change_remove(args, detected_config)
@mock.patch('monasca_setup.main._get_config_yaml_files')
@mock.patch('monasca_setup.main.plugin_detection')
@mock.patch('monasca_setup.main.agent_config.save_plugin_config')
@mock.patch('monasca_setup.main.agent_config.read_plugin_config_from_disk')
def test_remove_http_check_config(self, mock_read_config,
mock_save_config,
mock_plugin_detection,
mock_glob):
mock_read_config.return_value = DEFAULT_HTTP_CHECK_2_CONFIG
mock_save_config.side_effect = self.save_config
mock_glob.return_value = ['conf.d--test/http_check.yaml']
# don't change protocol or match_pattern
url = 'http://127.0.0.2:9200'
match_pattern = '.*VERSION.*'
args, detected_config = self. _get_http_check_args_and_config(
url, match_pattern, 'logging')
mock_plugin_detection.return_value = detected_config
expected_value = DEFAULT_HTTP_CHECK_CONFIG
self._check_changes_remove(args, ['http_check'], expected_value)
# TODO: test_remove_matching for http or process,
# TODO: test if no match and test if multiple entries match
# TODO: start from DEFAULT_PING_CHECK_CONFIG_ALLCOMP and remove the computes by dimension server:compute
# TODO: do a ping check using JSON format detection arguments, (after that is implemented)
# start from DEFAULT_PING_CHECK_CONFIG_ALLCOMP and remove just test3 compute
@mock.patch('monasca_setup.main._get_config_yaml_files')
@mock.patch('monasca_setup.main.plugin_detection')
@mock.patch('monasca_setup.main.agent_config.delete_from_config')
@mock.patch('monasca_setup.main.agent_config.read_plugin_config_from_disk')
def test_remove_matching_ping_check_config(self, mock_read_config,
mock_delete_config,
mock_plugin_detection,
mock_glob):
mock_read_config.return_value = DEFAULT_PING_CHECK_CONFIG_ALLCOMP
mock_delete_config.side_effect = self.delete_config
mock_glob.return_value = ['conf.d--test/ping_check.yaml']
same_built_by = DEFAULT_PING_CHECK_CONFIG_ALLCOMP['instances'][0][
'built_by']
# note: NOT testing the json args path
test_args = INPUT_ARGS(False, 'mon-agent', '/etc/monasca/agent',
'hostname=deletehost-localcloud-mgmt '
'type=ping '
'dimensions=service:compute',
[same_built_by], False,
{},
'/etc/monasca/agent/conf.d--test')
mock_plugin_detection.return_value = {'ping': {
'instances': [{'built_by': same_built_by,
'alive_test': 'ping',
'dimensions': {'service': 'compute'},
'host_name': 'test-test-3-host',
'name': 'test-test-3-host ping',
'target_hostname': 'test-test-3-mgmt'}],
'init_config': None}
}
changes = monasca_setup.main.remove_config_for_matching_args(test_args, [same_built_by])
self.assertEqual(changes, True, "Should have removed config item but did not!")
self.assertEqual(DEFAULT_PING_CHECK_CONFIG_2COMP, self._config_data,
"Expected value {0} did not match result of {1}"
.format(DEFAULT_PING_CHECK_CONFIG_2COMP, self._config_data))
####
# helper functions
def _check_no_change_remove(self, args, plugins):
changes = monasca_setup.main.remove_config(args, plugins)
self.assertEqual(changes, False)
self.assertEqual(self._config_data, {})
def _check_changes_remove(self, args, plugins, expected_value):
changes = monasca_setup.main.remove_config(args, plugins)
self.assertEqual(changes, True)
self.assertEqual(expected_value, self._config_data,
"Expected value {0} did not match resulting config data {1}"
.format(expected_value, self._config_data))
def _check_changes_remove_matching(self, args, plugins, expected_value):
changes = monasca_setup.main.remove_config_for_matching_args(args, plugins)
self.assertEqual(changes, True)
self.assertEqual(expected_value, self._config_data,
"Expected value {0} did not match resulting config data {1}"
.format(expected_value, self._config_data))
# Reminder of args: ["overwrite", "user", "config_dir", "detection_args",
# "detection_plugins", "dry_run",
# "detection_args_json", "template_dir"]
def _get_mon_api_check_args_and_config(self, built_by, name):
args = INPUT_ARGS(False, 'mon-agent', '/etc/monasca/agent', None,
['MonAPI'], False,
'{}', '/etc/monasca/agent/conf.d--test')
detected_config = {
'process':
{'instances': [{'built_by': built_by,
'detailed': True,
'dimensions': {
'component': name},
'exact_match': False,
'name': name,
'search_string': [name]
}],
'init_config': None
}
}
return args, detected_config
def _get_http_check_args_and_config(self, url, match_pattern, name):
args = INPUT_ARGS(False, 'mon-agent', '/etc/monasca/agent',
'url={0} match_pattern={1} name={2} timeout=10 '
'use_keystone=False'.format(
url, match_pattern, name),
['HttpCheck'], False,
'{}', '/etc/monasca/agent/conf.d--test')
detected_config = {
'http_check':
{'instances': [{'built_by': 'HttpCheck',
'match_pattern': match_pattern,
'url': url,
'name': name,
'timeout': '10',
'collect_response_time': True,
'use_keystone': False,
'dimensions': {'service': 'logging'}
}],
'init_config': None
}
}
return args, detected_config