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

asked 2018-05-21 17:16:55 -0500

gctaylor11 gravatar image

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 ="cpu_util.txt", "w")
f.puts "#{cpu_util_pretty}"
edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted

answered 2020-03-09 01:51:31 -0500

AB239 gravatar image

Check if this helps you ->

similar issue.

edit flag offensive delete link more

Get to know Ask OpenStack

Resources for moderators

Question Tools

1 follower


Asked: 2018-05-21 17:16:55 -0500

Seen: 196 times

Last updated: Mar 09