We're collecting Openstack metrics from Ceilometer through the Gnocchi API and publish them on Prometheus with a custom conversion of the format.
The cpu
metric, as documented, is a cumulative value, per instance, expressed in nanoseconds.
We're publishing the series on prometheus with this conversion:
cpu {resource_id_r="75994f30-c0d4-4c04-aefb-652984152d0f", metric_id="2c04232e-645c-4ee9-9007-2065ce2c9f78", deployment_id="64905d87bf16886de792964d", resource_name="Kaas", nodepool_name="node1"} 6.633E+11
where the deployment_id
is the instance ID read from Openstack.
I need a query that can express the usage of the cpu as a percentage across the selected interval.
From this post I have tried a similar query:
100-(avg by (deployment_id) (irate(cpu{deployment_id!=""}[5m])) * 100)