# How do I get the cpu_util meter from the compute nodes?

I'm trying to collect meters from OpenStack 8(Liberty) compute nodes and use the data as decision points to migrate instances to underutilized compute nodes.

To start with I've been able to get cpu_util data using the code below but my output looks like it is just the Instances and not the compute nodes.

How do I get the cpu_util meter from the compute nodes?

cpu_util_url = "https://#{host}:#{resource_port}/v2/meters/cpu_util"

cpu_util_result = RestClient::Request.execute({:method   => :get,
:url     => cpu_util_url,
:headers => { :content_type => 'application/json',
'X-Auth-Token' => token_result }
})

cpu_util_parse = JSON.parse(cpu_util_result)
cpu_util_pretty = JSON.pretty_generate(cpu_util_parse)

# For writing to screen.
# puts "cpu util:  #{cpu_util_pretty}"

# This section for writing to file
f = File.new("cpu_util.txt", "w")
f.puts "#{cpu_util_pretty}"
f.close

edit retag close merge delete