How-To Get Consolidated Data for Cores and RAM Used Across All Tenants

Problem

Capture consolidated data for resource utilization for all tenants in a region.

Environment

  • Platform9 Managed OpenStack - All Versions

Procedure

  1. The following script can be used to get the consolidated data for the cores and RAM used across all tenants in a region.

Note: You will need jq package installed on the system from which you will be running this script.

#!/bin/bashexport ram_allocated=0export cores_allocated=0export TOKEN=$(openstack token issue -c id -f value)for ram in $(curl -s -k -H 'content-type: application/json' -H "X-Auth-Token: $TOKEN" https://[management plane url]/nova/v2.1/[tenant-id]/os-quota-sets/pf9_all_tenants | jq ' .[] | values[] .detail .quota_set .ram .in_use') do ram_allocated=$((ram_allocated+ram)) donefor cores in $(curl -s -k -H 'content-type: application/json' -H "X-Auth-Token: $TOKEN" https://[management plane url]/nova/v2.1/[tenant-id]/os-quota-sets/pf9_all_tenants | jq ' .[] | values[] .detail .quota_set .cores .in_use') do cores_allocated=$((cores_allocated+cores)) done echo "total cores allocated=$cores_allocated" echo "total ram allocated=$ram_allocated"

Last updated