Audit an OpenStack cloud for orphaned and wasteful resources
Project description
openstack-janitor
A CLI that audits an OpenStack cloud for orphaned and wasteful resources.
Status: early development. Six detectors are working — see
Detectors; more detectors and a clean command are coming — see
Roadmap.
Install
From source:
git clone <this repo>
cd openstack-janitor
pip install -e .
Publishing to PyPI (pip install openstack-janitor) and a pipx-friendly
release are planned once there's more than one detector.
Usage
janitor audit
janitor audit --cloud my-cloud
janitor audit --detector unattached-volumes --detector orphaned-ports
janitor audit --format json > findings.json
janitor audit --format html > report.html
--format table (the default) prints a rich table; json and html write
machine-readable / shareable reports to stdout.
Example output when orphaned volumes are found:
$ janitor audit --cloud my-cloud
openstack-janitor findings
┏━━━━━━━━━━━━━━━┳━━━━━━━━━━━┳━━━━━━━━━┳━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓
┃ Type ┃ ID ┃ Name ┃ Project ┃ Reason ┃
┡━━━━━━━━━━━━━━━╇━━━━━━━━━━━╇━━━━━━━━━╇━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┩
│ volume │ a1b2c3d4… │ old-db │ proj-1 │ volume is unattached │
│ │ │ │ │ (status=available) │
└───────────────┴───────────┴─────────┴─────────┴──────────────────────────────┘
$ echo $?
1
janitor audit exits 0 when nothing is found, 1 when findings were
reported (so it's safe to wire into a cron job or CI check), 2 if an
unknown --detector name is given, and 3 if connecting to the cloud
fails.
Detectors
| Name | Flags |
|---|---|
unattached-volumes |
Volumes in available status with no attachments. |
unassociated-floating-ips |
Floating IPs not associated with any port. |
orphaned-ports |
Ports with no device owner and no device id. Infrastructure ports (DHCP, routers, load balancer VIPs) always carry one of these, so they are never flagged; a pre-created port awaiting attachment will be. |
old-snapshots |
Volume snapshots older than a threshold (default 90 days). |
shutoff-instances |
Instances in SHUTOFF status whose last update is older than a threshold (default 30 days). There is no "shutoff since" field in the Compute API, so the age is a conservative lower bound — the detector may under-report but never over-reports. |
unused-security-groups |
Security groups not attached to any port and not referenced as a remote_group_id by any rule. The per-project default group is always skipped. |
All detectors are read-only. Resources without a parseable timestamp are never
flagged by the age-based detectors. Thresholds become configurable once
janitor.toml support lands (see Roadmap).
Authentication
openstack-janitor uses openstacksdk
for authentication, so anything openstacksdk understands works here too:
- A named cloud from
clouds.yamlvia--cloud my-cloud(or theOS_CLOUDenvironment variable). - The standard
OS_*environment variables (OS_AUTH_URL,OS_USERNAME,OS_PASSWORD,OS_PROJECT_NAME, etc.) if no cloud is specified.
See the openstacksdk configuration documentation for the full resolution order and file locations.
Roadmap
- A
cleancommand with a--dry-rundefault and explicit--yesto act. janitor.tomlfor per-cloud configuration (which detectors run, age thresholds, exclusions).- Safety rails: tagging/exclusion lists so resources can be marked "do not
touch" before
cleanever deletes anything.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file openstack_janitor-0.1.0.tar.gz.
File metadata
- Download URL: openstack_janitor-0.1.0.tar.gz
- Upload date:
- Size: 19.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
da22a7707161884e6c8945a3ac50c66a7c23f88d0ee23c37ff9d6e6c6bef17e4
|
|
| MD5 |
fb4dff519ce79ef6327891fd93649351
|
|
| BLAKE2b-256 |
ef901d54641a9f6bc10af9a108a8da55133d68360ecc246bdd0923ce284f36e2
|
Provenance
The following attestation bundles were made for openstack_janitor-0.1.0.tar.gz:
Publisher:
release.yml on mabunemeh/openstack-janitor
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
openstack_janitor-0.1.0.tar.gz -
Subject digest:
da22a7707161884e6c8945a3ac50c66a7c23f88d0ee23c37ff9d6e6c6bef17e4 - Sigstore transparency entry: 2167765704
- Sigstore integration time:
-
Permalink:
mabunemeh/openstack-janitor@69e41d1d8452d4843a33a842afef4b1a18a027ad -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/mabunemeh
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@69e41d1d8452d4843a33a842afef4b1a18a027ad -
Trigger Event:
push
-
Statement type:
File details
Details for the file openstack_janitor-0.1.0-py3-none-any.whl.
File metadata
- Download URL: openstack_janitor-0.1.0-py3-none-any.whl
- Upload date:
- Size: 19.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7df59fee796476f72257ecfb8cb1013ce6820b8fbabe8607786c42dfedf50961
|
|
| MD5 |
4655a594adb1e7953759f7ec69fb48d5
|
|
| BLAKE2b-256 |
12be569f10e366cfd6e2e54bf92e1f6f33b24065ad53051a3c0572bbcec5340e
|
Provenance
The following attestation bundles were made for openstack_janitor-0.1.0-py3-none-any.whl:
Publisher:
release.yml on mabunemeh/openstack-janitor
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
openstack_janitor-0.1.0-py3-none-any.whl -
Subject digest:
7df59fee796476f72257ecfb8cb1013ce6820b8fbabe8607786c42dfedf50961 - Sigstore transparency entry: 2167765743
- Sigstore integration time:
-
Permalink:
mabunemeh/openstack-janitor@69e41d1d8452d4843a33a842afef4b1a18a027ad -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/mabunemeh
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@69e41d1d8452d4843a33a842afef4b1a18a027ad -
Trigger Event:
push
-
Statement type: