initial version for installing ceilometer and aodh by using core functionality
This commit includes: ceilometer config adjustment for integration with rabbit and stacklight installs all required packages removes unneeded ceilometer-collector influxdb integration Change-Id: I547921e3d4fc031c77d45647fa85f6f3958524f7
This commit is contained in:
parent
ddef946a0f
commit
e0512ed1a8
|
@ -0,0 +1,202 @@
|
|||
Apache License
|
||||
Version 2.0, January 2004
|
||||
http://www.apache.org/licenses/
|
||||
|
||||
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
||||
|
||||
1. Definitions.
|
||||
|
||||
"License" shall mean the terms and conditions for use, reproduction,
|
||||
and distribution as defined by Sections 1 through 9 of this document.
|
||||
|
||||
"Licensor" shall mean the copyright owner or entity authorized by
|
||||
the copyright owner that is granting the License.
|
||||
|
||||
"Legal Entity" shall mean the union of the acting entity and all
|
||||
other entities that control, are controlled by, or are under common
|
||||
control with that entity. For the purposes of this definition,
|
||||
"control" means (i) the power, direct or indirect, to cause the
|
||||
direction or management of such entity, whether by contract or
|
||||
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
||||
outstanding shares, or (iii) beneficial ownership of such entity.
|
||||
|
||||
"You" (or "Your") shall mean an individual or Legal Entity
|
||||
exercising permissions granted by this License.
|
||||
|
||||
"Source" form shall mean the preferred form for making modifications,
|
||||
including but not limited to software source code, documentation
|
||||
source, and configuration files.
|
||||
|
||||
"Object" form shall mean any form resulting from mechanical
|
||||
transformation or translation of a Source form, including but
|
||||
not limited to compiled object code, generated documentation,
|
||||
and conversions to other media types.
|
||||
|
||||
"Work" shall mean the work of authorship, whether in Source or
|
||||
Object form, made available under the License, as indicated by a
|
||||
copyright notice that is included in or attached to the work
|
||||
(an example is provided in the Appendix below).
|
||||
|
||||
"Derivative Works" shall mean any work, whether in Source or Object
|
||||
form, that is based on (or derived from) the Work and for which the
|
||||
editorial revisions, annotations, elaborations, or other modifications
|
||||
represent, as a whole, an original work of authorship. For the purposes
|
||||
of this License, Derivative Works shall not include works that remain
|
||||
separable from, or merely link (or bind by name) to the interfaces of,
|
||||
the Work and Derivative Works thereof.
|
||||
|
||||
"Contribution" shall mean any work of authorship, including
|
||||
the original version of the Work and any modifications or additions
|
||||
to that Work or Derivative Works thereof, that is intentionally
|
||||
submitted to Licensor for inclusion in the Work by the copyright owner
|
||||
or by an individual or Legal Entity authorized to submit on behalf of
|
||||
the copyright owner. For the purposes of this definition, "submitted"
|
||||
means any form of electronic, verbal, or written communication sent
|
||||
to the Licensor or its representatives, including but not limited to
|
||||
communication on electronic mailing lists, source code control systems,
|
||||
and issue tracking systems that are managed by, or on behalf of, the
|
||||
Licensor for the purpose of discussing and improving the Work, but
|
||||
excluding communication that is conspicuously marked or otherwise
|
||||
designated in writing by the copyright owner as "Not a Contribution."
|
||||
|
||||
"Contributor" shall mean Licensor and any individual or Legal Entity
|
||||
on behalf of whom a Contribution has been received by Licensor and
|
||||
subsequently incorporated within the Work.
|
||||
|
||||
2. Grant of Copyright License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
copyright license to reproduce, prepare Derivative Works of,
|
||||
publicly display, publicly perform, sublicense, and distribute the
|
||||
Work and such Derivative Works in Source or Object form.
|
||||
|
||||
3. Grant of Patent License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
(except as stated in this section) patent license to make, have made,
|
||||
use, offer to sell, sell, import, and otherwise transfer the Work,
|
||||
where such license applies only to those patent claims licensable
|
||||
by such Contributor that are necessarily infringed by their
|
||||
Contribution(s) alone or by combination of their Contribution(s)
|
||||
with the Work to which such Contribution(s) was submitted. If You
|
||||
institute patent litigation against any entity (including a
|
||||
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
||||
or a Contribution incorporated within the Work constitutes direct
|
||||
or contributory patent infringement, then any patent licenses
|
||||
granted to You under this License for that Work shall terminate
|
||||
as of the date such litigation is filed.
|
||||
|
||||
4. Redistribution. You may reproduce and distribute copies of the
|
||||
Work or Derivative Works thereof in any medium, with or without
|
||||
modifications, and in Source or Object form, provided that You
|
||||
meet the following conditions:
|
||||
|
||||
(a) You must give any other recipients of the Work or
|
||||
Derivative Works a copy of this License; and
|
||||
|
||||
(b) You must cause any modified files to carry prominent notices
|
||||
stating that You changed the files; and
|
||||
|
||||
(c) You must retain, in the Source form of any Derivative Works
|
||||
that You distribute, all copyright, patent, trademark, and
|
||||
attribution notices from the Source form of the Work,
|
||||
excluding those notices that do not pertain to any part of
|
||||
the Derivative Works; and
|
||||
|
||||
(d) If the Work includes a "NOTICE" text file as part of its
|
||||
distribution, then any Derivative Works that You distribute must
|
||||
include a readable copy of the attribution notices contained
|
||||
within such NOTICE file, excluding those notices that do not
|
||||
pertain to any part of the Derivative Works, in at least one
|
||||
of the following places: within a NOTICE text file distributed
|
||||
as part of the Derivative Works; within the Source form or
|
||||
documentation, if provided along with the Derivative Works; or,
|
||||
within a display generated by the Derivative Works, if and
|
||||
wherever such third-party notices normally appear. The contents
|
||||
of the NOTICE file are for informational purposes only and
|
||||
do not modify the License. You may add Your own attribution
|
||||
notices within Derivative Works that You distribute, alongside
|
||||
or as an addendum to the NOTICE text from the Work, provided
|
||||
that such additional attribution notices cannot be construed
|
||||
as modifying the License.
|
||||
|
||||
You may add Your own copyright statement to Your modifications and
|
||||
may provide additional or different license terms and conditions
|
||||
for use, reproduction, or distribution of Your modifications, or
|
||||
for any such Derivative Works as a whole, provided Your use,
|
||||
reproduction, and distribution of the Work otherwise complies with
|
||||
the conditions stated in this License.
|
||||
|
||||
5. Submission of Contributions. Unless You explicitly state otherwise,
|
||||
any Contribution intentionally submitted for inclusion in the Work
|
||||
by You to the Licensor shall be under the terms and conditions of
|
||||
this License, without any additional terms or conditions.
|
||||
Notwithstanding the above, nothing herein shall supersede or modify
|
||||
the terms of any separate license agreement you may have executed
|
||||
with Licensor regarding such Contributions.
|
||||
|
||||
6. Trademarks. This License does not grant permission to use the trade
|
||||
names, trademarks, service marks, or product names of the Licensor,
|
||||
except as required for reasonable and customary use in describing the
|
||||
origin of the Work and reproducing the content of the NOTICE file.
|
||||
|
||||
7. Disclaimer of Warranty. Unless required by applicable law or
|
||||
agreed to in writing, Licensor provides the Work (and each
|
||||
Contributor provides its Contributions) on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
implied, including, without limitation, any warranties or conditions
|
||||
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
||||
PARTICULAR PURPOSE. You are solely responsible for determining the
|
||||
appropriateness of using or redistributing the Work and assume any
|
||||
risks associated with Your exercise of permissions under this License.
|
||||
|
||||
8. Limitation of Liability. In no event and under no legal theory,
|
||||
whether in tort (including negligence), contract, or otherwise,
|
||||
unless required by applicable law (such as deliberate and grossly
|
||||
negligent acts) or agreed to in writing, shall any Contributor be
|
||||
liable to You for damages, including any direct, indirect, special,
|
||||
incidental, or consequential damages of any character arising as a
|
||||
result of this License or out of the use or inability to use the
|
||||
Work (including but not limited to damages for loss of goodwill,
|
||||
work stoppage, computer failure or malfunction, or any and all
|
||||
other commercial damages or losses), even if such Contributor
|
||||
has been advised of the possibility of such damages.
|
||||
|
||||
9. Accepting Warranty or Additional Liability. While redistributing
|
||||
the Work or Derivative Works thereof, You may choose to offer,
|
||||
and charge a fee for, acceptance of support, warranty, indemnity,
|
||||
or other liability obligations and/or rights consistent with this
|
||||
License. However, in accepting such obligations, You may act only
|
||||
on Your own behalf and on Your sole responsibility, not on behalf
|
||||
of any other Contributor, and only if You agree to indemnify,
|
||||
defend, and hold each Contributor harmless for any liability
|
||||
incurred by, or claims asserted against, such Contributor by reason
|
||||
of your accepting any such warranty or additional liability.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
APPENDIX: How to apply the Apache License to your work.
|
||||
|
||||
To apply the Apache License to your work, attach the following
|
||||
boilerplate notice, with the fields enclosed by brackets "{}"
|
||||
replaced with your own identifying information. (Don't include
|
||||
the brackets!) The text should be enclosed in the appropriate
|
||||
comment syntax for the file format. We also recommend that a
|
||||
file or class name and description of purpose be included on the
|
||||
same "printed page" as the copyright notice for easier
|
||||
identification within third-party archives.
|
||||
|
||||
Copyright {yyyy} {name of copyright owner}
|
||||
|
||||
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.
|
||||
|
|
@ -0,0 +1,4 @@
|
|||
Fuel Plugin Openstack Telemetry
|
||||
===============================
|
||||
|
||||
Plugin description
|
|
@ -0,0 +1,12 @@
|
|||
# This file contains wizard components descriptions that are pretty similar to
|
||||
# the `environment_config.yaml`.
|
||||
# Please, take a look at following link for the details:
|
||||
# - https://blueprints.launchpad.net/fuel/+spec/component-registry
|
||||
# - https://specs.openstack.org/openstack/fuel-specs/specs/8.0/component-registry.html
|
||||
|
||||
- name: additional_service:telemetry
|
||||
compatible: []
|
||||
requires: []
|
||||
incompatible: []
|
||||
label: "Plugin label, that will be shown on UI"
|
||||
description: "Component description (optional)"
|
|
@ -0,0 +1,2 @@
|
|||
Gemfile.lock
|
||||
.bundle
|
|
@ -0,0 +1,20 @@
|
|||
# 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.
|
||||
source 'https://rubygems.org'
|
||||
|
||||
group :development, :test do
|
||||
gem 'rake'
|
||||
gem "puppet", ENV['PUPPET_VERSION'] || '~> 3.4.0'
|
||||
gem 'puppetlabs_spec_helper'
|
||||
end
|
|
@ -0,0 +1,13 @@
|
|||
require 'puppet-lint/tasks/puppet-lint'
|
||||
require 'puppet-syntax/tasks/puppet-syntax'
|
||||
|
||||
PuppetLint.configuration.fail_on_warnings = true
|
||||
PuppetLint.configuration.send('disable_80chars')
|
||||
PuppetLint.configuration.send('disable_class_inherits_from_params_class')
|
||||
PuppetLint.configuration.send('disable_class_parameter_defaults')
|
||||
|
||||
desc "Run lint, and syntax tests."
|
||||
task :test => [
|
||||
:lint,
|
||||
:syntax,
|
||||
]
|
|
@ -0,0 +1,3 @@
|
|||
notice('MODULAR: fuel-plugin-telemetry: influxdb-create-db.pp')
|
||||
|
||||
class { 'telemetry::create_influxdb_database': }
|
|
@ -0,0 +1,111 @@
|
|||
notice('MODULAR: fuel-plugin-telemetry: configure.pp')
|
||||
|
||||
# Let's use already defined params for ceilometer
|
||||
include ::ceilometer::params
|
||||
|
||||
# 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')
|
||||
|
||||
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 = ''
|
||||
$elasticsearch_port = ''
|
||||
}
|
||||
|
||||
|
||||
if hiera('lma::collector::influxdb::server', false) {
|
||||
$influxdb_vip = hiera('lma::collector::influxdb::server')
|
||||
$influxdb_port = hiera('lma::collector::influxdb::port')
|
||||
$influx_database = hiera('lma::collector::influxdb::database')
|
||||
# TODO move to hiera
|
||||
$influx_user = 'root'
|
||||
$influx_password = hiera('lma::collector::influxdb::password')
|
||||
$influx_root_password = hiera('lma::collector::influxdb::root_password')
|
||||
} else {
|
||||
$influxdb_vip = ''
|
||||
$influxdb_port = ''
|
||||
$influx_database = ''
|
||||
# TODO move to hiera
|
||||
$influx_user = ''
|
||||
$influx_password = ''
|
||||
$influx_root_password = ''
|
||||
}
|
||||
$ceilometer_service_name = $::ceilometer::params::api_service_name
|
||||
# TODO move to hiera
|
||||
$event_pipeline_file = '/etc/ceilometer/event_pipeline.yaml'
|
||||
# TODO move to hiera
|
||||
$ceilometer_publishers = 'direct'
|
||||
|
||||
# calculated values
|
||||
$metering_connection = "stacklight://${influx_user}:${influx_password}@${influxdb_vip}:${influxdb_port}/ceilometer"
|
||||
$resource_connection = "es://${elasticsearch_node}:${elasticsearch_port}"
|
||||
$event_connection = "es://${elasticsearch_node}:${elasticsearch_port}"
|
||||
$connection = $metering_connection
|
||||
|
||||
$packages = {
|
||||
'ceilometer-collector' => {
|
||||
# keep 'absent' instead of 'purged' for idempotence
|
||||
ensure => 'absent',
|
||||
require => Service["ceilometer-collector"],
|
||||
},
|
||||
'python-pip' => {
|
||||
ensure => 'present',
|
||||
},
|
||||
'influxdb' => {
|
||||
ensure => 'present',
|
||||
provider => 'pip',
|
||||
require => Package['python-pip'],
|
||||
# Not sure at a momment
|
||||
notify => Service['ceilometer-service']
|
||||
},
|
||||
'elasticsearch' => {
|
||||
ensure => 'present',
|
||||
provider => 'pip',
|
||||
require => Package['python-pip'],
|
||||
# Not sure at a momment
|
||||
notify => Service['ceilometer-service']
|
||||
},
|
||||
}
|
||||
|
||||
# TODO FOR V3: stop collector only when qeue is empty*
|
||||
# *wait utill all the events went from collector
|
||||
# before stop collector service
|
||||
# maybe service'collector' ensure stopped; require exec 'wait for qeue is empty'
|
||||
|
||||
create_resources(package, $packages)
|
||||
|
||||
# Stop not needed any more service
|
||||
service { 'ceilometer-collector':
|
||||
ensure => stopped,
|
||||
enable => false,
|
||||
hasstatus => true,
|
||||
}
|
||||
|
||||
# TODO validate values before proceed
|
||||
|
||||
ceilometer_config { 'database/metering_connection': value => "${metering_connection}" }
|
||||
ceilometer_config { 'database/resource_connection': value => "${resource_connection}" }
|
||||
ceilometer_config { 'database/event_connection': value => "${event_connection}" }
|
||||
ceilometer_config { 'database/connection': value => "${connection}" }
|
||||
|
||||
service { 'ceilometer-service':
|
||||
ensure => $service_ensure,
|
||||
name => $::ceilometer::params::api_service_name,
|
||||
enable => $enabled,
|
||||
hasstatus => true,
|
||||
hasrestart => true,
|
||||
tag => 'ceilometer-service',
|
||||
}
|
||||
|
||||
Ceilometer_config<||> ~> Service['ceilometer-service']
|
||||
|
||||
class { 'telemetry':
|
||||
event_pipeline_file => $event_pipeline_file,
|
||||
publishers => $ceilometer_publishers,
|
||||
}
|
||||
|
|
@ -0,0 +1,40 @@
|
|||
notice('MODULAR: fuel-plugin-telemetry: hiera.pp')
|
||||
|
||||
$ceilometer_hash = hiera_hash('ceilometer', $default_ceilometer_hash)
|
||||
$ceilometer_alarm_history_time_to_live = $ceilometer_hash['alarm_history_time_to_live']
|
||||
$ceilometer_event_time_to_live = $ceilometer_hash['event_time_to_live']
|
||||
$ceilometer_metering_time_to_live = $ceilometer_hash['metering_time_to_live']
|
||||
$ceilometer_http_timeout = $ceilometer_hash['http_timeout']
|
||||
$ceilometer_notification_driver = $ceilometer_hash['notification_driver']
|
||||
$ceilometer_db_password = $ceilometer_hash['db_password']
|
||||
$ceilometer_enabled = true
|
||||
$ceilometer_metering_secret = $ceilometer_hash['metering_secret']
|
||||
$ceilometer_user_password = $ceilometer_hash['user_password']
|
||||
$elasticsearch_script_inline = 'on'
|
||||
$elasticsearch_script_indexed = 'on'
|
||||
|
||||
$hiera_file = '/etc/hiera/plugins/telemetry.yaml'
|
||||
|
||||
$calculated_content = inline_template('
|
||||
---
|
||||
ceilometer:
|
||||
alarm_history_time_to_live: "<%= @ceilometer_alarm_history_time_to_live %>"
|
||||
event_time_to_live: "<%= @ceilometer_event_time_to_live %>"
|
||||
metering_time_to_live: "<%= @ceilometer_metering_time_to_live %>"
|
||||
http_timeout: "<%= @ceilometer_http_timeout %>"
|
||||
notification_driver: "<%= @ceilometer_notification_driver %>"
|
||||
db_password: "<%= @ceilometer_db_password %>"
|
||||
enabled: "<%= @ceilometer_enabled %>"
|
||||
metering_secret: "<%= @ceilometer_metering_secret %>"
|
||||
user_password: "<%= @ceilometer_user_password %>"
|
||||
|
||||
# Required for StackLight LMA ElasticSearch params
|
||||
lma::elasticsearch::script_inline: "<%= @elasticsearch_script_inline %>"
|
||||
lma::elasticsearch::script_indexed: "<%= @elasticsearch_script_indexed %>"
|
||||
')
|
||||
|
||||
|
||||
file { $hiera_file:
|
||||
ensure => file,
|
||||
content => $calculated_content,
|
||||
}
|
|
@ -0,0 +1,76 @@
|
|||
# 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.
|
||||
|
||||
class telemetry::create_influxdb_database () {
|
||||
|
||||
notice('fuel-plugin-influxdb-grafana: influxdb_configuration.pp')
|
||||
|
||||
$telemetry = hiera('telemetry')
|
||||
notice($telemetry)
|
||||
|
||||
if $telemetry['influxdb_ip'] {
|
||||
|
||||
notice('Use External InfluxDB')
|
||||
|
||||
$influxdb_server = $telemetry['influxdb_ip']
|
||||
$local_port = $telemetry['influxdb_port']
|
||||
$admin_user = $telemetry['influxdb_admin_user']
|
||||
$admin_password = $telemetry['influxdb_admin_pass']
|
||||
$username = $telemetry['influxdb_username']
|
||||
$password = $telemetry['influxdb_userpass']
|
||||
$retention_period = 30
|
||||
|
||||
} else {
|
||||
|
||||
notice('Use StackLight integrated InfluxDB')
|
||||
|
||||
if !hiera('influxdb_grafana',false) {
|
||||
fail('influxdb_grafana not found, looks like plugin is not installed')
|
||||
}
|
||||
|
||||
$influxdb_grafana = hiera('influxdb_grafana')
|
||||
|
||||
# influx ip
|
||||
prepare_network_config(hiera_hash('network_scheme', {}))
|
||||
$network_metadata = hiera_hash('network_metadata')
|
||||
$influxdb_nodes = get_nodes_hash_by_roles($network_metadata, ['influxdb_grafana', 'primary-influxdb_grafana'])
|
||||
$nodes_array = values($influxdb_nodes)
|
||||
# test for multiple inxlixdb nodes !!!
|
||||
$influxdb_server = $nodes_array[0]['network_roles']['management']
|
||||
#$influxdb_server = $influxdb_nodes[0]['internal_address']
|
||||
|
||||
$local_port = 8086
|
||||
$admin_user = 'root'
|
||||
$admin_password = $influxdb_grafana['influxdb_rootpass']
|
||||
$username = $influxdb_grafana['influxdb_username']
|
||||
$password = $influxdb_grafana['influxdb_userpass']
|
||||
$retention_period = $influxdb_grafana['retention_period']
|
||||
|
||||
}
|
||||
|
||||
$influxdb_url = "http://${influxdb_server}:${local_port}"
|
||||
$replication_factor = 3
|
||||
$database_name = 'ceilometer'
|
||||
|
||||
telemetry::influxdb_database { $database_name:
|
||||
admin_user => $admin_user,
|
||||
admin_password => $admin_password,
|
||||
influxdb_url => $influxdb_url,
|
||||
db_user => $username,
|
||||
db_password => $password,
|
||||
retention_period => $retention_period,
|
||||
replication_factor => $replication_factor,
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,53 @@
|
|||
# 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.
|
||||
#
|
||||
# == Define: lma_monitoring_analytics::influxdb_database
|
||||
|
||||
define telemetry::influxdb_database (
|
||||
$admin_user,
|
||||
$admin_password,
|
||||
$influxdb_url,
|
||||
$db_user,
|
||||
$db_password,
|
||||
$retention_period = 30,
|
||||
$replication_factor = 3,
|
||||
) {
|
||||
|
||||
$db_name = $title
|
||||
$create_db_script = "/tmp/create_db_${db_name}"
|
||||
|
||||
# retention period value is expressd in days
|
||||
if $retention_period == 0 {
|
||||
$real_retention_period = 'INF'
|
||||
} else {
|
||||
$real_retention_period = sprintf('%dd', $retention_period)
|
||||
}
|
||||
|
||||
file { $create_db_script:
|
||||
owner => 'root',
|
||||
group => 'root',
|
||||
mode => '0740',
|
||||
content => template('telemetry/create_db.sh.erb'),
|
||||
}
|
||||
|
||||
exec { "run_${create_db_script}":
|
||||
command => $create_db_script,
|
||||
require => File[$create_db_script],
|
||||
}
|
||||
|
||||
exec { "remove_${create_db_script}":
|
||||
command => "/bin/rm -f ${create_db_script}",
|
||||
require => Exec["run_${create_db_script}"],
|
||||
}
|
||||
}
|
|
@ -0,0 +1,11 @@
|
|||
class telemetry (
|
||||
$event_pipeline_file,
|
||||
$publishers,
|
||||
) {
|
||||
|
||||
file { "${event_pipeline_file}":
|
||||
ensure => 'present',
|
||||
content => template('telemetry/event_pipeline.yaml.erb')
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,34 @@
|
|||
#!/bin/bash
|
||||
# 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.
|
||||
|
||||
set -eux
|
||||
|
||||
# Create the database
|
||||
curl -G "<%= @influxdb_url %>/query" \
|
||||
--data-urlencode "u=<%= @admin_user %>" \
|
||||
--data-urlencode "p=<%= @admin_password %>" \
|
||||
--data-urlencode "q=CREATE DATABASE <%= @db_name %>"
|
||||
|
||||
# Give all privileges to user for the DB
|
||||
curl -G "<%= @influxdb_url %>/query" \
|
||||
--data-urlencode "u=<%= @admin_user %>" \
|
||||
--data-urlencode "p=<%= @admin_password %>" \
|
||||
--data-urlencode "q=GRANT ALL ON <%= @db_name %> TO <%= @db_user %>"
|
||||
|
||||
# Define the retentation policy
|
||||
curl -G "<%= @influxdb_url %>/query" \
|
||||
--data-urlencode "u=<%= @admin_user %>" \
|
||||
--data-urlencode "p=<%= @admin_password %>" \
|
||||
--data-urlencode "q=ALTER RETENTION POLICY default ON <%= @db_name %> DURATION <%= @real_retention_period %> REPLICATION <%= @replication_factor %>"
|
|
@ -0,0 +1,15 @@
|
|||
---
|
||||
sources:
|
||||
- name: event_source
|
||||
events:
|
||||
- "*"
|
||||
- "!identity.authenticate"
|
||||
sinks:
|
||||
- event_sink
|
||||
sinks:
|
||||
- name: event_sink
|
||||
transformers:
|
||||
triggers:
|
||||
publishers:
|
||||
- <%= @publishers %>://
|
||||
|
|
@ -0,0 +1,228 @@
|
|||
# Groups definitions
|
||||
####################
|
||||
|
||||
# Tasks definitions for the deployment
|
||||
######################################
|
||||
- id: telemetry-hiera
|
||||
type: puppet
|
||||
version: 2.0.0
|
||||
requires: [globals]
|
||||
required_for: [logging]
|
||||
role: ['/.*/']
|
||||
parameters:
|
||||
puppet_manifest: "puppet/manifests/hiera.pp"
|
||||
puppet_modules: "puppet/modules:/etc/puppet/modules"
|
||||
timeout: 120
|
||||
# reexecute_on is needed for scale-down operations
|
||||
reexecute_on:
|
||||
- deploy_changes
|
||||
|
||||
# AODH related tasks
|
||||
####################
|
||||
- id: telemetry-aodh
|
||||
type: puppet
|
||||
version: 2.1.0
|
||||
groups: [primary-controller, controller]
|
||||
required_for: [ceilometer-controller, openstack-controller]
|
||||
requires: [openstack-haproxy]
|
||||
cross-depends:
|
||||
- name: telemetry-aodh-db
|
||||
- name: telemetry-aodh-keystone
|
||||
- name: telemetry-hiera
|
||||
role: [primary-controller, controller]
|
||||
parameters:
|
||||
puppet_manifest: "/etc/puppet/modules/openstack_tasks/examples/aodh/aodh.pp"
|
||||
puppet_modules: "/etc/puppet/modules"
|
||||
timeout: 3600
|
||||
reexecute_on:
|
||||
- deploy_changes
|
||||
test_pre:
|
||||
cmd: ruby /etc/puppet/modules/openstack_tasks/examples/aodh/aodh_pre.rb
|
||||
test_post:
|
||||
cmd: ruby /etc/puppet/modules/openstack_tasks/examples/aodh/aodh_post.rb
|
||||
|
||||
- id: telemetry-aodh-keystone
|
||||
type: puppet
|
||||
version: 2.1.0
|
||||
groups: [primary-controller]
|
||||
required_for: [telemetry-aodh]
|
||||
requires: [primary-keystone, keystone]
|
||||
cross-depends:
|
||||
- name: keystone
|
||||
role: self
|
||||
role: [primary-controller, controller]
|
||||
parameters:
|
||||
puppet_manifest: "/etc/puppet/modules/openstack_tasks/examples/aodh/keystone.pp"
|
||||
puppet_modules: "/etc/puppet/modules"
|
||||
timeout: 1800
|
||||
|
||||
- id: telemetry-aodh-db
|
||||
type: puppet
|
||||
version: 2.1.0
|
||||
groups: [primary-controller]
|
||||
cross-depends:
|
||||
- name: /^(primary-)?database$/
|
||||
required_for: [telemetry-aodh]
|
||||
role: [primary-controller, controller]
|
||||
requires: [primary-database, database]
|
||||
parameters:
|
||||
puppet_manifest: "/etc/puppet/modules/openstack_tasks/examples/aodh/db.pp"
|
||||
puppet_modules: "/etc/puppet/modules"
|
||||
timeout: 1800
|
||||
|
||||
- id: telemetry-openstack-haproxy-aodh
|
||||
type: puppet
|
||||
version: 2.1.0
|
||||
groups: [primary-controller, controller]
|
||||
required_for: [deploy_end]
|
||||
requires: [deploy_start, primary-cluster-haproxy, cluster-haproxy]
|
||||
cross-depends:
|
||||
- name: /(primary-)?cluster-haproxy/
|
||||
role: self
|
||||
parameters:
|
||||
puppet_manifest: "/etc/puppet/modules/osnailyfacter/modular/openstack-haproxy/openstack-haproxy-aodh.pp"
|
||||
puppet_modules: "/etc/puppet/modules"
|
||||
timeout: 300
|
||||
test_pre:
|
||||
cmd: ruby /etc/puppet/modules/osnailyfacter/modular/openstack-haproxy/openstack-haproxy_pre.rb
|
||||
test_post:
|
||||
cmd: ruby /etc/puppet/modules/osnailyfacter/modular/openstack-haproxy/openstack-haproxy-aodh_post.rb
|
||||
|
||||
# Ceilometer related tasks
|
||||
##########################
|
||||
- id: telemetry-ceilometer-controller
|
||||
type: puppet
|
||||
version: 2.1.0
|
||||
cross-depends:
|
||||
- name: telemetry-ceilometer-keystone
|
||||
- name: telemetry-hiera
|
||||
groups: [primary-controller, controller]
|
||||
required_for: [primary-openstack-controller, openstack-controller]
|
||||
requires: [openstack-haproxy]
|
||||
parameters:
|
||||
puppet_manifest: "/etc/puppet/modules/openstack_tasks/examples/ceilometer/controller.pp"
|
||||
puppet_modules: "/etc/puppet/modules"
|
||||
timeout: 3600
|
||||
test_pre:
|
||||
cmd: ruby /etc/puppet/modules/openstack_tasks/examples/ceilometer/controller_pre.rb
|
||||
test_post:
|
||||
cmd: ruby /etc/puppet/modules/openstack_tasks/examples/ceilometer/controller_post.rb
|
||||
|
||||
- id: telemetry-ceilometer-compute
|
||||
type: puppet
|
||||
version: 2.1.0
|
||||
groups: [compute, compute-vmware]
|
||||
required_for: [deploy_end]
|
||||
requires: [ceilometer-controller, top-role-compute]
|
||||
cross-depends:
|
||||
- name: ceilometer-controller
|
||||
- name: telemetry-hiera
|
||||
parameters:
|
||||
puppet_manifest: "/etc/puppet/modules/openstack_tasks/examples/ceilometer/compute.pp"
|
||||
puppet_modules: "/etc/puppet/modules"
|
||||
timeout: 3600
|
||||
test_pre:
|
||||
cmd: ruby /etc/puppet/modules/openstack_tasks/examples/ceilometer/compute_pre.rb
|
||||
test_post:
|
||||
cmd: ruby /etc/puppet/modules/openstack_tasks/examples/ceilometer/compute_post.rb
|
||||
|
||||
- id: telemetry-ceilometer-keystone
|
||||
type: puppet
|
||||
version: 2.1.0
|
||||
groups: [primary-controller]
|
||||
required_for: [ceilometer-controller]
|
||||
requires: [primary-keystone, keystone]
|
||||
cross-depends:
|
||||
- name: /(primary-)?keystone/
|
||||
role: self
|
||||
parameters:
|
||||
puppet_manifest: "/etc/puppet/modules/openstack_tasks/examples/ceilometer/keystone.pp"
|
||||
puppet_modules: "/etc/puppet/modules"
|
||||
timeout: 1800
|
||||
|
||||
- id: telemetry-openstack-haproxy-ceilometer
|
||||
type: puppet
|
||||
version: 2.1.0
|
||||
groups: [primary-controller, controller]
|
||||
required_for: [deploy_end]
|
||||
requires: [deploy_start, primary-cluster-haproxy, cluster-haproxy]
|
||||
cross-depends:
|
||||
- name: /(primary-)?cluster-haproxy/
|
||||
role: self
|
||||
parameters:
|
||||
puppet_manifest: /etc/puppet/modules/osnailyfacter/modular/openstack-haproxy/openstack-haproxy-ceilometer.pp
|
||||
puppet_modules: /etc/puppet/modules
|
||||
timeout: 300
|
||||
test_pre:
|
||||
cmd: ruby /etc/puppet/modules/osnailyfacter/modular/openstack-haproxy/openstack-haproxy_pre.rb
|
||||
test_post:
|
||||
cmd: ruby /etc/puppet/modules/osnailyfacter/modular/openstack-haproxy/openstack-haproxy-ceilometer_post.rb
|
||||
|
||||
#- id: telemetry-ceilometer-radosgw-user
|
||||
# type: puppet
|
||||
# version: 2.1.0
|
||||
# role: [primary-controller, controller]
|
||||
# requires: [post_deployment_start, enable_rados]
|
||||
# required_for: [post_deployment_end]
|
||||
# parameters:
|
||||
# puppet_manifest: "/etc/puppet/modules/openstack_tasks/examples/ceilometer/radosgw_user.pp"
|
||||
# puppet_modules: "/etc/puppet/modules"
|
||||
# timeout: 300
|
||||
# cwd: /
|
||||
|
||||
# Integration tasks
|
||||
####################
|
||||
|
||||
- id: telemetry-integration-configuration
|
||||
type: puppet
|
||||
version: 2.1.0
|
||||
groups: [primary-controller, controller]
|
||||
required_for: [deploy_end]
|
||||
requires: [deploy_start, telemetry-ceilometer-controller]
|
||||
cross-depends:
|
||||
- name: primary-influxdb_grafana
|
||||
# - name: lma-hiera-override
|
||||
# - name: lma-aggregator
|
||||
# - name: /(primary-)?cluster-haproxy/
|
||||
# role: self
|
||||
parameters:
|
||||
puppet_manifest: puppet/manifests/configure.pp
|
||||
puppet_modules: puppet/modules:/etc/puppet/modules
|
||||
timeout: 300
|
||||
|
||||
- id: telemetry-influxdb-create-db
|
||||
type: puppet
|
||||
version: 2.1.0
|
||||
groups: [primary-controller, controller]
|
||||
requires: [post_deployment_start]
|
||||
required_for: [post_deployment_end]
|
||||
cross-depends:
|
||||
- name: primary-influxdb_grafana
|
||||
# - name: lma-hiera-override
|
||||
# - name: lma-aggregator
|
||||
# - name: /(primary-)?cluster-haproxy/
|
||||
# role: self
|
||||
parameters:
|
||||
puppet_manifest: puppet/manifests/configure-influxdb.pp
|
||||
puppet_modules: puppet/modules:/etc/puppet/modules
|
||||
timeout: 300
|
||||
|
||||
# skip base tasks
|
||||
- id: ceilometer-radosgw-user
|
||||
type: skipped
|
||||
- id: ceilometer-keystone
|
||||
type: skipped
|
||||
- id: ceilometer-compute
|
||||
type: skipped
|
||||
- id: ceilometer-controller
|
||||
type: skipped
|
||||
- id: aodh
|
||||
type: skipped
|
||||
- id: aodh-db
|
||||
type: skipped
|
||||
- id: aodh-keystone
|
||||
type: skipped
|
||||
- id: openstack-haproxy-aodh
|
||||
type: skipped
|
||||
- id: openstack-haproxy-ceilometer
|
||||
type: skipped
|
|
@ -0,0 +1,117 @@
|
|||
attributes:
|
||||
metadata:
|
||||
# Settings group can be one of "general", "security", "compute", "network",
|
||||
# "storage", "logging", "openstack_services" and "other".
|
||||
group: 'other'
|
||||
advanced_settings:
|
||||
label: "Advanced settings"
|
||||
value: false
|
||||
description: "The plugin determines the best settings if not set"
|
||||
weight: 10
|
||||
type: checkbox
|
||||
|
||||
elastic_search_ip:
|
||||
value: ''
|
||||
label: 'External Elasticsearch'
|
||||
description: "In case you want to use external Elasticsearch please specify an IP or DNS name here"
|
||||
weight: 11
|
||||
type: "text"
|
||||
regex:
|
||||
source: '^[a-zA-Z\d][a-zA-Z\d_\-.]+$'
|
||||
error: "Invalid address or name."
|
||||
restrictions:
|
||||
- condition: "settings:telemetry.advanced_settings.value == false"
|
||||
action: hide
|
||||
|
||||
elastic_search_port:
|
||||
value: '9200'
|
||||
label: 'External Elasticsearch port'
|
||||
description: "In case you want to use external Elasticsearch please specify the port number. Default is 9200"
|
||||
weight: 12
|
||||
type: "text"
|
||||
regex:
|
||||
source: '^\d{0,5}$'
|
||||
error: "You must provide a valid port number"
|
||||
restrictions:
|
||||
- condition: "settings:telemetry.advanced_settings.value == false"
|
||||
action: hide
|
||||
|
||||
influxdb_ip:
|
||||
value: ''
|
||||
label: 'External InfluxDB'
|
||||
description: "In case you want to use external InfluxDB please spesify an IP or DNS name here"
|
||||
weight: 13
|
||||
type: "text"
|
||||
regex:
|
||||
source: '^[a-zA-Z\d][a-zA-Z\d_\-.]+$'
|
||||
error: "Invalid address or name."
|
||||
restrictions:
|
||||
- condition: "settings:telemetry.advanced_settings.value == false"
|
||||
action: hide
|
||||
|
||||
influxdb_port:
|
||||
value: '8086'
|
||||
label: 'External InfluxDB port'
|
||||
description: "In case you want to use external InfluxDB please spesify the port number. DEFAULT is 8086"
|
||||
weight: 14
|
||||
type: "text"
|
||||
regex:
|
||||
source: '^\d{0,5}$'
|
||||
error: "You must provide a valid port number"
|
||||
restrictions:
|
||||
- condition: "settings:telemetry.advanced_settings.value == false"
|
||||
action: hide
|
||||
|
||||
influxdb_admin_user:
|
||||
value: ''
|
||||
label: 'External InfluxDB admin user'
|
||||
description: "The admin username to access external InfluxDB"
|
||||
weight: 15
|
||||
type: "text"
|
||||
regex:
|
||||
source: '\S'
|
||||
error: "You must provide a username."
|
||||
restrictions:
|
||||
- condition: "settings:telemetry.advanced_settings.value == false"
|
||||
action: hide
|
||||
|
||||
influxdb_admin_pass:
|
||||
value: ''
|
||||
label: 'External InfluxDB admin password'
|
||||
description: "The admin password to access external InfluxDB."
|
||||
weight: 16
|
||||
type: "password"
|
||||
regex:
|
||||
source: '^[\S]{4,}$'
|
||||
error: "You must provide a password with at least 4 characters"
|
||||
restrictions:
|
||||
- condition: "settings:telemetry.advanced_settings.value == false"
|
||||
action: hide
|
||||
|
||||
influxdb_user:
|
||||
value: ''
|
||||
label: 'External InfluxDB user'
|
||||
description: "The username to access external InfluxDB"
|
||||
weight: 17
|
||||
type: "text"
|
||||
regex:
|
||||
source: '\S'
|
||||
error: "You must provide a username."
|
||||
restrictions:
|
||||
- condition: "settings:telemetry.advanced_settings.value == false"
|
||||
action: hide
|
||||
|
||||
influxdb_password:
|
||||
value: ''
|
||||
label: 'External InfluxDB password'
|
||||
description: "The password to access external InfluxDB."
|
||||
weight: 18
|
||||
type: "password"
|
||||
regex:
|
||||
source: '^[\S]{4,}$'
|
||||
error: "You must provide a password with at least 4 characters"
|
||||
restrictions:
|
||||
- condition: "settings:telemetry.advanced_settings.value == false"
|
||||
action: hide
|
||||
|
||||
|
|
@ -0,0 +1,34 @@
|
|||
# Plugin name
|
||||
name: telemetry
|
||||
# Human-readable name for your plugin (TODO)
|
||||
title: The telemetry plugin for StackLight integration
|
||||
# Plugin version
|
||||
version: '0.1.0'
|
||||
# Description
|
||||
description: Deploy/configure Ceilometer and Aodh with StackLight
|
||||
# Required fuel version
|
||||
fuel_version: ['9.0']
|
||||
# Specify license of your plugin
|
||||
licenses: ['Apache License Version 2.0']
|
||||
# Specify author or company name
|
||||
authors: ['Mirantis Inc.']
|
||||
# A link to the plugin's page
|
||||
homepage: 'https://github.com/openstack/fuel-plugin-openstack-telemetry'
|
||||
# Specify a group which your plugin implements, possible options:
|
||||
# network, storage, storage::cinder, storage::glance, hypervisor,
|
||||
# equipment
|
||||
groups: ['monitoring']
|
||||
# Change `false` to `true` if the plugin can be installed in the environment
|
||||
# after the deployment.
|
||||
is_hotpluggable: true
|
||||
|
||||
# The plugin is compatible with releases in the list
|
||||
releases:
|
||||
- os: ubuntu
|
||||
version: mitaka-9.0
|
||||
mode: ['ha']
|
||||
deployment_scripts_path: deployment_scripts/
|
||||
repository_path: repositories/ubuntu
|
||||
|
||||
# Version of plugin package
|
||||
package_version: '4.0.0'
|
|
@ -0,0 +1 @@
|
|||
[]
|
|
@ -0,0 +1,5 @@
|
|||
#!/bin/bash
|
||||
|
||||
# Add here any the actions which are required before plugin build
|
||||
# like packages building, packages downloading from mirrors and so on.
|
||||
# The script should return 0 if there were no errors.
|
|
@ -0,0 +1,8 @@
|
|||
# WARNING: `tasks.yaml` will be deprecated in further releases.
|
||||
# Please, use `deployment_tasks.yaml` to describe tasks instead.
|
||||
|
||||
# This tasks will be applied on controller nodes,
|
||||
# here you can also specify several roles, for example
|
||||
# ['cinder', 'compute'] will be applied only on
|
||||
# cinder and compute nodes
|
||||
[]
|
|
@ -0,0 +1,2 @@
|
|||
-e git+https://github.com/openstack/fuel-plugins.git#egg=fuel-plugin-builder
|
||||
Sphinx
|
|
@ -0,0 +1,27 @@
|
|||
[tox]
|
||||
envlist = manifests,build_plugin
|
||||
skipsdist = True
|
||||
|
||||
[testenv]
|
||||
deps = -r{toxinidir}/test-requirements.txt
|
||||
passenv = HOME
|
||||
|
||||
[testenv:manifests]
|
||||
deps =
|
||||
changedir = {toxinidir}/deployment_scripts/puppet/manifests
|
||||
whitelist_externals =
|
||||
bundle
|
||||
mkdir
|
||||
commands =
|
||||
mkdir -p {toxinidir}/.bundled_gems
|
||||
bundle install --path {toxinidir}/.bundled_gems
|
||||
bundle exec rake test
|
||||
|
||||
[testenv:build_plugin]
|
||||
changedir = {toxinidir}
|
||||
whitelist_externals =
|
||||
fpb
|
||||
bash
|
||||
commands =
|
||||
fpb --check {toxinidir} --debug
|
||||
fpb --build {toxinidir} --debug
|
|
@ -0,0 +1,7 @@
|
|||
volumes_roles_mapping:
|
||||
# Default role mapping
|
||||
telemetry_role:
|
||||
- {allocate_size: "min", id: "os"}
|
||||
|
||||
# Set here new volumes for your role
|
||||
volumes: []
|
Loading…
Reference in New Issue