{"id":41075046,"url":"https://github.com/stackhpc/os-capacity","last_synced_at":"2026-01-22T13:18:23.588Z","repository":{"id":83225551,"uuid":"100724960","full_name":"stackhpc/os-capacity","owner":"stackhpc","description":"Find out how much capacity you have in your OpenStack cloud.","archived":false,"fork":false,"pushed_at":"2025-09-10T13:45:46.000Z","size":156,"stargazers_count":12,"open_issues_count":6,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-09-10T17:52:40.359Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/stackhpc.png","metadata":{"files":{"readme":"README.rst","changelog":null,"contributing":"CONTRIBUTING.rst","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2017-08-18T15:19:27.000Z","updated_at":"2024-11-05T17:16:14.000Z","dependencies_parsed_at":"2024-03-07T11:30:46.405Z","dependency_job_id":"288afbd2-d59b-465f-96c5-a3aedcb097ff","html_url":"https://github.com/stackhpc/os-capacity","commit_stats":null,"previous_names":[],"tags_count":7,"template":false,"template_full_name":null,"purl":"pkg:github/stackhpc/os-capacity","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stackhpc%2Fos-capacity","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stackhpc%2Fos-capacity/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stackhpc%2Fos-capacity/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stackhpc%2Fos-capacity/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/stackhpc","download_url":"https://codeload.github.com/stackhpc/os-capacity/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stackhpc%2Fos-capacity/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28663778,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-22T01:17:37.254Z","status":"online","status_checked_at":"2026-01-22T02:00:07.137Z","response_time":144,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2026-01-22T13:18:22.927Z","updated_at":"2026-01-22T13:18:23.572Z","avatar_url":"https://github.com/stackhpc.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"os-capacity\n===========\n\nThis is a prototype prometheus exporter\nto extract capacity information from OpenStack Placement.\n\nIt includes support for both baremetal flavors\nand flavors with PCPU resources implied.\n\nInstall\n-------\n\nFirst lets get the code downloaded:\n\n.. code::\n\n    git clone https://github.com/stackhpc/os-capacity.git\n    cd os-capacity\n\nNow lets get that installed inside a virtual environment:\n\n.. code::\n\n    python3 -m venv .venv\n    source .venv/bin/activate\n    pip install -U .\n\nPrometheus Exporter\n-------------------\n\nAssuming you have clouds.yaml in the right place,\nand those credentials have read access to the Placement API, Nova API and Keystone APIs,\nyou can run the exporter doing something like this:\n\n.. code::\n\n   export OS_CLIENT_CONFIG_FILE=myappcred.yaml\n   export OS_CLOUD=openstack\n\n   ./os_capacity/prometheus.py \u0026\n   curl localhost:9000 \u003e mytestrun\n   cat mytestrun\n\nOr just run via docker or similar:::\n\n   docker run -d --name os_capacity \\\n     --mount type=bind,source=/etc/kolla/os-capacity/,target=/etc/openstack \\\n     --env OS_CLOUD=openstack --env OS_CLIENT_CONFIG_FILE=/etc/openstack/clouds.yaml \\\n     -p 9000:9000 ghcr.io/stackhpc/os-capacity:master\n   curl localhost:9000\n\n\nWe aslo have the following optional environment variables:\n\n* OS_CAPACITY_EXPORTER_PORT = 9000\n* OS_CAPACITY_EXPORTER_LISTEN_ADDRESS = \"0.0.0.0\"\n* OS_CAPACITY_SKIP_AGGREGATE_LOOKUP = 0\n* OS_CAPACITY_SKIP_PROJECT_USAGE = 0\n* OS_CAPACITY_SKIP_HOST_USAGE = 0\n\nHere is some example output from the exporter:::\n\n   # HELP openstack_free_capacity_by_flavor_total Free capacity if you fill the cloud full of each flavor\n   # TYPE openstack_free_capacity_by_flavor_total gauge\n   openstack_free_capacity_by_flavor_total{flavor_name=\"amphora\"} 821.0\n   openstack_free_capacity_by_flavor_total{flavor_name=\"bmtest\"} 1.0\n   openstack_free_capacity_by_flavor_total{flavor_name=\"large\"} 46.0\n   openstack_free_capacity_by_flavor_total{flavor_name=\"medium\"} 94.0\n   openstack_free_capacity_by_flavor_total{flavor_name=\"small\"} 191.0\n   openstack_free_capacity_by_flavor_total{flavor_name=\"tiny\"} 385.0\n   openstack_free_capacity_by_flavor_total{flavor_name=\"xlarge\"} 19.0\n   openstack_free_capacity_by_flavor_total{flavor_name=\"pinnned.full\"} 1.0\n   openstack_free_capacity_by_flavor_total{flavor_name=\"pinnned.half\"} 2.0\n   openstack_free_capacity_by_flavor_total{flavor_name=\"pinned.large\"} 2.0\n   openstack_free_capacity_by_flavor_total{flavor_name=\"pinned.quarter\"} 4.0\n   openstack_free_capacity_by_flavor_total{flavor_name=\"pinned.tiny\"} 53.0\n   ...\n   # HELP openstack_free_capacity_hypervisor_by_flavor Free capacity for each hypervisor if you fill remaining space full of each flavor\n   # TYPE openstack_free_capacity_hypervisor_by_flavor gauge\n   openstack_free_capacity_hypervisor_by_flavor{az_aggregate=\"regular\",flavor_name=\"amphora\",hypervisor=\"ctrl1\",project_aggregate=\"test\"} 263.0\n   ...\n   # HELP openstack_project_filter_aggregate Mapping of project_ids to aggregates in the host free capacity info.\n   # TYPE openstack_project_filter_aggregate gauge\n   openstack_project_filter_aggregate{aggregate=\"test\",project_id=\"c6992a4f9f5a45fab23114d032fca40b\"} 1.0\n   ...\n   # HELP openstack_project_usage Current placement allocations per project.\n   # TYPE openstack_project_usage gauge\n   openstack_project_usage{placement_resource=\"VCPU\",project_id=\"c6992a4f9f5a45fab23114d032fca40b\",project_name=\"test\"} 136.0\n   openstack_project_usage{placement_resource=\"MEMORY_MB\",project_id=\"c6992a4f9f5a45fab23114d032fca40b\",project_name=\"test\"} 278528.0\n   openstack_project_usage{placement_resource=\"DISK_GB\",project_id=\"c6992a4f9f5a45fab23114d032fca40b\",project_name=\"test\"} 1440.0\n   ...\n   # HELP openstack_project_quota Current quota set to limit max resource allocations per project.\n   # TYPE openstack_project_quota gauge\n   openstack_project_quota{project_id=\"c6992a4f9f5a45fab23114d032fca40b\",project_name=\"test\",quota_resource=\"CPUS\"} -1.0\n   openstack_project_quota{project_id=\"c6992a4f9f5a45fab23114d032fca40b\",project_name=\"test\",quota_resource=\"MEMORY_MB\"} -1.0\n   ...\n   # HELP openstack_hypervisor_placement_allocated Currently allocated resource for each provider in placement.\n   # TYPE openstack_hypervisor_placement_allocated gauge\n   openstack_hypervisor_placement_allocated{hypervisor=\"ctrl1\",resource=\"VCPU\"} 65.0\n   openstack_hypervisor_placement_allocated{hypervisor=\"ctrl1\",resource=\"MEMORY_MB\"} 132096.0\n   openstack_hypervisor_placement_allocated{hypervisor=\"ctrl1\",resource=\"DISK_GB\"} 485.0\n   ...\n   # HELP openstack_hypervisor_placement_allocatable_capacity The total allocatable resource in the placement inventory.\n   # TYPE openstack_hypervisor_placement_allocatable_capacity gauge\n   openstack_hypervisor_placement_allocatable_capacity{hypervisor=\"ctrl1\",resource=\"VCPU\"} 320.0\n   openstack_hypervisor_placement_allocatable_capacity{hypervisor=\"ctrl1\",resource=\"MEMORY_MB\"} 622635.0\n   openstack_hypervisor_placement_allocatable_capacity{hypervisor=\"ctrl1\",resource=\"DISK_GB\"} 19551.0\n\nExample of a prometheus scrape config:::\n\n   - job_name: os_capacity\n     relabel_configs:\n    - regex: ([^:]+):\\d+\n      source_labels:\n      - __address__\n      target_label: instance\n    static_configs:\n    - targets:\n      - localhost:9000\n    scrape_interval: 2m\n    scrape_timeout: 1m\n\nOnce that is in prometheus, and its not timing out, you can visualise the data\nby importing this grafana dashboard:\nhttps://raw.githubusercontent.com/stackhpc/os-capacity/master/grafana_cloud_dashboard.json\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstackhpc%2Fos-capacity","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fstackhpc%2Fos-capacity","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstackhpc%2Fos-capacity/lists"}