Exposes high-level OpenStack metrics to Prometheus. Data can be visualised in Grafana — see the OpenStack Clouds Dashboard for a ready-made starting point.
This is the OSUOSL fork of the original Canonical project, which is deprecated upstream. This fork is maintained for environments where the upstream replacement isn't a fit.
The default branch is main. Bug fixes and small enhancements are accepted;
larger architectural changes (asyncio migration, openstacksdk migration) are
not currently planned.
The companion repo at
osuosl/openstack_exporter
builds RPMs for AlmaLinux 9 / 10 with OpenStack release-pinned dependencies
via upper-constraints. The RPM ships a self-contained venv under
/opt/openstack_exporter/ plus the systemd unit and config defaults.
python3 -m venv /opt/prometheus-openstack-exporter
/opt/prometheus-openstack-exporter/bin/pip install -r requirements.txt .For a specific OpenStack release, use that release's upper-constraints:
/opt/prometheus-openstack-exporter/bin/pip install \
-c https://opendev.org/openstack/requirements/raw/tag/yoga-eom/upper-constraints.txt \
-r requirements.txt .Two files drive the exporter at runtime:
-
/etc/prometheus-openstack-exporter/prometheus-openstack-exporter.yaml— exporter behavior (refresh interval, swift hosts, allocation ratios, etc.). Options are documented inline inprometheus-openstack-exporter.sample.yaml. -
/etc/prometheus-openstack-exporter/admin.novarc— OpenStack credentials sourced into the service environment. Modern (Keystone v3) example:export OS_IDENTITY_API_VERSION=3 export OS_AUTH_URL=https://keystone.example.com:5000/v3 export OS_USERNAME=admin export OS_PASSWORD=XXXX export OS_PROJECT_NAME=admin export OS_USER_DOMAIN_NAME=Default export OS_PROJECT_DOMAIN_NAME=Default export OS_REGION_NAME=RegionOne
For legacy v2 deployments, set
OS_IDENTITY_API_VERSION=2and useOS_TENANT_NAMEinstead ofOS_PROJECT_NAME. Empty/unsetOS_IDENTITY_API_VERSIONdefaults to v2.
/etc/default/prometheus-openstack-exporter should set CONFIG_FILE to the
yaml path.
sudo cp prometheus-openstack-exporter.service /etc/systemd/system/
sudo systemctl daemon-reload
sudo systemctl enable --now prometheus-openstack-exporter. /etc/prometheus-openstack-exporter/admin.novarc
./prometheus-openstack-exporter /etc/prometheus-openstack-exporter/prometheus-openstack-exporter.yamlMetrics are served at http://<host>:9183/metrics.
- Cache-backed scrapes. A background
DataGathererthread polls OpenStack on a configurablerefresh_intervaland writes a pickle to/var/cache/prometheus-openstack-exporter/cache./metricsreads that cache instead of hitting OpenStack on every scrape — necessary because the underlying queries can take minutes on larger clouds. - Startup window. Until the gatherer writes its first cache (a few
seconds after start),
/metricsreturns HTTP503 Service Unavailablewith a clear message. Prometheus will markup=0for that brief window; this is intentional and lets you alert on persistent 503s. - Cache age. The metric
openstack_exporter_cache_age_secondsreports how stale the cache is. Alert on this rather than on scrape latency.
There's no OpenStack API to retrieve them. Hardcoding them in queries (the alternative) breaks when ratios change.
Same reason — no API to enumerate them.
Swift stats are included because they're trivial to retrieve from the rings. If a standalone Swift exporter appears we can revisit.
Prometheus best-practice is to avoid caching, but the OpenStack queries we run are heavy — multiple servers scraping uncached would impact cloud performance. The cache decouples scrape cadence from API call cadence.
Given the Swift rings (account.ring.gz is enough), the exporter asks the
ring where a particular account lives, picks a node at random, and issues
an HTTP HEAD to that node's account server.
Doable: GET the account URL for a (paginated) container list, then use
container_ring.get_nodes(account, container) + HTTP HEAD on one of the
resulting nodes. Without caching cleverness it will scale poorly.
See CONTRIBUTING.md. Tests:
venv/bin/python -m unittest discover tests
tox -e lint