Configure pagination for OpenStack collectd plugins

Change-Id: I32e83368b7d0d2e8b68d7f7a2df0d1b61653fa72
This commit is contained in:
Swann Croiset 2017-02-01 15:57:34 +01:00
parent e805c9fe58
commit a5c154d6ef
3 changed files with 53 additions and 10 deletions

View File

@ -162,16 +162,36 @@ if hiera('lma::collector::influxdb::server', false) {
require => Class['lma_collector::collectd::base'],
}
$openstack_services = {
'nova' => $openstack_service_config,
'nova_services' => $openstack_service_config,
'cinder' => $openstack_service_config,
'cinder_services' => $openstack_service_config,
'glance' => $openstack_service_config,
'keystone' => $openstack_service_config,
'neutron' => $openstack_service_config,
'neutron_agents' => $openstack_service_config,
}
$nova_polling = {
'polling_interval' => 60,
'pagination_limit' => 500,
}
$cinder_polling = {
'polling_interval' => 60,
'pagination_limit' => 500,
}
$glance_polling = {
'polling_interval' => 60,
'pagination_limit' => 25,
}
$neutron_polling = {
'polling_interval' => 60,
'pagination_limit' => 100,
}
$openstack_resources = {
'nova' => merge($openstack_service_config, $nova_polling),
'cinder' => merge($openstack_service_config, $cinder_polling),
'glance' => merge($openstack_service_config, $glance_polling),
'neutron' => merge($openstack_service_config, $neutron_polling),
}
create_resources(lma_collector::collectd::openstack, $openstack_services)
create_resources(lma_collector::collectd::openstack, $openstack_resources)
# FIXME(elemoine) use the special attribute * when Fuel uses a Puppet version
# that supports it.

View File

@ -176,10 +176,12 @@ the `lma_collector::collectd::openstack` define:
```puppet
lma_collector::collectd::openstack { 'nova':
user => 'user',
password => 'password',
tenant => 'tenant',
keystone_url => 'http://example.com/keystone',
user => 'user',
password => 'password',
tenant => 'tenant',
keystone_url => 'http://example.com/keystone',
polling_interval => 60,
pagination_limit => 500,
}
```
@ -965,6 +967,8 @@ The resource title should be set to the service name (e.g. `'nova'`).
[`lma_collector::collectd::pacemaker`](#class-lma_collectorcollectdpacemaker)
class should be declared, with its `master_resource` parameter set to the
same value as this parameter. Valid options: a string. Default: `undef`.
* `polling_interval`: *Optional*. The interval used to poll the resources.
* `pagination_limit`: *Optional*. The number of resource returned by request.
#### Define `lma_collector::collectd::dbi_services`

View File

@ -21,6 +21,8 @@ define lma_collector::collectd::openstack (
$timeout = 20,
$max_retries = 2,
$pacemaker_master_resource = undef,
$polling_interval = undef,
$pagination_limit = undef,
) {
include lma_collector::params
@ -46,12 +48,29 @@ define lma_collector::collectd::openstack (
'Timeout' => "\"${timeout}\"",
'MaxRetries' => "\"${max_retries}\"",
}
if $polling_interval {
validate_integer($polling_interval)
$polling_config = {
'PollingInterval' => "\"${polling_interval}\""
}
} else {
$polling_config = {}
}
if $pagination_limit {
validate_integer($pagination_limit)
$limit_config = {
'PaginationLimit' => "\"${pagination_limit}\""
}
} else {
$limit_config = {}
}
if $pacemaker_master_resource {
$real_config = merge($config, {'DependsOnResource' => "\"${pacemaker_master_resource}\""})
$pacemaker_config = {'DependsOnResource' => "\"${pacemaker_master_resource}\""}
} else {
$real_config = $config
$pacemaker_config = {}
}
$real_config = merge($config, $pacemaker_config, $polling_config, $limit_config)
lma_collector::collectd::python { "openstack_${title}":
config => $real_config,