Refactor the plugin's UI
- Rename 'Environment name' to 'Environment label' to avoid confusion with the Fuel environment's name. - The ElasticSearch server is either specified by its node's name (when deployed with the EK plugin in the same environment) or by its network address. Change-Id: Ie5c2b1d6522477324aebb4b36cd9fe0df36c5355
This commit is contained in:
@@ -16,8 +16,8 @@ setfenv(1, M) -- Remove external access to contain everything in the module
|
||||
|
||||
-- list of fields that are added to Heka messages by the collector
|
||||
tags = {
|
||||
<% @tags.each do |k,v| -%>
|
||||
['<%= k.gsub("'"){"\\'"} %>'] = '<%= v.gsub("'"){"\\'"} %>',
|
||||
<% @tags.keys().sort().each do |k| -%>
|
||||
['<%= k.to_s().gsub("'"){"\\'"} %>'] = '<%= @tags[k].to_s().gsub("'"){"\\'"} %>',
|
||||
<% end -%>
|
||||
}
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@ elsif $deployment_mode =~ /^ha/ {
|
||||
$controller_role = 'primary-controller'
|
||||
}
|
||||
else {
|
||||
fail ("'${deployment_mode} is not a supported deployment mode")
|
||||
fail("'${deployment_mode} is not a supported deployment mode")
|
||||
}
|
||||
|
||||
# TODO: verify that we're running Neutron
|
||||
@@ -24,15 +24,25 @@ else {
|
||||
$rabbitmq_user = 'nova'
|
||||
}
|
||||
|
||||
$tags = {
|
||||
deployment_id => $fuel_settings['deployment_id'],
|
||||
deployment_mode => $deployment_mode,
|
||||
openstack_region => 'RegionOne',
|
||||
openstack_release => $fuel_settings['openstack_version'],
|
||||
openstack_roles => join($roles, ","),
|
||||
}
|
||||
if $fuel_settings['lma_collector']['environment_label'] != '' {
|
||||
$additional_tags = {
|
||||
environment_label => $fuel_settings['lma_collector']['environment_label'],
|
||||
}
|
||||
}
|
||||
else {
|
||||
$additional_tags = {}
|
||||
}
|
||||
|
||||
class lma_common {
|
||||
class { 'lma_collector':
|
||||
tags => {
|
||||
fuel_environment => $fuel_settings['lma_collector']['fuel_environment'],
|
||||
openstack_region => 'RegionOne',
|
||||
openstack_release => $fuel_settings['openstack_version'],
|
||||
openstack_roles => join($roles, ","),
|
||||
deployment_mode => $deployment_mode,
|
||||
}
|
||||
tags => merge($tags, $additional_tags)
|
||||
}
|
||||
|
||||
class { 'lma_collector::logs::system': }
|
||||
@@ -50,14 +60,30 @@ class lma_controller {
|
||||
class { 'lma_collector::logs::pacemaker': }
|
||||
}
|
||||
|
||||
if $fuel_settings['lma_collector']['elasticsearch_server'] != '' {
|
||||
class { 'lma_common': }
|
||||
class { 'lma_common': }
|
||||
|
||||
if ($is_primary_controller or $is_controller) {
|
||||
class { 'lma_controller': }
|
||||
if ($is_primary_controller or $is_controller) {
|
||||
class { 'lma_controller': }
|
||||
}
|
||||
|
||||
$elasticsearch_mode = $fuel_settings['lma_collector']['elasticsearch_mode']
|
||||
case $elasticsearch_mode {
|
||||
'remote': {
|
||||
$es_server = $fuel_settings['lma_collector']['elasticsearch_address']
|
||||
}
|
||||
|
||||
class { 'lma_collector::elasticsearch':
|
||||
server => $fuel_settings['lma_collector']['elasticsearch_server']
|
||||
'local': {
|
||||
$node_name = $fuel_settings['lma_collector']['elasticsearch_node_name']
|
||||
$es_nodes = filter_nodes($fuel_settings['nodes'], 'user_node_name', $node_name)
|
||||
if size($es_nodes) < 1 {
|
||||
fail("Could not find node '${node_name}' in the environment")
|
||||
}
|
||||
$es_server = $es_nodes[0]['internal_address']
|
||||
}
|
||||
default: {
|
||||
fail("'${elasticsearch_mode}' mode not supported for ElasticSearch")
|
||||
}
|
||||
}
|
||||
|
||||
class { 'lma_collector::elasticsearch':
|
||||
server => $es_server
|
||||
}
|
||||
|
||||
@@ -4,18 +4,43 @@ attributes:
|
||||
- condition: "cluster:net_provider != 'neutron'"
|
||||
action: "hide"
|
||||
|
||||
# TODO(pasquier-s): validate input fields
|
||||
fuel_environment:
|
||||
environment_label:
|
||||
value: ''
|
||||
label: 'Environment name'
|
||||
description: 'Name of the environment as reported in the collected data.'
|
||||
label: 'Environment label'
|
||||
description: 'Optional string to tag the data.'
|
||||
weight: 10
|
||||
type: "text"
|
||||
|
||||
# TODO(pasquier-s): validate input fields
|
||||
elasticsearch_server:
|
||||
value: ''
|
||||
label: 'ElasticSearch server'
|
||||
description: 'Leave empty if you''re not using ElasticSearch.'
|
||||
elasticsearch_mode:
|
||||
type: "radio"
|
||||
weight: 20
|
||||
value: "local"
|
||||
label: "Logging analytics"
|
||||
values:
|
||||
- data: "local"
|
||||
label: "Local node"
|
||||
- data: "remote"
|
||||
label: "Remote server"
|
||||
|
||||
elasticsearch_node_name:
|
||||
value: 'elasticsearch'
|
||||
label: "ElasticSearch node's name"
|
||||
description: 'Label of the node running the ElasticSearch/Kibana plugin that is deployed in the environment.'
|
||||
weight: 30
|
||||
type: "text"
|
||||
restrictions:
|
||||
- condition: "settings:lma_collector.elasticsearch_mode.value != 'local'"
|
||||
action: "disable"
|
||||
|
||||
elasticsearch_address:
|
||||
value: ''
|
||||
label: 'ElasticSearch address'
|
||||
description: 'IP address or fully qualified domain name of the ElasticSearch server.'
|
||||
weight: 40
|
||||
type: "text"
|
||||
restrictions:
|
||||
- condition: "settings:lma_collector.elasticsearch_mode.value != 'remote'"
|
||||
action: "disable"
|
||||
regex:
|
||||
source: '^[a-zA-Z\d]+[_-.\da-zA-Z]*$'
|
||||
error: "Invalid address or name"
|
||||
|
||||
Reference in New Issue
Block a user