diff --git a/manifests/agent/polling.pp b/manifests/agent/polling.pp index 0c4ef354..d6b656d6 100644 --- a/manifests/agent/polling.pp +++ b/manifests/agent/polling.pp @@ -86,6 +86,20 @@ # (Optional) Identify user and project names from polled metrics. # Defaults to $facts['os_service_default']. # +# [*enable_notifications*] +# (Optional) Whether the polling service should be sending notifications. +# Defaults to $facts['os_service_default']. +# +# [*enable_prometheus_exporter*] +# (Optional) Alllow this polling instance to expose directly the retrieved +# metrics in Prometheus format. +# Defaults to $facts['os_service_default']. +# +# [*prometheus_listen_addresses*] +# (Optional) A list of ipaddr:port combintations on which the exported +# metrics will be exposed. +# Defaults to $facts['os_service_default']. +# # [*pollsters_definitions_dirs*] # (Optional) List of directories with YAML files used to create pollsters. # Defaults to $facts['os_service_default']. @@ -109,6 +123,9 @@ class ceilometer::agent::polling ( $cfg_file = $facts['os_service_default'], $batch_size = $facts['os_service_default'], $tenant_name_discovery = $facts['os_service_default'], + $enable_notifications = $facts['os_service_default'], + $enable_prometheus_exporter = $facts['os_service_default'], + $prometheus_listen_addresses = $facts['os_service_default'], $pollsters_definitions_dirs = $facts['os_service_default'], ) inherits ceilometer { @@ -219,9 +236,12 @@ class ceilometer::agent::polling ( } ceilometer_config { - 'polling/batch_size': value => $batch_size; - 'polling/tenant_name_discovery': value => $tenant_name_discovery; - 'polling/pollsters_definitions_dirs': value => join(any2array($pollsters_definitions_dirs), ','); + 'polling/batch_size': value => $batch_size; + 'polling/tenant_name_discovery': value => $tenant_name_discovery; + 'polling/pollsters_definitions_dirs': value => join(any2array($pollsters_definitions_dirs), ','); + 'polling/enable_notifications': value => $enable_notifications; + 'polling/enable_prometheus_exporter': value => $enable_prometheus_exporter; + 'polling/prometheus_listen_addresses': value => join(any2array($prometheus_listen_addresses), ','); } if $manage_service { diff --git a/releasenotes/notes/polling-prometheus-opts-8e939b864437c08f.yaml b/releasenotes/notes/polling-prometheus-opts-8e939b864437c08f.yaml new file mode 100644 index 00000000..1fe39dee --- /dev/null +++ b/releasenotes/notes/polling-prometheus-opts-8e939b864437c08f.yaml @@ -0,0 +1,10 @@ +--- +features: + - | + The following parameters have been added to + the ``ceilometer::agent::polling`` class. + + - ``enable_notifications`` + - ``enable_prometheus_exporter`` + - ``prometheus_listen_addresses`` + diff --git a/spec/classes/ceilometer_agent_polling_spec.rb b/spec/classes/ceilometer_agent_polling_spec.rb index c0336b0b..d8e4ee1c 100644 --- a/spec/classes/ceilometer_agent_polling_spec.rb +++ b/spec/classes/ceilometer_agent_polling_spec.rb @@ -73,6 +73,9 @@ describe 'ceilometer::agent::polling' do it { should contain_ceilometer_config('polling/batch_size').with_value('') } it { should_not contain_file('polling') } it { should contain_ceilometer_config('polling/tenant_name_discovery').with_value('') } + it { should contain_ceilometer_config('polling/enable_notifications').with_value('') } + it { should contain_ceilometer_config('polling/enable_prometheus_exporter').with_value('') } + it { should contain_ceilometer_config('polling/prometheus_listen_addresses').with_value('') } it { should contain_ceilometer_config('polling/pollsters_definitions_dirs').with_value('') } it { should contain_ceilometer_config('polling/cfg_file').with_value('') } end @@ -103,26 +106,22 @@ describe 'ceilometer::agent::polling' do } end - context 'when tenant_name_discovery is set' do + context 'when common parameters are set' do before do params.merge!( - :tenant_name_discovery => true + :tenant_name_discovery => true, + :enable_notifications => true, + :enable_prometheus_exporter => false, + :prometheus_listen_addresses => ['127.0.0.1:9101'], + :pollsters_definitions_dirs => ['/etc/ceilometer/pollsters.d', '/etc/ceilometer/mypollsters.d'] ) end it { should contain_ceilometer_config('polling/tenant_name_discovery').with_value(true) - } - end - - context 'when pollsters_definitions_dirs is set' do - before do - params.merge!( - :pollsters_definitions_dirs => ['/etc/ceilometer/pollsters.d', '/etc/ceilometer/mypollsters.d'] - ) - end - - it { + should contain_ceilometer_config('polling/enable_notifications').with_value(true) + should contain_ceilometer_config('polling/enable_prometheus_exporter').with_value(false) + should contain_ceilometer_config('polling/prometheus_listen_addresses').with_value('127.0.0.1:9101') should contain_ceilometer_config('polling/pollsters_definitions_dirs').with_value( '/etc/ceilometer/pollsters.d,/etc/ceilometer/mypollsters.d') }