[Openstack] ceilometer question: metering number of running instances

Eoghan Glynn eglynn at redhat.com
Tue Dec 9 13:07:35 UTC 2014

> > Hi all,
> > 
> > I'm looking for a way of how to meter the number of running instances (per
> > tenant).
> > 
> > Currently, the Sum value in ceilometer statistics command's output is
> > confusing, mostly because the high number of notifications generated by
> > nova
> > for each instance. As a result, also the graph in Resource Usage view does
> > not
> > seem really useful at least for 'instances' meter.
> > 
> > (See https://bugs.launchpad.net/ceilometer/+bug/1396257 for this problem)
> > 
> > So, what is the correct way? Should I group the statistics output by
> > resource_id like
> > 
> > ceilometer statistics -m instance -q 'timestamp>2014-12-03T00' -g
> > resource_id
> You could use the new selectable cardinality aggregate added in icehouse,
> e.g.
>   ceilometer statistics -a 'cardinality<-resource_id' \
>     -m instance -q 'timestamp>2014-12-03T00:00:00'
> which counts the number of distinct value of a particular attribute
> within the matching samples (in this cse, the instance UUID).

Note though that this will report the number of distinct instances that
existed at *any* time within the matching time-span for the query.

You could get more fine-grained numbers by bucketizing the values with
a period e.g.:

   ceilometer statistics -a 'cardinality<-resource_id' \
     -m instance -q 'timestamp>2014-12-03T00:00:00' -p 1800

for 30 minute buckets. You shouldn't set that period any tighter than
the polling interval for the instance meter (600s by default) -
otherwise you'll empty periods due to the lack of samples as opposed
to the lack of instances.


More information about the Openstack mailing list