Viewing resource usage per project
To get usage of compute resources allocated to all virtual machines that belong to a particular project, you can use either the vinfra
command or the gnocchi
tool. The latter, however, collects resource usage for a specific period of time.
Prerequisites
- To authorize further OpenStack commands, the OpenStack command-line client must be configured, as outlined in Connecting to OpenStack command-line interface.
To view resource usage per project via vinfra
Use the command vinfra service compute quotas show --usage <project_id>
. For example:
# vinfra service compute quotas show 6ef6f48f01b640ccb8ff53117b830fa3 --usage +---------------------------------+-------+ | Field | Value | +---------------------------------+-------+ | compute.cores.limit | 20 | | compute.cores.used | 2 | | compute.ram.limit | 40960 | | compute.ram.used | 4096 | | k8saas.cluster.limit | 10 | | k8saas.cluster.used | 0 | | lbaas.loadbalancer.limit | 10 | | lbaas.loadbalancer.used | 0 | | network.floatingip.limit | 10 | | network.floatingip.used | 0 | | storage.gigabytes.default.limit | 1024 | | storage.gigabytes.default.used | 66 | +---------------------------------+-------+
The output shows that VMs included in the project with the ID 62af79f31ae5488aa33077d02af48282
were allocated 2 vCPUs, 4 GB of RAM, and 66 GB of disk space.
To view resource usage per project via gnocchi
Use the following commands, for example, for the project with the ID 75521ab61d1f4e9090aac5836c219492
from 12:00 PM July 18, 2021, to 12:00 PM July 19, 2021:
-
To aggregate the number of provisioned vCPUs:
# gnocchi --insecure aggregates --resource-type instance --needed-overlap 0 "(aggregate sum (metric vcpus mean))" \ "project_id=75521ab61d1f4e9090aac5836c219492" --start 2021-07-18T12:00:00 --stop 2021-07-19T12:00:00
-
To aggregate the amount of provisioned RAM:
# gnocchi --insecure aggregates --resource-type instance --needed-overlap 0 "(aggregate sum (metric memory mean))" \ "project_id=75521ab61d1f4e9090aac5836c219492" --start 2021-07-18T12:00:00 --stop 2021-07-19T12:00:00
-
To aggregate the total size of provisioned storage space:
# gnocchi --insecure aggregates --resource-type volume --needed-overlap 0 "(aggregate sum (metric volume.size mean))" \ "project_id=75521ab61d1f4e9090aac5836c219492" --start 2021-07-18T12:00:00 --stop 2021-07-19T12:00:00
-
To aggregate the size of provisioned storage space with the storage policy with the ID
10056d2e-6fc9-4f2e-92c2-dbebb1714778
:# gnocchi --insecure aggregates --resource-type volume --needed-overlap 0 \ "(aggregate sum (metric volume.size.10056d2e-6fc9-4f2e-92c2-dbebb1714778 mean))" \ "project_id=75521ab61d1f4e9090aac5836c219492" --start 2021-07-18T12:00:00 --stop 2021-07-19T12:00:00
-
To aggregate the number of used floating IP addresses:
# gnocchi --insecure aggregates --resource-type network --needed-overlap 0 "(aggregate sum (metric ip.floating mean))" \ "project_id=75521ab61d1f4e9090aac5836c219492" --start 2021-07-18T12:00:00 --stop 2021-07-19T12:00:00
-
To aggregate the size of outgoing network traffic:
# gnocchi --insecure aggregates --resource-type network --needed-overlap 0 "(aggregate sum (metric bandwidth mean))" \ "project_id=75521ab61d1f4e9090aac5836c219492" --start 2021-07-18T12:00:00 --stop 2021-07-19T12:00:00
-
To aggregate the number of load balancers:
# gnocchi --insecure aggregates --resource-type loadbalancer --needed-overlap 0 \ "(aggregate sum (metric network.services.lb.loadbalancer mean))" \ "project_id=75521ab61d1f4e9090aac5836c219492" --start 2021-07-18T12:00:00 --stop 2021-07-19T12:00:00
-
To aggregate the number of Kubernetes clusters:
Kubernetes clusters may be created with an empty project ID. In this case, specify
None
for theproject_id
attribute.# gnocchi --insecure aggregates --resource-type coe_cluster --needed-overlap 0 "(aggregate sum (metric magnum.cluster mean))" \ "project_id=75521ab61d1f4e9090aac5836c219492" --start 2021-07-18T12:00:00 --stop 2021-07-19T12:00:00