Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

1) query last sample for cpu meter for more than one resource id?

there is no way to do it, you can only get one single last sample, which means group by resource ids then get the last sample for each of them cannot achieve via ceilometer api

I'm not sure if Gnocchi can do this

2) query statistics cannot use OR operand for multiple resource ids, which means you can only do statistic for single resource id, or for all resource ids

3) query samples for multiple resource ids by OR operand is supported by complex query (actually only OR is supported, because a sample cannot associate with two different resource ids)

for example, you want to get samples for resource ids: res1 or res2,

CLI: ceilometer query-samples --filter '{"or":[{"=":{"resource":"res1"}},{"=":{"resource":"res2"}}]}' --limit 100

$ ceilometer help query-samples usage: ceilometer query-samples [-f <filter>] [-o <orderby>] [-l <limit>]

Query samples.

Optional arguments: -f <filter>, --filter <filter> {complex_op: [{simple_op: {field_name: value}}]} The complex_op is one of: ['and', 'or'], simple_op is one of: ['=', '!=', '<', '<=', '>', '>=']. -o <orderby>, --orderby <orderby> [{field_name: direction}, {field_name: direction}] The direction is one of: ['asc', 'desc']. -l <limit>, --limit <limit> Maximum number of samples to return.

documents for developers: http://docs.openstack.org/developer/ceilometer/webapi/v2.html?highlight=complex%20query#complex-query

1) query last sample for cpu meter for more than one resource id?

there is no way to do it, you can only get one single last sample, which means group by resource ids then get the last sample for each of them cannot achieve via ceilometer api api. But you can do it for specific number of resource ids, see item 3) described below.

I'm not sure if Gnocchi can do this

2) query statistics cannot use OR operand for multiple resource ids, which means you can only do statistic for single resource id, or for all resource ids

3) query samples for multiple resource ids by OR operand is supported by complex query (actually only OR is supported, because a sample cannot associate with two different resource ids)

for example, you want to get samples for resource ids: res1 or res2,

CLI: ceilometer query-samples --filter '{"or":[{"=":{"resource":"res1"}},{"=":{"resource":"res2"}}]}' --limit 100

$ ceilometer help query-samples usage: ceilometer query-samples [-f <filter>] [-o <orderby>] [-l <limit>]

Query samples.

Optional arguments: -f <filter>, --filter <filter> {complex_op: [{simple_op: {field_name: value}}]} The complex_op is one of: ['and', 'or'], simple_op is one of: ['=', '!=', '<', '<=', '>', '>=']. -o <orderby>, --orderby <orderby> [{field_name: direction}, {field_name: direction}] The direction is one of: ['asc', 'desc']. -l <limit>, --limit <limit> Maximum number of samples to return.

documents for developers: http://docs.openstack.org/developer/ceilometer/webapi/v2.html?highlight=complex%20query#complex-query

1) query last sample for cpu meter for more than one resource id?

there is no way to do it, you can only get one single last sample, which means group by resource ids then get the last sample for each of them cannot achieve via ceilometer api. But you can do it for specific number of resource ids, see item 3) described below.You need to filter out the returned list manually/

I'm not sure if Gnocchi can do this

2) query statistics cannot use OR operand for multiple resource ids, which means you can only do statistic for single resource id, or for all resource ids

3) query samples for multiple resource ids by OR operand is supported by complex query (actually only OR is supported, because a sample cannot associate with two different resource ids)

for example, you want to get samples for resource ids: res1 or res2,

CLI: ceilometer query-samples --filter '{"or":[{"=":{"resource":"res1"}},{"=":{"resource":"res2"}}]}' --limit 100

$ ceilometer help query-samples usage: ceilometer query-samples [-f <filter>] [-o <orderby>] [-l <limit>]

Query samples.

Optional arguments: -f <filter>, --filter <filter> {complex_op: [{simple_op: {field_name: value}}]} The complex_op is one of: ['and', 'or'], simple_op is one of: ['=', '!=', '<', '<=', '>', '>=']. -o <orderby>, --orderby <orderby> [{field_name: direction}, {field_name: direction}] The direction is one of: ['asc', 'desc']. -l <limit>, --limit <limit> Maximum number of samples to return.

documents for developers: http://docs.openstack.org/developer/ceilometer/webapi/v2.html?highlight=complex%20query#complex-query