Browse Source

Configure pagination for OpenStack collectd plugins

Change-Id: I32e83368b7d0d2e8b68d7f7a2df0d1b61653fa72
Swann Croiset 2 years ago
parent
commit
a5c154d6ef

+ 24
- 4
deployment_scripts/puppet/manifests/collectd.pp View File

@@ -162,16 +162,36 @@ if hiera('lma::collector::influxdb::server', false) {
162 162
       require                   => Class['lma_collector::collectd::base'],
163 163
     }
164 164
     $openstack_services = {
165
-      'nova'            => $openstack_service_config,
166 165
       'nova_services'   => $openstack_service_config,
167
-      'cinder'          => $openstack_service_config,
168 166
       'cinder_services' => $openstack_service_config,
169
-      'glance'          => $openstack_service_config,
170 167
       'keystone'        => $openstack_service_config,
171
-      'neutron'         => $openstack_service_config,
172 168
       'neutron_agents'  => $openstack_service_config,
173 169
     }
170
+
171
+    $nova_polling = {
172
+      'polling_interval' => 60,
173
+      'pagination_limit' => 500,
174
+    }
175
+    $cinder_polling = {
176
+      'polling_interval' => 60,
177
+      'pagination_limit' => 500,
178
+    }
179
+    $glance_polling = {
180
+      'polling_interval' => 60,
181
+      'pagination_limit' => 25,
182
+    }
183
+    $neutron_polling = {
184
+      'polling_interval' => 60,
185
+      'pagination_limit' => 100,
186
+    }
187
+    $openstack_resources = {
188
+      'nova'            => merge($openstack_service_config, $nova_polling),
189
+      'cinder'          => merge($openstack_service_config, $cinder_polling),
190
+      'glance'          => merge($openstack_service_config, $glance_polling),
191
+      'neutron'         => merge($openstack_service_config, $neutron_polling),
192
+    }
174 193
     create_resources(lma_collector::collectd::openstack, $openstack_services)
194
+    create_resources(lma_collector::collectd::openstack, $openstack_resources)
175 195
 
176 196
     # FIXME(elemoine) use the special attribute * when Fuel uses a Puppet version
177 197
     # that supports it.

+ 8
- 4
deployment_scripts/puppet/modules/lma_collector/README.md View File

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

+ 21
- 2
deployment_scripts/puppet/modules/lma_collector/manifests/collectd/openstack.pp View File

@@ -21,6 +21,8 @@ define lma_collector::collectd::openstack (
21 21
   $timeout = 20,
22 22
   $max_retries = 2,
23 23
   $pacemaker_master_resource = undef,
24
+  $polling_interval = undef,
25
+  $pagination_limit = undef,
24 26
 ) {
25 27
 
26 28
   include lma_collector::params
@@ -46,12 +48,29 @@ define lma_collector::collectd::openstack (
46 48
     'Timeout'     => "\"${timeout}\"",
47 49
     'MaxRetries'  => "\"${max_retries}\"",
48 50
   }
51
+  if $polling_interval {
52
+    validate_integer($polling_interval)
53
+    $polling_config = {
54
+      'PollingInterval' => "\"${polling_interval}\""
55
+    }
56
+  } else {
57
+    $polling_config = {}
58
+  }
59
+  if $pagination_limit {
60
+    validate_integer($pagination_limit)
61
+    $limit_config = {
62
+      'PaginationLimit' => "\"${pagination_limit}\""
63
+    }
64
+  } else {
65
+    $limit_config = {}
66
+  }
49 67
 
50 68
   if $pacemaker_master_resource {
51
-    $real_config = merge($config, {'DependsOnResource' => "\"${pacemaker_master_resource}\""})
69
+    $pacemaker_config = {'DependsOnResource' => "\"${pacemaker_master_resource}\""}
52 70
   } else {
53
-    $real_config = $config
71
+    $pacemaker_config = {}
54 72
   }
73
+  $real_config = merge($config, $pacemaker_config, $polling_config, $limit_config)
55 74
 
56 75
   lma_collector::collectd::python { "openstack_${title}":
57 76
     config => $real_config,

Loading…
Cancel
Save