Merge "Make changes to lma_collector::collectd::mysql"

This commit is contained in:
Jenkins 2016-02-10 12:17:16 +00:00 committed by Gerrit Code Review
commit 15487fd9ab
5 changed files with 45 additions and 15 deletions

View File

@ -301,7 +301,6 @@ if $lma_collector['influxdb_mode'] != 'disabled' {
}
class { 'lma_collector::collectd::mysql':
database => 'nova',
username => 'nova',
password => $nova['db_password'],
}

View File

@ -325,7 +325,10 @@ To make the collector collect statistics for MySQL declare the
`lma_collector::collectd::mysql` class:
```puppet
class { 'lma_collector::collectd::mysql': }
class { 'lma_collector::collectd::mysql':
username => 'mysql_username',
password => 'mysql_password',
}
```
### Collect OpenStack notifications
@ -650,17 +653,16 @@ which uses Pacemaker's `crm_resource` command to get statistics from Pacemaker.
#### Class: `lma_collector::collectd::mysql`
Declare this class to configure collectd to collect statistics for MySQL.
Declare this class to configure collectd to collect statistics for the MySQL
instance local to the node.
The collectd plugin used is the native collectd [MySQL
plugin](https://collectd.org/wiki/index.php/Plugin:MySQL).
plugin](https://collectd.org/wiki/index.php/Plugin:MySQL). It is configured
with `'localhost'` as the `Host`, meaning that the local MySQL Unix socket will
be used to connect to MySQL.
##### Parameters
* `host`: *Optional*. The host onto which the MySQL database runs. Valid
options: a string. Default: `'127.0.0.1'`.
* `port`: *Optional*. The port the MySQL database listens on. Valid options: an
integer. Default: `3306`.
* `username`: *Required*. The database user to use to connect to the MySQL
database. Valid options: a string.
* `password`: *Required*. The database password to use to connect to the MySQL

View File

@ -13,12 +13,13 @@
# under the License.
#
class lma_collector::collectd::mysql (
$database = $lma_collector::params::mysql_database,
$username = $lma_collector::params::mysql_username,
$password = $lma_collector::params::mysql_password,
$username,
$password,
) inherits lma_collector::params {
collectd::plugin::mysql::database { $database:
# With "config" as the resource title the collectd configuration
# file will be named "mysql-config.conf".
collectd::plugin::mysql::database { 'config':
host => 'localhost',
username => $username,
password => $password,

View File

@ -106,9 +106,6 @@ class lma_collector::params {
}
}
$additional_packages = [ 'python-dateutil' ]
$mysql_database = ''
$mysql_username = ''
$mysql_password = ''
$openstack_user = ''
$openstack_password = ''
$openstack_tenant = ''

View File

@ -0,0 +1,31 @@
# 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.
require 'spec_helper'
describe 'lma_collector::collectd::mysql' do
let(:facts) do
{:kernel => 'Linux', :operatingsystem => 'Ubuntu',
:osfamily => 'Debian', :concat_basedir => '/foo'}
end
describe 'with params' do
let(:params) do
{:username => 'user', :password => 'password'}
end
it { is_expected.to contain_collectd__plugin__mysql__database('config') \
.with_host('localhost') \
.with_username('user') \
.with_password('password') }
end
end