]> review.fuel-infra Code Review - puppet-modules/puppet-ceilometer.git/commitdiff
Add support to configure publisher in pipeline.yaml
authorPradeep Kilambi <pkilambi@redhat.com>
Thu, 16 Mar 2017 19:45:45 +0000 (15:45 -0400)
committerPradeep Kilambi <pkilambi@redhat.com>
Tue, 11 Apr 2017 17:56:33 +0000 (13:56 -0400)
pipeline yaml defaults to gnocchi publisher. This wont work
if collector(which is deprecated) is still being used. This
should be set to notifier:// instead. So lets make this
configurable.

Change-Id: I242642035c3d3d6e814f54bcd2d1e15c3a53120b

manifests/agent/notification.pp
manifests/params.pp
releasenotes/notes/configure-pipeline-8cc371e4af193f1d.yaml [new file with mode: 0644]
spec/classes/ceilometer_agent_notification_spec.rb
templates/pipeline.yaml.erb [new file with mode: 0644]

index b1fccd13b4c25b9e8809e85205fc48c5e59f6e39..00120a8399971d7837eaa74d84653d6277409923 100644 (file)
 #   for alarms.
 #   Defaults to ['gnocchi://'],
 #
+# [*manage_pipeline*]
+#   (Optional) Whether to manage pipeline.yaml
+#   Defaults to false
+#
+# [*pipeline_publishers*]
+#   (Optional) A list of publishers to put in pipeline.yaml.
+#   By default all the data is dispatched to gnocchi
+#   Defaults to ['gnocchi://'], If you are using collector
+#   override this to notifier:// instead.
+#
 class ceilometer::agent::notification (
   $manage_service            = true,
   $enabled                   = true,
@@ -78,6 +88,8 @@ class ceilometer::agent::notification (
   $package_ensure            = 'present',
   $manage_event_pipeline     = false,
   $event_pipeline_publishers = ['gnocchi://'],
+  $manage_pipeline           = false,
+  $pipeline_publishers       = ['gnocchi://'],
 ) {
 
   include ::ceilometer::deps
@@ -119,6 +131,18 @@ class ceilometer::agent::notification (
     }
   }
 
+  if ($manage_pipeline) {
+    validate_array($pipeline_publishers)
+
+    file { 'pipeline':
+      ensure                  => present,
+      path                    => $::ceilometer::params::pipeline,
+      content                 => template('ceilometer/pipeline.yaml.erb'),
+      selinux_ignore_defaults => true,
+      tag                     => 'pipeline',
+    }
+  }
+
   ceilometer_config {
     'notification/ack_on_event_error'       : value => $ack_on_event_error;
     'notification/store_events'             : value => $store_events;
index 84b0df9b2c927e1187921ce42f0336bcd50baac4..9a026a2b84fe4ce54db7c8788346caef5af45417 100644 (file)
@@ -10,6 +10,7 @@ class ceilometer::params {
   $expirer_command     = 'ceilometer-expirer'
   $user                = 'ceilometer'
   $event_pipeline      = '/etc/ceilometer/event_pipeline.yaml'
+  $pipeline            = '/etc/ceilometer/pipeline.yaml'
   $client_package_name = 'python-ceilometerclient'
 
   case $::osfamily {
diff --git a/releasenotes/notes/configure-pipeline-8cc371e4af193f1d.yaml b/releasenotes/notes/configure-pipeline-8cc371e4af193f1d.yaml
new file mode 100644 (file)
index 0000000..96fc8a1
--- /dev/null
@@ -0,0 +1,5 @@
+---
+fixes:
+  - Add ability to configure pipeline yaml publishers. The default is
+    gnocchi. If you are using collector, override this param to
+    publisher:// instead.
index 03b5a49917bcbae30e659a07ac1c3cb53ac9c1cc..1c1bbaef1ff86d9c7548d57bf837fcf406784429 100644 (file)
@@ -171,6 +171,23 @@ describe 'ceilometer::agent::notification' do
       ) }
         it { is_expected.not_to contain_file('event_pipeline') }
     end
+
+    context "with pipeline management enabled" do
+      before { params.merge!(
+        :manage_pipeline => true
+      ) }
+
+      it { is_expected.to contain_file('pipeline').with(
+        'path' => '/etc/ceilometer/pipeline.yaml',
+      ) }
+    end
+
+    context "with pipeline management disabled" do
+      before { params.merge!(
+        :manage_pipeline => false
+      ) }
+        it { is_expected.not_to contain_file('pipeline') }
+    end
   end
 
   on_supported_os({
diff --git a/templates/pipeline.yaml.erb b/templates/pipeline.yaml.erb
new file mode 100644 (file)
index 0000000..c5c41be
--- /dev/null
@@ -0,0 +1,98 @@
+---
+sources:
+    - name: meter_source
+      meters:
+          - "*"
+      sinks:
+          - meter_sink
+    - name: cpu_source
+      meters:
+          - "cpu"
+      sinks:
+          - cpu_sink
+          - cpu_delta_sink
+    - name: disk_source
+      meters:
+          - "disk.read.bytes"
+          - "disk.read.requests"
+          - "disk.write.bytes"
+          - "disk.write.requests"
+          - "disk.device.read.bytes"
+          - "disk.device.read.requests"
+          - "disk.device.write.bytes"
+          - "disk.device.write.requests"
+      sinks:
+          - disk_sink
+    - name: network_source
+      meters:
+          - "network.incoming.bytes"
+          - "network.incoming.packets"
+          - "network.outgoing.bytes"
+          - "network.outgoing.packets"
+      sinks:
+          - network_sink
+sinks:
+    - name: meter_sink
+      transformers:
+      publishers:
+<% @pipeline_publishers.each do |publisher| -%>
+          - <%= publisher %>
+<% end -%>
+    - name: cpu_sink
+      transformers:
+          - name: "rate_of_change"
+            parameters:
+                target:
+                    name: "cpu_util"
+                    unit: "%"
+                    type: "gauge"
+                    scale: "100.0 / (10**9 * (resource_metadata.cpu_number or 1))"
+      publishers:
+<% @pipeline_publishers.each do |publisher| -%>
+          - <%= publisher %>
+<% end -%>
+    - name: cpu_delta_sink
+      transformers:
+          - name: "delta"
+            parameters:
+                target:
+                    name: "cpu.delta"
+                growth_only: True
+      publishers:
+<% @pipeline_publishers.each do |publisher| -%>
+          - <%= publisher %>
+<% end -%>
+    - name: disk_sink
+      transformers:
+          - name: "rate_of_change"
+            parameters:
+                source:
+                    map_from:
+                        name: "(disk\\.device|disk)\\.(read|write)\\.(bytes|requests)"
+                        unit: "(B|request)"
+                target:
+                    map_to:
+                        name: "\\1.\\2.\\3.rate"
+                        unit: "\\1/s"
+                    type: "gauge"
+      publishers:
+<% @pipeline_publishers.each do |publisher| -%>
+          - <%= publisher %>
+<% end -%>
+    - name: network_sink
+      transformers:
+          - name: "rate_of_change"
+            parameters:
+                source:
+                   map_from:
+                       name: "network\\.(incoming|outgoing)\\.(bytes|packets)"
+                       unit: "(B|packet)"
+                target:
+                    map_to:
+                        name: "network.\\1.\\2.rate"
+                        unit: "\\1/s"
+                    type: "gauge"
+      publishers:
+<% @pipeline_publishers.each do |publisher| -%>
+          - <%= publisher %>
+<% end -%>