Ask Your Question

How to get VCPU percentage of an instance

asked 2015-09-23 01:03:36 -0500

updated 2015-09-23 06:50:08 -0500

Hi all,

Is there any way to get the CPU usage percentage (User space) for a given instance with out login to the system, for the purpose of shutting down/terminating unused/idle instances. Maybe via virsh or some libvirt API ?

Thanks, ChamaraT

edit retag flag offensive close merge delete

4 answers

Sort by ยป oldest newest most voted

answered 2015-12-10 23:22:10 -0500

I used Ceilometer data and implemented and it was sucessfull

edit flag offensive delete link more

answered 2015-09-23 01:47:03 -0500

jpribeauville gravatar image


I have the same type of concern :

  • I've developped a piece of software, using C language libvirt APIs, running on RHEL KVM host. It collects a lot of metrics counters from the KVM Hypervisor.
  • May I use it on a host part of an OpenStack infra ?

Thanks for help.

J.P. Ribeauville

edit flag offensive delete link more

answered 2015-09-23 06:47:25 -0500

updated 2015-09-23 07:13:53 -0500

Are you sure that instances that do not consume CPU at the time you are watching are useless ?

(hint, hint: this is a multifaceted question)

I.e. your question is a valid one, but that is probably the wrong question to ask.

EDIT: But if the user set this VM up for a service that consume very little CPU but which is critical for him ?

You should have a look at over-subscription, so that you can launch more instances than you actually have physical resources in your compute node(s), if you have a lot of this kind of instances running.

in /etc/nova/nova.conf:

edit flag offensive delete link more


Plan is to monitor (If possible) the CPU usage continuously lower than given percentage for a given time (may be 24 hours) and to take the actions due to the resource limitation which we have to deal with.

chamaraT gravatar imagechamaraT ( 2015-09-23 06:55:15 -0500 )edit

We have already over used the resources using over committing , now we want to 1. shut down instances which is not used based on may be CPU usage ....(Which is looking a good method), 2. terminate (May be 7 days after shutdown) unused instances.

chamaraT gravatar imagechamaraT ( 2015-10-01 06:30:48 -0500 )edit

Maybe libvirt can give you this info, don't know, sorry...

vincent-legoll gravatar imagevincent-legoll ( 2015-10-01 07:13:59 -0500 )edit

answered 2015-10-06 07:48:58 -0500

rozie gravatar image

Take a look on virsh cpu-stats. It does not give percentage, but still can be useful.

edit flag offensive delete link more

Get to know Ask OpenStack

Resources for moderators

Question Tools

1 follower


Asked: 2015-09-23 01:03:36 -0500

Seen: 1,237 times

Last updated: Dec 10 '15