diff --git a/deployment_scripts/puppet/manifests/configure.pp b/deployment_scripts/puppet/manifests/configure.pp index 02cb113..059c8d6 100644 --- a/deployment_scripts/puppet/manifests/configure.pp +++ b/deployment_scripts/puppet/manifests/configure.pp @@ -3,24 +3,18 @@ notice('MODULAR: fuel-plugin-telemetry: configure.pp') # Let's use already defined params for ceilometer include ::ceilometer::params -$plugin_data = hiera_hash('telemetry', undef) -$resource_api = $plugin_data['resource_api'] -$event_api = $plugin_data['event_api'] - +$plugin_data = hiera_hash('telemetry', undef) +$resource_api = $plugin_data['resource_api'] +$event_api = $plugin_data['event_api'] +$network_metadata = hiera_hash('network_metadata') +$elasticsearch_server = hiera('telemetry::elasticsearch::server') +$elasticsearch_port = hiera('telemetry::elasticsearch::rest_port') # TODO_0 'set' default values when looking for via hiera # TODO_1 add if statments in case of 'advanced settings' passed through Fuel UI # TODO_2 checks if we can reach ES, influxdb before actioning? # Still needed $aodh_nodes ? -$aodh_nodes = hiera('aodh_nodes') +$aodh_nodes = hiera('aodh_nodes') -# TODO_3 es_node should be configured because of a bug in Ceilometer API -if hiera('lma::collector::elasticsearch::server', false) { - $elasticsearch_node = hiera('lma::collector::elasticsearch::server') - $elasticsearch_port = hiera('lma::collector::elasticsearch::rest_port') -} else { - $elasticsearch_node = '0.0.0.0' - $elasticsearch_port = '9200' -} $ceilometer_service_name = $::ceilometer::params::api_service_name # TODO move to hiera @@ -36,9 +30,23 @@ $influx_password = hiera('telemetry::influxdb::password') $metering_connection = "stacklight://${influx_user}:${influx_password}@${influxdb_address}:${influxdb_port}/${influxdb_database}" -$resource_connection = "es://${elasticsearch_node}:${elasticsearch_port}" -$event_connection = "es://${elasticsearch_node}:${elasticsearch_port}" -$connection = $metering_connection +if $event_api { + if ($elasticsearch_server != '' and $elasticsearch_port != ''){ + $event_connection = "es://${elasticsearch_server}:${elasticsearch_port}" + } + else{ + fail ("elasticsearch_server and elasticsearch_port variables can't be empty strings") + } +} + +if $resource_api { + if ($elasticsearch_server != '' and $elasticsearch_port != ''){ + $resource_connection = "es://${elasticsearch_server}:${elasticsearch_port}" + } + else{ + fail ("elasticsearch_server and elasticsearch_port variables can't be empty strings") + } +} $packages = { 'ceilometer-collector' => { @@ -130,32 +138,29 @@ else { } ceilometer_config { 'notification/workers': value => max($::processorcount/3,1) } -# Workaround for fixing Ceilometer bug in MOS9.0 -if hiera('fuel_version') == '9.0' { - file { '/usr/lib/python2.7/dist-packages/ceilometer/event/storage/impl_elasticsearch.py': - ensure => 'present', - content => file( 'telemetry/ceilometer_fixes/impl_elasticsearch.py' ), - mode => '0644', - owner => 'root', - group => 'root', - notify => Service['ceilometer-service','ceilometer-agent-notification'], - require => File['impl_elasticsearch.pyc'], - } +# Workaround for fixing Ceilometer bug in MOS9.x +file { '/usr/lib/python2.7/dist-packages/ceilometer/event/storage/impl_elasticsearch.py': + ensure => 'present', + content => file( 'telemetry/ceilometer_fixes/impl_elasticsearch.py' ), + mode => '0644', + owner => 'root', + group => 'root', + notify => Service['ceilometer-service','ceilometer-agent-notification'], + require => File['impl_elasticsearch.pyc'], +} - file {'/usr/lib/python2.7/dist-packages/ceilometer/event/storage/impl_elasticsearch.pyc': - ensure => 'absent', - alias => 'impl_elasticsearch.pyc', - } - - service {'ceilometer-agent-notification': - ensure => $service_ensure, - name => $::ceilometer::params::agent_notification_service_name, - enable => $enabled, - hasstatus => true, - hasrestart => true, - tag => 'ceilometer-agent-notification', - } +file {'/usr/lib/python2.7/dist-packages/ceilometer/event/storage/impl_elasticsearch.pyc': + ensure => 'absent', + alias => 'impl_elasticsearch.pyc', +} +service {'ceilometer-agent-notification': + ensure => $service_ensure, + name => $::ceilometer::params::agent_notification_service_name, + enable => $enabled, + hasstatus => true, + hasrestart => true, + tag => 'ceilometer-agent-notification', } service { 'ceilometer-service': diff --git a/deployment_scripts/puppet/manifests/hiera.pp b/deployment_scripts/puppet/manifests/hiera.pp index d188358..e67ae01 100644 --- a/deployment_scripts/puppet/manifests/hiera.pp +++ b/deployment_scripts/puppet/manifests/hiera.pp @@ -1,10 +1,10 @@ notice('MODULAR: fuel-plugin-telemetry: hiera.pp') -$plugin_data = hiera_hash('telemetry', undef) -prepare_network_config(hiera_hash('network_scheme', {})) +$plugin_data = hiera_hash('telemetry', undef) $network_metadata = hiera_hash('network_metadata') -$hiera_file = '/etc/hiera/plugins/telemetry.yaml' -$telemetry = hiera('telemetry') +$hiera_file = '/etc/hiera/plugins/telemetry.yaml' +$telemetry = hiera('telemetry') +prepare_network_config(hiera_hash('network_scheme', {})) # Ceilometer @@ -20,42 +20,30 @@ $ceilometer_metering_secret = $ceilometer_hash['metering_secret'] $ceilometer_user_password = $ceilometer_hash['user_password'] $elasticsearch_script_inline = 'on' $elasticsearch_script_indexed = 'on' +$elasticsearch_mode = $plugin_data['elasticsearch_mode'] # Elasticsearch - -$is_elasticsearch_node = roles_include(['elasticsearch_kibana', 'primary-elasticsearch_kibana']) - -if $plugin_data['elastic_search_ip'] { - $elasticsearch_mode = 'remote' -} else { - $elasticsearch_mode = 'local' -} - -#$elasticsearch_mode = $plugin_data['elasticsearch_mode'] -$es_nodes = get_nodes_hash_by_roles($network_metadata, ['elasticsearch_kibana', 'primary-elasticsearch_kibana']) -$es_nodes_count = count($es_nodes) +$es_vip_name = 'es_vip_mgmt' case $elasticsearch_mode { 'remote': { $es_server = $plugin_data['elastic_search_ip'] + $es_port = $plugin_data['elastic_search_port'] } 'local': { - $es_vip_name = 'es_vip_mgmt' if $network_metadata['vips'][$es_vip_name] { $es_server = $network_metadata['vips'][$es_vip_name]['ipaddr'] + # TODO: use data from hiera for $es_port. Can't do it rigt now. + $es_port = '9200' } else { - $es_server = undef + $es_server = '' + $es_port = '9200' } } default: { fail("'${elasticsearch_mode}' mode not supported for Elasticsearch") } } -if $es_nodes_count > 0 or $es_server { - $es_is_deployed = true -} else { - $es_is_deployed = false -} # InfluxDB @@ -166,11 +154,8 @@ lma::elasticsearch::script_indexed: "<%= @elasticsearch_script_indexed %>" # Elasticsearch -telemetry::elasticsearch::enabled: <%= @es_is_deployed %> -<% if @es_is_deployed -%> -telemetry::elasticsearch::server: <%= @es_server %> -telemetry::elasticsearch::rest_port: 9200 -<% end -%> +telemetry::elasticsearch::server: "<%= @es_server %>" +telemetry::elasticsearch::rest_port: "<%= @es_port %>" # IndluxDB diff --git a/deployment_scripts/puppet/manifests/hindsight.pp b/deployment_scripts/puppet/manifests/hindsight.pp index 197084a..632202a 100644 --- a/deployment_scripts/puppet/manifests/hindsight.pp +++ b/deployment_scripts/puppet/manifests/hindsight.pp @@ -14,12 +14,16 @@ $metadata_fields = hiera('telemetry::metadata_fields') $topics = 'metering.sample' $modules_dir = hiera('telemetry::lua::modules_dir') -if hiera('telemetry::elasticsearch::enabled') { +if hiera('telemetry::elasticsearch::server', false) { $es_server = hiera('telemetry::elasticsearch::server') - $es_port = hiera('telemetry::elasticsearch::rest_port') } else { $es_server = '' - $es_port = '' +} + +if hiera('telemetry::elasticsearch::rest_port', false) { + $es_port = hiera('telemetry::elasticsearch::rest_port') +} else { + $es_port = '' } # Kafka integration diff --git a/deployment_scripts/puppet/manifests/notifications.pp b/deployment_scripts/puppet/manifests/notifications.pp new file mode 100644 index 0000000..07778e8 --- /dev/null +++ b/deployment_scripts/puppet/manifests/notifications.pp @@ -0,0 +1,233 @@ +# Copyright 2016 Mirantis, Inc. +# +# 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. + +notice('fuel-plugin-openstack-telemetry: notifications.pp') + +$ceilometer = hiera_hash('ceilometer', {}) +$rabbit = hiera_hash('rabbit') +$storage_options = hiera_hash('storage', {}) +$murano = hiera_hash('murano') +$sahara = hiera_hash('sahara') +$telemetry = hiera_hash('telemetry', {}) +$influxdb_grafana = hiera_hash('influxdb_grafana', false) +$elasticsearch_kibana = hiera_hash('elasticsearch_kibana', false) + +$telemetry_enabled = $telemetry['metadata']['enabled'] +if $influxdb_grafana { + $influxdb_grafana_enabled = $influxdb_grafana['metadata']['enabled'] +} +else{ + $influxdb_grafana_enabled = false +} + +if $elasticsearch_kibana { + $elasticsearch_kibana_enabled = $elasticsearch_kibana['metadata']['enabled'] +} +else{ + $elasticsearch_kibana_enabled = false +} + +if ($ceilometer['enabled'] or $telemetry_enabled) and ($influxdb_grafana_enabled or $elasticsearch_kibana_enabled){ + $notification_topics = ['notifications, lma_notifications'] +} + +else { + $notification_topics = ['lma_notifications'] +} + +## Make sure the Log and Metric collector services are configured with the +## "pacemaker" provider +#Service<| title == 'log_collector' |> { +# provider => 'pacemaker' +#} +#Service<| title == 'metric_collector' |> { +# provider => 'pacemaker' +#} + +# OpenStack logs and notifications are useful for deriving metrics, so we enable +# them even if Elasticsearch is disabled. + # Sahara notifications + if $sahara['enabled'] { + include sahara::params + $sahara_api_service = $::sahara::params::api_service_name + $sahara_engine_service = $::sahara::params::engine_service_name + + sahara_config { 'DEFAULT/enable_notifications': + value => true, + notify => Service[$sahara_api_service, $sahara_engine_service], + } + sahara_config { 'DEFAULT/notification_topics': + value => $notification_topics, + notify => Service[$sahara_api_service, $sahara_engine_service], + } + sahara_config { 'DEFAULT/notification_driver': + value => 'messaging', + notify => Service[$sahara_api_service, $sahara_engine_service], + } + + service { [$sahara_api_service, $sahara_engine_service]: + hasstatus => true, + hasrestart => true, + } + } + + # Nova notifications + include nova::params + $nova_api_service = $::nova::params::api_service_name + $nova_conductor_service = $::nova::params::conductor_service_name + $nova_scheduler_service = $::nova::params::scheduler_service_name + + nova_config { 'DEFAULT/notification_topics': + value => $notification_topics, + notify => Service[$nova_api_service, $nova_conductor_service, $nova_scheduler_service], + } + nova_config { 'DEFAULT/notification_driver': + value => 'messaging', + notify => Service[$nova_api_service, $nova_conductor_service, $nova_scheduler_service], + } + nova_config { 'DEFAULT/notify_on_state_change': + value => 'vm_and_task_state', + notify => Service[$nova_api_service, $nova_conductor_service, $nova_scheduler_service], + } + + service { [$nova_api_service, $nova_conductor_service, $nova_scheduler_service]: + hasstatus => true, + hasrestart => true, + } + + # Cinder notifications + include cinder::params + $cinder_api_service = $::cinder::params::api_service + $cinder_scheduler_service = $::cinder::params::scheduler_service + $cinder_volume_service = $::cinder::params::volume_service + + if $storage_options['volumes_ceph'] { + # In this case, cinder-volume runs on controller node + $cinder_services = [$cinder_api_service, $cinder_scheduler_service, $cinder_volume_service] + } else { + $cinder_services = [$cinder_api_service, $cinder_scheduler_service] + } + + cinder_config { 'DEFAULT/notification_topics': + value => $notification_topics, + notify => Service[$cinder_services], + } + cinder_config { 'DEFAULT/notification_driver': + value => 'messaging', + notify => Service[$cinder_services], + } + + service { $cinder_services: + hasstatus => true, + hasrestart => true, + } + + # Keystone notifications + # Keystone is executed as a WSGI application inside Apache so the Apache + # service needs to be restarted if necessary + include apache::params + include apache::service + + keystone_config { 'DEFAULT/notification_topics': + value => $notification_topics, + notify => Class['apache::service'], + } + keystone_config { 'DEFAULT/notification_driver': + value => 'messaging', + notify => Class['apache::service'], + } + + # Neutron notifications + include neutron::params + + neutron_config { 'DEFAULT/notification_topics': + value => $notification_topics, + notify => Service[$::neutron::params::server_service], + } + neutron_config { 'DEFAULT/notification_driver': + value => 'messaging', + notify => Service[$::neutron::params::server_service], + } + + service { $::neutron::params::server_service: + hasstatus => true, + hasrestart => true, + } + + # Glance notifications + include glance::params + + $glance_api_service = $::glance::params::api_service_name + $glance_registry_service = $::glance::params::registry_service_name + + # Default value is 'image.localhost' for Glance + $glance_publisher_id = "image.${::hostname}" + + glance_api_config { 'DEFAULT/notification_topics': + value => $notification_topics, + notify => Service[$glance_api_service], + } + glance_api_config { 'DEFAULT/notification_driver': + value => 'messaging', + notify => Service[$glance_api_service], + } + glance_api_config { 'DEFAULT/default_publisher_id': + value => $glance_publisher_id, + notify => Service[$glance_api_service], + } + glance_registry_config { 'DEFAULT/notification_topics': + value => $notification_topics, + notify => Service[$glance_registry_service], + } + glance_registry_config { 'DEFAULT/notification_driver': + value => 'messaging', + notify => Service[$glance_registry_service], + } + glance_registry_config { 'DEFAULT/default_publisher_id': + value => $glance_publisher_id, + notify => Service[$glance_registry_service], + } + + service { [$glance_api_service, $glance_registry_service]: + hasstatus => true, + hasrestart => true, + } + + # Heat notifications + include heat::params + + $heat_api_service = $::heat::params::api_service_name + $heat_engine_service = $::heat::params::engine_service_name + + heat_config { 'DEFAULT/notification_topics': + value => $notification_topics, + notify => Service[$heat_api_service, $heat_engine_service], + } + heat_config { 'DEFAULT/notification_driver': + value => 'messaging', + notify => Service[$heat_api_service, $heat_engine_service], + } + + service { $heat_api_service: + hasstatus => true, + hasrestart => true, + } + + # The heat-engine service is managed by Pacemaker. + service { $heat_engine_service: + hasstatus => true, + hasrestart => true, + provider => 'pacemaker', + } + diff --git a/deployment_tasks.yaml b/deployment_tasks.yaml index 60b78e7..d9ab2e4 100644 --- a/deployment_tasks.yaml +++ b/deployment_tasks.yaml @@ -267,6 +267,17 @@ puppet_modules: puppet/modules:/etc/puppet/modules timeout: 300 +- id: telemetry-notifications + type: puppet + version: 2.1.0 + groups: [primary-controller, controller] + required_for: [post_deployment_end] + requires: [telemetry-ceilometer-controller, telemetry-integration-configuration] + parameters: + puppet_manifest: puppet/manifests/notifications.pp + puppet_modules: puppet/modules:/etc/puppet/modules + timeout: 300 + # skip base tasks - id: ceilometer-radosgw-user type: skipped