OpenStack Load Balancer Tree View
A Python script that displays a tree view of all loadbalancers in an OpenStack project, showing pools and members in a hierarchical structure.
Features
- Displays loadbalancers as root nodes
- Shows pools as children of loadbalancers
- Shows members as children of pools
- Shows
provisioning_statusandoperating_statusfor load balancers, pools, and members - Shows a per-pool member operating-status summary (e.g.
13 ERROR - 3 ONLINE - 16 TOTAL) - Highlights members with
provisioning_status != ACTIVE(yellow/bold) - Displays members with
operating_status != ONLINEin red - Single LB: Show the tree for one load balancer by name or ID (
--lb) - Filter mode: Show only problematic members (not ACTIVE/ONLINE) and pools with no members
- Count members: Rank those problematic members by how many load balancers each name appears in (
--count-members) - Combine: Sum every non-healthy membership for a name and show only the count and member name (
--combine) - Collapse mode: Show pools with member status summary, without listing individual members
Installation
Install globally via pip
Install directly from PyPi:
pip install openstack-lb-treeview
After installation, the openstack-lb-treeview command will be available globally.
Set up OpenStack credentials
Set up your OpenStack credentials. You can either:
- Set environment variables (OS_AUTH_URL, OS_USERNAME, OS_PASSWORD, etc.)
- Use a
clouds.yamlfile in~/.config/openstack/or/etc/openstack/
Usage
After installation, use the openstack-lb-treeview command:
Basic usage (uses environment variables for authentication):
openstack-lb-treeview
Specify a cloud from clouds.yaml:
openstack-lb-treeview --cloud mycloud
Filter by project ID:
openstack-lb-treeview --project-id <project-id>
Single load balancer by name or ID:
openstack-lb-treeview --lb my-loadbalancer
openstack-lb-treeview --lb abc123-def456-...
Filter mode (only show problematic members and empty pools):
openstack-lb-treeview --filter
openstack-lb-treeview --lb my-loadbalancer --filter
Count members with a bad status, ordered by how many load balancers each name appears in (highest first). The member name is the host, so this works across environments without a hostname pattern:
openstack-lb-treeview --filter --count-members
Add those non-healthy memberships together, whatever the status (ERROR, NO_MONITOR, OFFLINE, ...), and print only the count and member name:
openstack-lb-treeview --filter --count-members --combine
Collapse mode (pool summary only, no individual members):
openstack-lb-treeview --collapse
Combined filter and collapse mode (show only load balancers with operating_status != 'ONLINE'):
openstack-lb-treeview --filter --collapse
Development Usage
If running from source without installation:
python -m openstack_lb_treeview.lb_treeview
Or directly:
python openstack_lb_treeview/lb_treeview.py
Example Output
Normal mode:
📦 my-loadbalancer (ID: abc123...) (provisioning: ACTIVE | operating: ONLINE)
├─ 🏊 pool-1 (ID: def456...) (provisioning: ACTIVE | operating: DEGRADED) | 1 OFFLINE - 1 ONLINE - 2 TOTAL
│ ├─ 👤 member-1 (provisioning: ACTIVE | operating: ONLINE)
│ └─ 👤 member-2 (provisioning: PENDING_CREATE | operating: OFFLINE)
└─ 🏊 pool-2 (ID: ghi789...) (provisioning: ACTIVE | operating: ONLINE) | 1 ONLINE - 1 TOTAL
└─ 👤 member-3 (provisioning: ACTIVE | operating: ONLINE)
Filter mode (--filter):
📦 my-loadbalancer (ID: abc123...) (provisioning: ACTIVE | operating: DEGRADED)
├─ 🏊 pool-1 (ID: def456...) (provisioning: ACTIVE | operating: DEGRADED) | 1 OFFLINE - 1 ONLINE - 2 TOTAL
│ └─ 👤 member-2 (provisioning: PENDING_CREATE | operating: OFFLINE)
└─ 🏊 pool-3 (ID: xyz789...) (provisioning: ACTIVE | operating: OFFLINE) | 0 TOTAL
└─ No members
In filter mode, only pools with problematic members (not ACTIVE or not ONLINE) or pools with no members are shown. The pool summary still counts all members.
Count members (--filter --count-members):
Members with bad status, ordered by load balancer count:
12 sck-production-scc-zhw-pool-ubuntu-1-aaa-bbb ERROR
3 sck-production-scc-zhw-pool-ubuntu-2-ccc-ddd OFFLINE, ERROR
1 sck-production-scc-zhw-pool-ubuntu-3-eee-fff OFFLINE
Each line is one member name. The number is how many load balancers that host is in with a bad status (not ACTIVE or not ONLINE). Counts greater than 1 are highlighted. Names that show up on many load balancers are the usual candidates to replace.
Combine (--filter --count-members --combine):
Non-healthy members, ordered by count:
15 sck-production-scc-zhw-pool-ubuntu-1-aaa-bbb
3 sck-production-scc-zhw-pool-ubuntu-2-ccc-ddd
1 sck-production-scc-zhw-pool-ubuntu-3-eee-fff
--combine sums every non-healthy membership for that name, whether the status is ERROR, NO_MONITOR, OFFLINE, or anything else that is not ACTIVE/ONLINE. Each line is only the count and the member name.
Collapse mode (--collapse):
📦 my-loadbalancer (ID: abc123...) (provisioning: ACTIVE | operating: ONLINE)
├─ 🏊 pool-1 (ID: def456...) (provisioning: ACTIVE | operating: DEGRADED) | 1 OFFLINE - 1 ONLINE - 2 TOTAL
└─ 🏊 pool-2 (ID: ghi789...) (provisioning: ACTIVE | operating: ONLINE) | 1 ONLINE - 1 TOTAL
In collapse mode, pools are shown with status and member summary, but individual members are not listed.
Combined filter and collapse mode (--filter --collapse):
📦 my-loadbalancer (ID: abc123...) (provisioning: ACTIVE | operating: DEGRADED)
├─ 🏊 pool-1 (ID: def456...) (provisioning: ACTIVE | operating: DEGRADED) | 1 OFFLINE - 1 ONLINE - 2 TOTAL
└─ 🏊 pool-2 (ID: ghi789...) (provisioning: ACTIVE | operating: ONLINE) | 1 ONLINE - 1 TOTAL
When both --filter and --collapse are used together, only load balancers with operating_status != 'ONLINE' are displayed. This is useful for quickly identifying load balancers that are not in an ONLINE state.
Requirements
- Python 3.6+
- openstacksdk
- OpenStack credentials with appropriate permissions
Metadata
Release files for openstack-lb-treeview 0.1.6
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| openstack_lb_treeview-0.1.6.tar.gz | 13.4 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| openstack_lb_treeview-0.1.6-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 24.1 kB
Release files / openstack_lb_treeview-0.1.6.tar.gz
| Download URL | openstack_lb_treeview-0.1.6.tar.gz |
|---|---|
| Size | 13.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
f0a892171291f899b8acb071415c5b2d6b9af3a40c026387ccea92bd0e775f18
|
|
BLAKE2b-256 checksum How to use checksums |
17466e4c3d4b70223693ad06ed8375df57c508e44ba68d301cb56aa1f89f4cda
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.14.7
|
Release files / openstack_lb_treeview-0.1.6-py3-none-any.whl
| Download URL | openstack_lb_treeview-0.1.6-py3-none-any.whl |
|---|---|
| Size | 10.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
2497ad4adce95c029e873ab737a36634fa430f42ce47cf987e6ec7329e5d994c
|
|
BLAKE2b-256 checksum How to use checksums |
b62a8ccdd503099c5ee47f467d390248912736b90cacf63ebbd2e85aa9370a93
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.14.7
|