Merge "add --skip_detection_plugins arg. for skipping listed detection plugins"
This commit is contained in:
commit
031f9c198f
@ -80,6 +80,8 @@ sudo monasca-setup --username KEYSTONE_USERNAME --password KEYSTONE_PASSWORD --p
|
||||
It is also possible to skip most detection plugins in monasca-setup with the `--system_only` flag. You can then come back later and run individual detection plugins without additional arguments,
|
||||
for example `monasca-setup -d mysql`. This allows a base install to setup the agent and required credentials then later easily add additional services and monitoring.
|
||||
|
||||
Alternatively you can disable selected detection plugins with the `--skip_detection_plugins` parameter.
|
||||
|
||||
### Explanation of primary monasca-setup command-line parameters:
|
||||
All parameters require a '--' before the parameter such as '--verbose'. Run `monasca-setup --help` for a full listing of options.
|
||||
|
||||
@ -104,6 +106,7 @@ All parameters require a '--' before the parameter such as '--verbose'. Run `mon
|
||||
| service | Service this node is associated with, added as a dimension. | |
|
||||
| system_only | This optional parameter if set true will cause only the basic system checks to be configured all other detection will be skipped. Basic system checks include cpu, disk, load, memory, network. | |
|
||||
| detection_plugins | Skip base config and service setup and only configure provided space separated list of plugins. This assumes the base config has already run.| kafka ntp|
|
||||
| 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" |
|
||||
|
||||
|
@ -62,6 +62,8 @@ def main(argv=None):
|
||||
plugins = [System]
|
||||
elif args.detection_plugins is not None:
|
||||
plugins = utils.select_plugins(args.detection_plugins, detected_plugins)
|
||||
elif args.skip_detection_plugins is not None:
|
||||
plugins = utils.select_plugins(args.skip_detection_plugins, detected_plugins, skip=True)
|
||||
else:
|
||||
plugins = detected_plugins
|
||||
plugin_names = [p.__name__ for p in plugins]
|
||||
@ -190,6 +192,8 @@ def parse_arguments(parser):
|
||||
parser.add_argument('-d', '--detection_plugins', nargs='*',
|
||||
help="Skip base config and service setup and only configure this space separated list. " +
|
||||
"This assumes the base config has already run.")
|
||||
parser.add_argument('--skip_detection_plugins', nargs='*',
|
||||
help="Skip detection for all plugins in this space separated list.")
|
||||
parser.add_argument('-a', '--detection_args', help="A string of arguments that will be passed to detection " +
|
||||
"plugins. Only certain detection plugins use arguments.")
|
||||
parser.add_argument('--check_frequency', help="How often to run metric collection in seconds", type=int, default=30)
|
||||
|
@ -45,18 +45,20 @@ def discover_plugins(custom_path):
|
||||
return plugins
|
||||
|
||||
|
||||
def select_plugins(plugin_names, plugin_list):
|
||||
def select_plugins(plugin_names, plugin_list, skip=False):
|
||||
""":param plugin_names: A list of names
|
||||
:param plugin_list: A list of detection plugins classes
|
||||
:param skip: Inverts the behaviour by selecting only those plugins not in plugin_names
|
||||
:return: Returns a list of plugins from plugin_list that match plugin_names
|
||||
"""
|
||||
lower_plugins = [p.lower() for p in plugin_names]
|
||||
plugins = []
|
||||
for plugin in plugin_list:
|
||||
if plugin.__name__.lower() in lower_plugins:
|
||||
selected = (plugin.__name__.lower() in lower_plugins)
|
||||
if selected != skip:
|
||||
plugins.append(plugin)
|
||||
|
||||
if len(plugins) != len(plugin_names):
|
||||
if len(plugins) != len(plugin_names) and not skip:
|
||||
pnames = [p.__name__ for p in plugin_list]
|
||||
log.warn("Not all plugins found, discovered plugins {0}\nAvailable plugins{1}".format(plugins,
|
||||
pnames))
|
||||
|
Loading…
Reference in New Issue
Block a user