Add collectd for CentOS platforms
This change adds collectd packages for CentOS. In addition, a few fixes are needed to ensure successful deployment of the LMA collector on CentOS platforms: - Install collectd-dbi package on controller nodes. - Modify Python scripts using subprocess to workaround issues with Python 2.6. - configure a valid database name for the MySQL plugin. - set hasstatus and hasrestart parameters to true for all OpenStack services otherwise Puppet fails to restart them. Change-Id: I06891b069ba6047dfa40bcef7937b52964bda268
This commit is contained in:
parent
15eaedb94c
commit
65393651e2
|
@ -100,6 +100,7 @@ if $lma_collector['influxdb_mode'] != 'disabled' {
|
||||||
}
|
}
|
||||||
|
|
||||||
class { 'lma_collector::collectd::mysql':
|
class { 'lma_collector::collectd::mysql':
|
||||||
|
database => 'nova',
|
||||||
username => 'nova',
|
username => 'nova',
|
||||||
password => $nova['db_password'],
|
password => $nova['db_password'],
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,8 +19,10 @@
|
||||||
# limitations under the License.
|
# limitations under the License.
|
||||||
|
|
||||||
import collectd
|
import collectd
|
||||||
import subprocess
|
|
||||||
import re
|
import re
|
||||||
|
import signal
|
||||||
|
import subprocess
|
||||||
|
import sys
|
||||||
|
|
||||||
|
|
||||||
NAME = 'rabbitmq_info'
|
NAME = 'rabbitmq_info'
|
||||||
|
@ -28,8 +30,6 @@ NAME = 'rabbitmq_info'
|
||||||
RABBITMQCTL_BIN = '/usr/sbin/rabbitmqctl'
|
RABBITMQCTL_BIN = '/usr/sbin/rabbitmqctl'
|
||||||
# Override in config by specifying 'PmapBin'
|
# Override in config by specifying 'PmapBin'
|
||||||
PMAP_BIN = '/usr/bin/pmap'
|
PMAP_BIN = '/usr/bin/pmap'
|
||||||
# Override in config by specifying 'PidofBin'.
|
|
||||||
PIDOF_BIN = '/bin/pidof'
|
|
||||||
# Override in config by specifying 'PidFile.
|
# Override in config by specifying 'PidFile.
|
||||||
PID_FILE = "/var/run/rabbitmq/pid"
|
PID_FILE = "/var/run/rabbitmq/pid"
|
||||||
# Override in config by specifying 'Vhost'.
|
# Override in config by specifying 'Vhost'.
|
||||||
|
@ -42,6 +42,16 @@ CLUSTER_STATUS = re.compile('.*disc,\[([^\]]+)\].*running_nodes,\[([^\]]+)\]',
|
||||||
re.S)
|
re.S)
|
||||||
|
|
||||||
|
|
||||||
|
def restore_sigchld():
|
||||||
|
"""
|
||||||
|
Restore SIGCHLD handler for python <= v2.6
|
||||||
|
It will BREAK the exec plugin!!!
|
||||||
|
See https://github.com/deniszh/collectd-iostat-python/issues/2 for details
|
||||||
|
"""
|
||||||
|
if sys.version_info[0] == 2 and sys.version_info[1] <= 6:
|
||||||
|
signal.signal(signal.SIGCHLD, signal.SIG_DFL)
|
||||||
|
|
||||||
|
|
||||||
# Obtain the interesting statistical info
|
# Obtain the interesting statistical info
|
||||||
def get_stats():
|
def get_stats():
|
||||||
stats = {}
|
stats = {}
|
||||||
|
@ -206,6 +216,7 @@ def logger(t, msg):
|
||||||
|
|
||||||
|
|
||||||
# Runtime
|
# Runtime
|
||||||
|
collectd.register_init(restore_sigchld)
|
||||||
collectd.register_config(configure_callback)
|
collectd.register_config(configure_callback)
|
||||||
collectd.warning('Initialising rabbitmq_info')
|
collectd.warning('Initialising rabbitmq_info')
|
||||||
collectd.register_read(read_callback)
|
collectd.register_read(read_callback)
|
||||||
|
|
|
@ -30,12 +30,24 @@ class lma_collector::collectd::base {
|
||||||
log_file => $lma_collector::params::collectd_logfile,
|
log_file => $lma_collector::params::collectd_logfile,
|
||||||
}
|
}
|
||||||
|
|
||||||
class { 'collectd::plugin::write_http':
|
$urls = {
|
||||||
urls => {
|
"http://127.0.0.1:${port}" => {
|
||||||
"http://127.0.0.1:${port}" => {
|
'format' => 'JSON',
|
||||||
'format' => 'JSON',
|
storerates => true
|
||||||
storerates => true
|
}
|
||||||
}
|
}
|
||||||
|
if $::osfamily == 'RedHat' {
|
||||||
|
# collectd Puppet manifest is broken for RedHat derivatives as it tries to
|
||||||
|
# install the collectd-write_http package which doesn't exist (for CentOS
|
||||||
|
# at least)
|
||||||
|
collectd::plugin {'write_http':
|
||||||
|
ensure => present,
|
||||||
|
content => template('collectd/plugin/write_http.conf.erb'),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
class { 'collectd::plugin::write_http':
|
||||||
|
urls => $urls,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -16,12 +16,17 @@ class lma_collector::collectd::dbi {
|
||||||
include lma_collector::params
|
include lma_collector::params
|
||||||
include lma_collector::collectd::service
|
include lma_collector::collectd::service
|
||||||
|
|
||||||
|
if $::osfamily == 'RedHat' {
|
||||||
|
package { 'collectd-dbi':
|
||||||
|
ensure => present,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
package { $lma_collector::params::collectd_dbi_package:
|
package { $lma_collector::params::collectd_dbi_package:
|
||||||
ensure => present,
|
ensure => present,
|
||||||
name => $lma_collector::params::collectd_dbi_package,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
collectd::plugin { 'dbi':
|
collectd::plugin { 'dbi':
|
||||||
require => Package[$lma_collector::params::collectd_dbi_package],
|
require => Package[$lma_collector::params::collectd_dbi_package],
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,12 +13,13 @@
|
||||||
# under the License.
|
# under the License.
|
||||||
#
|
#
|
||||||
class lma_collector::collectd::mysql (
|
class lma_collector::collectd::mysql (
|
||||||
|
$database = $lma_collector::params::mysql_database,
|
||||||
$username = $lma_collector::params::mysql_username,
|
$username = $lma_collector::params::mysql_username,
|
||||||
$password = $lma_collector::params::mysql_password,
|
$password = $lma_collector::params::mysql_password,
|
||||||
) inherits lma_collector::params {
|
) inherits lma_collector::params {
|
||||||
include lma_collector::collectd::service
|
include lma_collector::collectd::service
|
||||||
|
|
||||||
collectd::plugin::mysql::database { 'openstack':
|
collectd::plugin::mysql::database { $database:
|
||||||
host => 'localhost',
|
host => 'localhost',
|
||||||
username => $username,
|
username => $username,
|
||||||
password => $password,
|
password => $password,
|
||||||
|
|
|
@ -33,5 +33,7 @@ class lma_collector::notifications::cinder (
|
||||||
}
|
}
|
||||||
|
|
||||||
service { $::cinder::params::volume_service:
|
service { $::cinder::params::volume_service:
|
||||||
|
hasstatus => true,
|
||||||
|
hasrestart => true,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -32,5 +32,7 @@ class lma_collector::notifications::compute (
|
||||||
}
|
}
|
||||||
|
|
||||||
service { $::nova::params::compute_service_name:
|
service { $::nova::params::compute_service_name:
|
||||||
|
hasstatus => true,
|
||||||
|
hasrestart => true,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -104,6 +104,8 @@ class lma_collector::notifications::controller (
|
||||||
}
|
}
|
||||||
|
|
||||||
service { [$::nova::params::api_service_name, $::nova::params::conductor_service_name, $::nova::params::scheduler_service_name]:
|
service { [$::nova::params::api_service_name, $::nova::params::conductor_service_name, $::nova::params::scheduler_service_name]:
|
||||||
|
hasstatus => true,
|
||||||
|
hasrestart => true,
|
||||||
}
|
}
|
||||||
|
|
||||||
# Cinder
|
# Cinder
|
||||||
|
@ -119,6 +121,8 @@ class lma_collector::notifications::controller (
|
||||||
}
|
}
|
||||||
|
|
||||||
service { [$::cinder::params::api_service, $::cinder::params::scheduler_service]:
|
service { [$::cinder::params::api_service, $::cinder::params::scheduler_service]:
|
||||||
|
hasstatus => true,
|
||||||
|
hasrestart => true,
|
||||||
}
|
}
|
||||||
|
|
||||||
# Keystone
|
# Keystone
|
||||||
|
@ -134,6 +138,8 @@ class lma_collector::notifications::controller (
|
||||||
}
|
}
|
||||||
|
|
||||||
service { $::keystone::params::service_name:
|
service { $::keystone::params::service_name:
|
||||||
|
hasstatus => true,
|
||||||
|
hasrestart => true,
|
||||||
}
|
}
|
||||||
|
|
||||||
# Neutron
|
# Neutron
|
||||||
|
@ -149,6 +155,8 @@ class lma_collector::notifications::controller (
|
||||||
}
|
}
|
||||||
|
|
||||||
service { $::neutron::params::server_service:
|
service { $::neutron::params::server_service:
|
||||||
|
hasstatus => true,
|
||||||
|
hasrestart => true,
|
||||||
}
|
}
|
||||||
|
|
||||||
# Glance
|
# Glance
|
||||||
|
@ -183,6 +191,8 @@ class lma_collector::notifications::controller (
|
||||||
}
|
}
|
||||||
|
|
||||||
service { [$::glance::params::api_service_name, $::glance::params::registry_service_name]:
|
service { [$::glance::params::api_service_name, $::glance::params::registry_service_name]:
|
||||||
|
hasstatus => true,
|
||||||
|
hasrestart => true,
|
||||||
}
|
}
|
||||||
|
|
||||||
# Heat
|
# Heat
|
||||||
|
@ -198,5 +208,7 @@ class lma_collector::notifications::controller (
|
||||||
}
|
}
|
||||||
|
|
||||||
service { [$::heat::params::api_service_name, $::heat::params::engine_service_name]:
|
service { [$::heat::params::api_service_name, $::heat::params::engine_service_name]:
|
||||||
|
hasstatus => true,
|
||||||
|
hasrestart => true,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -68,6 +68,7 @@ class lma_collector::params {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$additional_packages = [ 'python-dateutil' ]
|
$additional_packages = [ 'python-dateutil' ]
|
||||||
|
$mysql_database = ''
|
||||||
$mysql_username = ''
|
$mysql_username = ''
|
||||||
$mysql_password = ''
|
$mysql_password = ''
|
||||||
$rabbitmq_pid_file = '/var/run/rabbitmq/pid'
|
$rabbitmq_pid_file = '/var/run/rabbitmq/pid'
|
||||||
|
|
|
@ -63,11 +63,6 @@ attributes:
|
||||||
label: "Local node"
|
label: "Local node"
|
||||||
- data: "remote"
|
- data: "remote"
|
||||||
label: "Remote server"
|
label: "Remote server"
|
||||||
# Hide all InfluxDB parameters for now
|
|
||||||
# Change action from "hide" to "none" to change this
|
|
||||||
restrictions: &hide_control
|
|
||||||
- condition: true
|
|
||||||
action: "hide"
|
|
||||||
|
|
||||||
influxdb_node_name:
|
influxdb_node_name:
|
||||||
value: 'influxdb'
|
value: 'influxdb'
|
||||||
|
@ -75,7 +70,9 @@ attributes:
|
||||||
description: 'Label of the node running the InfluxDB/Grafana plugin that is deployed in the environment.'
|
description: 'Label of the node running the InfluxDB/Grafana plugin that is deployed in the environment.'
|
||||||
weight: 65
|
weight: 65
|
||||||
type: "text"
|
type: "text"
|
||||||
restrictions: *hide_control
|
restrictions:
|
||||||
|
- condition: "settings:lma_collector.influxdb_mode.value != 'local'"
|
||||||
|
action: "disable"
|
||||||
|
|
||||||
influxdb_address:
|
influxdb_address:
|
||||||
value: ''
|
value: ''
|
||||||
|
@ -84,7 +81,9 @@ attributes:
|
||||||
weight: 70
|
weight: 70
|
||||||
type: "text"
|
type: "text"
|
||||||
regex: *node_address_regex
|
regex: *node_address_regex
|
||||||
restrictions: *hide_control
|
restrictions:
|
||||||
|
- condition: "settings:lma_collector.influxdb_mode.value != 'remote'"
|
||||||
|
action: "disable"
|
||||||
|
|
||||||
influxdb_database:
|
influxdb_database:
|
||||||
value: 'lma'
|
value: 'lma'
|
||||||
|
@ -95,7 +94,9 @@ attributes:
|
||||||
regex: ¬_empty_parameter
|
regex: ¬_empty_parameter
|
||||||
source: '\S'
|
source: '\S'
|
||||||
error: "Invalid value"
|
error: "Invalid value"
|
||||||
restrictions: *hide_control
|
restrictions: &disable_influxdb_control
|
||||||
|
- condition: "settings:lma_collector.influxdb_mode.value == 'disabled'"
|
||||||
|
action: "disable"
|
||||||
influxdb_user:
|
influxdb_user:
|
||||||
value: 'lma'
|
value: 'lma'
|
||||||
label: 'InfluxDB user'
|
label: 'InfluxDB user'
|
||||||
|
@ -103,7 +104,7 @@ attributes:
|
||||||
weight: 80
|
weight: 80
|
||||||
type: "text"
|
type: "text"
|
||||||
regex: *not_empty_parameter
|
regex: *not_empty_parameter
|
||||||
restrictions: *hide_control
|
restrictions: *disable_influxdb_control
|
||||||
influxdb_password:
|
influxdb_password:
|
||||||
value: 'lmapass'
|
value: 'lmapass'
|
||||||
label: 'InfluxDB password'
|
label: 'InfluxDB password'
|
||||||
|
@ -111,4 +112,4 @@ attributes:
|
||||||
weight: 85
|
weight: 85
|
||||||
type: "password"
|
type: "password"
|
||||||
regex: *not_empty_parameter
|
regex: *not_empty_parameter
|
||||||
restrictions: *hide_control
|
restrictions: *disable_influxdb_control
|
||||||
|
|
|
@ -51,7 +51,15 @@ download_packages \
|
||||||
http://mirrors.kernel.org/ubuntu/pool/main/libd/libdbi/libdbi1_0.9.0-1_amd64.deb \
|
http://mirrors.kernel.org/ubuntu/pool/main/libd/libdbi/libdbi1_0.9.0-1_amd64.deb \
|
||||||
http://mirrors.kernel.org/ubuntu/pool/main/r/rrdtool/librrd4_1.4.7-2ubuntu5_amd64.deb \
|
http://mirrors.kernel.org/ubuntu/pool/main/r/rrdtool/librrd4_1.4.7-2ubuntu5_amd64.deb \
|
||||||
http://mirrors.kernel.org/ubuntu/pool/universe/c/collectd/collectd_5.4.0-3ubuntu2_amd64.deb \
|
http://mirrors.kernel.org/ubuntu/pool/universe/c/collectd/collectd_5.4.0-3ubuntu2_amd64.deb \
|
||||||
http://mirrors.kernel.org/ubuntu/pool/main/libd/libdbi-drivers/libdbd-mysql_0.9.0-2ubuntu2_amd64.deb
|
http://mirrors.kernel.org/ubuntu/pool/main/libd/libdbi-drivers/libdbd-mysql_0.9.0-2ubuntu2_amd64.deb \
|
||||||
|
http://mirror.centos.org/centos/6/os/x86_64/Packages/libdbi-0.8.3-4.el6.x86_64.rpm \
|
||||||
|
http://mirror.centos.org/centos/6/os/x86_64/Packages/libdbi-drivers-0.8.3-5.1.el6.x86_64.rpm \
|
||||||
|
http://mirror.centos.org/centos/6/os/x86_64/Packages/libdbi-dbd-mysql-0.8.3-5.1.el6.x86_64.rpm \
|
||||||
|
http://fuel-repository.mirantis.com/fuel-plugins/fuel-plugin-lma-collector/centos/collectd-5.4.1-5.mira1.mira1.x86_64.rpm \
|
||||||
|
http://fuel-repository.mirantis.com/fuel-plugins/fuel-plugin-lma-collector/centos/collectd-apache-5.4.1-5.mira1.mira1.x86_64.rpm \
|
||||||
|
http://fuel-repository.mirantis.com/fuel-plugins/fuel-plugin-lma-collector/centos/collectd-dbi-5.4.1-5.mira1.mira1.x86_64.rpm \
|
||||||
|
http://fuel-repository.mirantis.com/fuel-plugins/fuel-plugin-lma-collector/centos/collectd-mysql-5.4.1-5.mira1.mira1.x86_64.rpm
|
||||||
|
|
||||||
|
|
||||||
# Extract dependent manifests from fuel-library
|
# Extract dependent manifests from fuel-library
|
||||||
rm -rf ${MODULES_DIR}/{cinder,glance,heat,inifile,keystone,neutron,nova,openstack,stdlib,concat}
|
rm -rf ${MODULES_DIR}/{cinder,glance,heat,inifile,keystone,neutron,nova,openstack,stdlib,concat}
|
||||||
|
|
Loading…
Reference in New Issue