[ops] [nova] How to get CPUtime and wallclokctime consumed by a project (without using ceilometer) ?
smooney at redhat.com
Wed Nov 28 21:18:44 UTC 2018
On Wed, 2018-11-28 at 12:14 -0500, Jay Pipes wrote:
> On 11/28/2018 10:38 AM, Massimo Sgaravatto wrote:
> > Hi
> > I was wondering if nova allows to get the CPUtime and wallclocktime
> > consumed by a project in a certain time period, without using ceilometer
> > Among the data returned by the command "openstack usage show" there is
> > also a "CPU Hours" but, if I am not wrong, this is actually the
> > WallClockTime. Did I get it right ?
> It's neither. It's the calculated time that the VM has been "up"
> multiplied by the number of vCPUs the VM consumes.
> It's basically worthless as anything more than a simplistic indicator of
> rough resource consumption.
> You can see how the calculation is done by following the fairly
> convoluted code in the os-simple-tenant-usage API:
> This calculates the "hours used":
> And here is where that is multiplied by the VM's vCPUs:
> > If so, it is also possible to get the CPUTime ?
> If you are referring to getting the amount of time a *physical host CPU*
> has spent performing tasks for a particular VM, the closest you can get
> to this would be the "server diagnostics" API:
> That said, the server diagnostics API is a very thin shim over a
> virt-driver-specific interface:
> The libvirt driver's get_server_diagnostics() (host-specific) and
> get_instance_diagnostics() (VM-specific) implementation is here:
> You might want to look at that code and implement a simple
> collectd/statsd/fluentd/telegraf collector to grab those stats directly
if you go the collectd route the libvirt plugin was modifed about 2 years ago to be able to use the domain uuid
instaed the domain instance name when reporting stats and since we set the domain uuid to the nova uuid it makes it
really easy to map back to the instance later. so ihink the colloectd libvirt plugin may be able to give you this info
already and you can then just export that ot influxdb or gnnoci use later. the other monitoring solution can proably do
the same but nova does not really track vm cpu usage that closely.
> from the libvirt daemon on the compute nodes themselves.
More information about the openstack-discuss