Skip to content

Commit

Permalink
Add Openstack metric service to Settings
Browse files Browse the repository at this point in the history
Openstack Metrics capture service can be specified in settings.yml file.

Valid values are "gnocchi", "ceilometer". All other values means autodetection.

Related BZ: https://bugzilla.redhat.com/show_bug.cgi?id=1421729
  • Loading branch information
aufi committed Feb 14, 2017
1 parent 1bdfbc5 commit 926623f
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
15 changes: 15 additions & 0 deletions app/models/manageiq/providers/openstack/base_metrics_capture.rb
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,10 @@ def perf_init_openstack
raise "No EMS defined" if target.ext_management_system.nil?

metering_service, = Benchmark.realtime_block(:connect) do
if available_metric_services.keys.include? metric_service_from_settings
$log.debug "#{_log.prefix} Using metrics provided by \"#{metric_service_from_settings}\" service, which was set in settings.yml."
return target.ext_management_system.connect(:service => available_metric_services[metric_service_from_settings])
end
begin
target.ext_management_system.connect(:service => "Metric")
rescue Exception => ex
Expand Down Expand Up @@ -386,4 +390,15 @@ def parse_datetime(datetime)
datetime << "Z" if datetime.size == 19
Time.parse(datetime)
end

def metric_service_from_settings
Settings[:workers][:worker_base][:queue_worker_base][:ems_metrics_collector_worker][:ems_metrics_openstack_default_service]
rescue StandardError => err
$log.warn "#{_log.prefix} Settings key ems_metrics_openstack_default_service is missing, #{err}."
nil
end

def available_metric_services
{"gnocchi" => "Metric", "ceilometer" => "Metering"}
end
end
1 change: 1 addition & 0 deletions config/settings.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1306,6 +1306,7 @@
:ems_metrics_collector_worker_openstack_network: {}
:ems_metrics_collector_worker_redhat: {}
:ems_metrics_collector_worker_vmware: {}
:ems_metrics_openstack_default_service: "auto"
:ems_metrics_processor_worker:
:count: 2
:memory_threshold: 600.megabytes
Expand Down

0 comments on commit 926623f

Please sign in to comment.