Revert "Refactor collectd/gnocchi integration"
This reverts commit 2a9f0d89f1
.
Closes-Bug: #1831893
Change-Id: I8a06c25d9ef73d72c5ea30086ffa340d82ab1dfe
This commit is contained in:
parent
2a9f0d89f1
commit
5553f8df50
|
@ -142,57 +142,6 @@
|
|||
# (Optional) Boolean. Whether let collectd enable manage repositories.
|
||||
# If it is set to true the epel repository will be used
|
||||
#
|
||||
# [*amqp_transport_name*]
|
||||
# (Optional) String. Name of the transport.
|
||||
# Default to 'metrics'
|
||||
#
|
||||
# [*amqp_host*]
|
||||
# (Optional) String. Hostname or IP address of the AMQP 1.0 intermediary.
|
||||
# Defaults to the undef
|
||||
#
|
||||
# [*amqp_port*]
|
||||
# (Optional) String. Service name or port number on which the AMQP 1.0
|
||||
# intermediary accepts connections. This argument must be a string,
|
||||
# even if the numeric form is used.
|
||||
# Defaults to undef
|
||||
#
|
||||
# [*amqp_user*]
|
||||
# (Optional) String. User part of credentials used to authenticate to the
|
||||
# AMQP 1.0 intermediary.
|
||||
# Defaults to undef
|
||||
#
|
||||
# [*amqp_password*]
|
||||
# (Optional) String. Password part of credentials used to authenticate
|
||||
# to the AMQP 1.0 intermediary.
|
||||
# Defaults to undef
|
||||
#
|
||||
# [*amqp_address*]
|
||||
# (Optional) String. This option specifies the prefix for the send-to value
|
||||
# in the message.
|
||||
# Defaults to 'collectd'
|
||||
#
|
||||
# [*amqp_retry_delay*]
|
||||
# (Optional) Number. When the AMQP1 connection is lost, defines the time
|
||||
# in seconds to wait before attempting to reconnect. If not set 1 second
|
||||
# is the implicit default.
|
||||
# Defaults to undef
|
||||
#
|
||||
# [*amqp_interval*]
|
||||
# (Optional) Number. Interval on which metrics should be sent to AMQP
|
||||
# intermediary. If not set the default for all collectd plugins is used.
|
||||
# Defaults to undef
|
||||
#
|
||||
# [*amqp_instances*]
|
||||
# (Optional) Hash of hashes. Each inner hash represent Instance block in plugin
|
||||
# configuration file. Key of outter hash represents instance name.
|
||||
# The 'address' value concatenated with the 'name' given will be used
|
||||
# as the send-to address for communications over the messaging link.
|
||||
# Defaults to {}.
|
||||
#
|
||||
# [*python_read_plugins*]
|
||||
# (Optional) List of strings. List of third party python packages to install.
|
||||
# Defaults to [].
|
||||
#
|
||||
class tripleo::profile::base::metrics::collectd (
|
||||
$step = Integer(hiera('step')),
|
||||
|
||||
|
@ -223,20 +172,12 @@ class tripleo::profile::base::metrics::collectd (
|
|||
$gnocchi_resource_type = 'collectd',
|
||||
$gnocchi_batch_size = 10,
|
||||
$service_names = hiera('service_names', []),
|
||||
$collectd_manage_repo = false,
|
||||
$python_read_plugins = []
|
||||
$collectd_manage_repo = false
|
||||
) {
|
||||
if $step >= 3 {
|
||||
class {'::collectd':
|
||||
manage_repo => $collectd_manage_repo
|
||||
}
|
||||
|
||||
include ::collectd::plugin::python
|
||||
$python_packages = concat(['collectd-python'], $python_read_plugins)
|
||||
package { $python_packages:
|
||||
ensure => 'present'
|
||||
}
|
||||
|
||||
if $enable_file_logging {
|
||||
include ::collectd::plugin::logfile
|
||||
}
|
||||
|
|
|
@ -139,39 +139,14 @@ define tripleo::profile::base::metrics::collectd::gnocchi (
|
|||
) {
|
||||
include ::collectd
|
||||
|
||||
package { 'python-collectd-gnocchi':
|
||||
package { ['python-collectd-gnocchi', 'collectd-python']:
|
||||
ensure => $ensure,
|
||||
}
|
||||
|
||||
$_conf = {'Auth_Mode' => $auth_mode, 'ResourceType' => $resource_type, 'BatchSize' => $batch_size}
|
||||
if $auth_mode == 'basic' {
|
||||
$conf = merge($_conf, {
|
||||
'Endpoint' => "${protocol}://${server}:${port}",
|
||||
'User' => $user
|
||||
})
|
||||
} elsif $auth_mode == 'keystone' {
|
||||
$conf = merge($_conf, {
|
||||
'Auth_Url' => $keystone_auth_url,
|
||||
'Username' => $keystone_user_name,
|
||||
'User_Id' => $keystone_user_id,
|
||||
'Project_Id' => $keystone_project_id,
|
||||
'Project_Name' => $keystone_project_name,
|
||||
'Password' => $keystone_password,
|
||||
'User_Domain_Id' => $keystone_user_domain_id,
|
||||
'User_Domain_Name' => $keystone_user_domain_name,
|
||||
'Project_Domain_Id' => $keystone_project_domain_id,
|
||||
'Project_Domain_Name' => $keystone_project_domain_name,
|
||||
'Region_Name' => $keystone_region_name,
|
||||
'Interface' => $keystone_interface,
|
||||
'Endpoint' => $keystone_endpoint
|
||||
})
|
||||
} else {
|
||||
fail('Invalid auth mode for collect_gnocchi plugin.')
|
||||
collectd::plugin { 'python':
|
||||
ensure => $ensure,
|
||||
order => $order,
|
||||
content => template('tripleo/collectd/collectd-gnocchi.conf.erb'),
|
||||
require => Package['python-collectd-gnocchi']
|
||||
}
|
||||
|
||||
$config = $conf.filter |$key, $value| { $value != undef }
|
||||
::collectd::plugin::python::module { 'collectd_gnocchi':
|
||||
config => [$config]
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -0,0 +1,62 @@
|
|||
<Plugin "python">
|
||||
Import "collectd_gnocchi"
|
||||
<Module "collectd_gnocchi">
|
||||
<%- if @auth_mode == 'basic' %>
|
||||
### Basic authentication
|
||||
Endpoint "<%= @protocol %>://<%= @server %>:<%= @port %>"
|
||||
<%- if @user %>
|
||||
User "<%= @user %>"
|
||||
<%- end -%>
|
||||
<%- elsif @auth_mode == 'keystone' %>
|
||||
### Keystone authentication
|
||||
Auth_Mode "keystone"
|
||||
Auth_Url "<%= @keystone_auth_url %>"
|
||||
<%- if @keystone_user_name %>
|
||||
Username "<%= @keystone_user_name %>"
|
||||
<%- end -%>
|
||||
<%- if @keystone_user_id %>
|
||||
User_Id "<%= @keystone_user_id %>"
|
||||
<%- end -%>
|
||||
<%- if @keystone_project_id %>
|
||||
Project_Id "<%= @keystone_project_id %>"
|
||||
<%- end -%>
|
||||
<%- if @keystone_project_name %>
|
||||
Project_Name "<%= @keystone_project_name %>"
|
||||
<%- end -%>
|
||||
<%- if @keystone_password %>
|
||||
Password "<%= @keystone_password %>"
|
||||
<%- end -%>
|
||||
<%- if @keystone_user_domain_id %>
|
||||
User_Domain_Id "<%= @keystone_user_domain_id %>"
|
||||
<%- end -%>
|
||||
<%- if @keystone_user_domain_name %>
|
||||
User_Domain_Name "<%= @keystone_user_domain_name %>"
|
||||
<%- end -%>
|
||||
<%- if @keystone_project_domain_id %>
|
||||
Project_Domain_Id "<%= @keystone_project_domain_id %>"
|
||||
<%- end -%>
|
||||
<%- if @keystone_project_domain_name %>
|
||||
Project_Domain_Name "<%= @keystone_project_domain_name %>"
|
||||
<%- end -%>
|
||||
<%- if @keystone_region_name %>
|
||||
Region_Name "<%= @keystone_region_name %>"
|
||||
<%- end -%>
|
||||
<%- if @keystone_interface %>
|
||||
Interface "<%= @keystone_interface %>"
|
||||
<%- end -%>
|
||||
<%- if @keystone_endpoint %>
|
||||
Endpoint "<%= @keystone_endpoint %>"
|
||||
<%- end -%>
|
||||
<%- end -%>
|
||||
|
||||
<%- if @resource_type %>
|
||||
## Default resource type created by the plugin in Gnocchi
|
||||
## to store hosts
|
||||
ResourceType "<%= @resource_type %>"
|
||||
<%- end -%>
|
||||
<%- if @batch_size %>
|
||||
## Minimum number of values to batch
|
||||
BatchSize <%= @batch_size %>
|
||||
<%- end -%>
|
||||
</Module>
|
||||
</Plugin>
|
Loading…
Reference in New Issue