Skip to main content

OCI Load Balancer Ghost Hunter

Professional Python script that hunts down forgotten and unused OCI Load Balancers consuming resources but not serving traffic. Intelligent ghost scoring with comprehensive reporting for Oracle Cloud Infrastructure optimization.

Quick Start Examples

Complete Tenancy Scan
python oci-loadbalancer-ghosthunter.py
Specific Compartments
python oci-loadbalancer-ghosthunter.py --compartments comp-123,comp-456
Custom Output Path
python oci-loadbalancer-ghosthunter.py --output ./reports/
Specific Profile
python oci-loadbalancer-ghosthunter.py --profile PRODUCTION

Ghost hunt quick start

Structured quick-reference sections for prerequisites, installation, usage, and troubleshooting.

Prerequisites

  • Python 3.6+ with OCI SDK and standard reporting dependencies
  • OCI authentication configured (profile/config, instance principal, or resource principal)
  • Read access to OCI Load Balancer and Identity services
  • Writable output directory for CSV and JSON reports

Common parameters

ParameterPurposeExample
--compartmentsLimits the scan to specific compartmentsocid1.compartment...,ocid1.compartment...
--outputSets output directory for CSV/JSON reports./reports/
--profileUses a named OCI config profilePRODUCTION
--configUses a custom OCI config file path~/.oci/custom_config

Standard ghost-hunt workflow

  1. 1Run a tenancy-wide scan first to establish the baseline of unused load balancers.
  2. 2Use targeted compartment scans for production/dev environments to validate findings with owners.
  3. 3Review ghost scores and focus immediate action on `Definite Ghost` and `Likely Ghost` classifications.
  4. 4Use CSV for triage and JSON for automation/integration workflows.
bash
python oci-loadbalancer-ghosthunter.py --output ./ghost-reports/ --profile DEFAULT
bash
python oci-loadbalancer-ghosthunter.py --compartments ocid1.compartment.oc1..prod,ocid1.compartment.oc1..dev --output ./targeted-analysis/
bash
python oci-loadbalancer-ghosthunter.py --config ~/.oci/custom_config --compartments ocid1.compartment.oc1..networking

Ghost score interpretation

Score rangeClassificationRecommended action
80+Definite GhostHigh-confidence cleanup candidate after ownership check
60-79Likely GhostValidate with app/network teams before cleanup
40-59SuspiciousInvestigate listeners/backends/usage history
20-39Review NeededMonitor and inspect configuration
0-19ActiveUsually retain unless other evidence indicates waste

CSV and JSON outputs

OutputPrimary useWho uses it
CSV reportTriage, filtering, dashboardsFinOps / platform ops
JSON reportAutomation workflows and integrationsEngineering / platform tooling
  • Review ghost scoring reasons in the report before deleting any OCI load balancer resources.

Troubleshooting

  • If authentication fails, verify the active OCI profile/config and test compartment access with OCI CLI commands.
  • If scans are slow in large tenancies, target specific compartments and run during off-peak hours.
  • If results are incomplete, confirm IAM permissions for Load Balancer and Identity read operations.

Scoring is not deletion approval

Ghost scores prioritize review; they do not replace change validation with application/network owners.

Blaze
Blaze says:Ghost load balancers with a score of 80+ are almost always safe to delete -- but always double-check with the app team for anything scored 40-79. Those 'Suspicious' ones sometimes have a valid reason to exist.

Advanced Ghost Detection Features

Sophisticated multi-factor analysis engine that identifies unused OCI Load Balancers with precision scoring and comprehensive reporting capabilities.

Intelligent Ghost Scoring

Multi-factor analysis with 0-100 scale scoring system evaluating backend sets, listeners, certificates, and lifecycle state for accurate ghost detection.

Compartment Intelligence

Smart compartment discovery with automatic tenancy scanning or targeted compartment analysis with proper OCI SDK integration.

Comprehensive Analysis

Analyzes backend sets, listeners, SSL certificates, health probes, and lifecycle states for both Classic and Network Load Balancers.

Dual Format Reporting

Generates structured CSV for analysis and rich JSON reports with detailed ghost scoring breakdown and actionable recommendations.

Status Classification

5-tier classification system: Definite Ghost (≥80), Likely Ghost (≥60), Suspicious (≥40), Review Needed (≥20), Active (<20).

Backend Health Analysis

Evaluates backend set configurations, health status, and connectivity to identify load balancers with no healthy backends or empty pools.

OCI SDK Integration

Native OCI Python SDK integration with proper authentication, error handling, and support for multiple OCI profiles and configurations.

Age-Based Scoring

Intelligent age analysis that adds scoring weight to older load balancers (>30 days) with existing ghost characteristics for enhanced accuracy.

Chef's Usage Examples

Real-world scenarios for hunting down ghost load balancers in your OCI environment like a professional sous chef organizing the kitchen.

1

Complete Tenancy Ghost Hunt

python oci-loadbalancer-ghosthunter.py
--output ./ghost-reports/
--profile DEFAULT

Comprehensive scan across all compartments in your OCI tenancy to identify forgotten load balancers consuming resources but not serving traffic.

2

Targeted Compartment Analysis

python oci-loadbalancer-ghosthunter.py
--compartments ocid1.compartment.oc1..prod,ocid1.compartment.oc1..dev
--output ./targeted-analysis/

Focus your ghost hunting on specific compartments like production and development environments for targeted cost optimization efforts.

3

Multi-Profile Environment Scan

python oci-loadbalancer-ghosthunter.py
--profile PRODUCTION
--output ./prod-ghost-analysis/

Use different OCI profiles to scan multiple tenancies or environments with proper authentication and configuration management.

4

Custom Configuration Analysis

python oci-loadbalancer-ghosthunter.py
--config ~/.oci/custom_config
--compartments ocid1.compartment.oc1..networking

Use custom OCI configuration files and target specific networking compartments for specialized ghost hunting operations.

Technical Specifications

Professional-grade Python implementation with comprehensive OCI SDK integration and intelligent ghost detection algorithms.

Requirements

  • Python 3.6+ with OCI Python SDK installed
  • OCI Authentication configured (config file, instance principal, or resource principal)
  • IAM Permissions for Load Balancer and Identity services (read access)
  • Network Connectivity to OCI management endpoints
  • Required Packages: oci, argparse, csv, json, logging, datetime

Parameters

--compartments
Comma-separated list of compartment OCIDs to scan (optional)
--output
Output directory path for CSV and JSON reports (default: current directory)
--profile
OCI configuration profile name (default: DEFAULT)
--config
Path to OCI configuration file (optional)

Core Analysis Features

Ghost Scoring Engine

  • • Multi-factor analysis with 0-100 scale scoring
  • • Backend set evaluation (empty pools, offline backends)
  • • Listener configuration analysis
  • • SSL certificate validation for Classic LBs
  • • Lifecycle state assessment
  • • Age-based scoring adjustments

Reporting & Output

  • • Structured CSV for data analysis and BI tools
  • • Rich JSON reports with detailed breakdowns
  • • Ghost status classification (5-tier system)
  • • Backend and listener detail extraction
  • • Shape and bandwidth information
  • • Compartment and tenancy metadata

Ghost Scoring Breakdown

Sophisticated multi-factor algorithm that evaluates load balancer configurations to identify unused resources with precision scoring.

50

Backend Sets Analysis

  • 50 points: No backend sets configured
  • 45 points: All backend sets are empty or offline
  • 25 points: Some backend sets are empty
40

Listener Configuration

  • 40 points: No listeners configured
  • 35 points: All listeners lack valid backend sets
  • 20 points: Some listeners lack backend sets
30

Lifecycle State

  • 30 points: Non-ACTIVE/CREATING state
  • 0 points: ACTIVE or CREATING state
15

SSL Certificates

  • 15 points: HTTPS listeners without SSL certificates (Classic LB only)
  • 0 points: Proper SSL configuration
10

Age Analysis

  • 10 points: Created >30 days ago with existing ghost score >40
  • 0 points: Recently created or low ghost score
5★

Status Classification

  • ≥80: DEFINITE GHOST
  • ≥60: LIKELY GHOST
  • ≥40: SUSPICIOUS
  • ≥20: REVIEW NEEDED
  • <20: ACTIVE

Professional Reporting

Comprehensive dual-format reporting designed for both technical analysis and executive presentation with detailed ghost scoring insights.

CSV Data Export

Structured data format perfect for analysis, BI tool integration, and automated processing workflows.

Key Data Fields:

  • • Load balancer name, OCID, and type
  • • Ghost score and status classification
  • • Compartment and tenancy information
  • • Backend set and listener counts
  • • Lifecycle state and creation date
  • • Shape and bandwidth details
  • • Detailed ghost scoring reasons

JSON Detailed Reports

Rich structured format with comprehensive details, perfect for API integration and detailed analysis workflows.

Enhanced Features:

  • • Complete ghost scoring breakdown
  • • Backend set health analysis
  • • Listener configuration details
  • • SSL certificate information
  • • Nested compartment hierarchy
  • • Timestamp and metadata
  • • Actionable recommendations

Chef's Best Practices

Professional tips for effective ghost hunting and OCI load balancer optimization from the CloudCostChefs kitchen.

OCI Authentication Setup

  • Configure OCI CLI with proper authentication (API key, instance principal, or resource principal)
  • Ensure IAM policies grant read access to Load Balancer and Identity services
  • Test connectivity with oci iam compartment list before running the script

Performance Optimization

  • Use specific compartment targeting for faster scans in large tenancies
  • Run during off-peak hours to minimize impact on OCI API rate limits
  • Monitor script output for any authentication or permission issues

Ghost Analysis Strategy

  • Focus on"DEFINITE GHOST" and"LIKELY GHOST" classifications for immediate action
  • Review"SUSPICIOUS" load balancers with application teams before cleanup
  • Use ghost scoring reasons to understand why resources were flagged

Report Integration

  • Import CSV reports into BI tools for trend analysis and executive dashboards
  • Use JSON reports for automated workflows and API integrations
  • Schedule regular scans to track ghost load balancer trends over time

Start Your Ghost Hunt Today

Download the OCI Load Balancer Ghost Hunter and start identifying unused resources in your Oracle Cloud Infrastructure environment.

Part of the CloudCostChefs toolkit • Open source

What to do next

Pick the path that fits where you are right now.

Trust & run-safety metadata

Key execution details for OCI Load Balancer Ghost Hunter so users know what they are downloading or running before they act.

Need verification guidance? See Security & Trust and Responsible Disclosure.

Read-only / reportingGitHub sourceExplicit + inferred metadata

Maintainer

CloudCostChefs

Last Updated

July 5, 2025

Last Tested

February 23, 2026

Minimum Access

Read-only OCI Load Balancer and Identity access for the target compartments/tenancy scope

Execution Type

GitHub-hosted Python reporting script (OCI load balancer ghost detection)

Version

2025-07-05

SHA256 Checksum

Not published yet (recommend adding checksum for downloadable files)

Verification Notes

GitHub-hosted OCI load balancer analysis script. Confirm OCI auth mode and compartment scope before scheduling or sharing generated reports.

Safe Usage Checklist

  • Validate ghost-scored load balancers with service owners before cleanup or reconfiguration.
  • Protect exported reports if they include resource names, IPs, or compartment metadata.
  • Run in a non-production subscription/account/tenancy first and capture sample output before broader rollout.
  • Use least-privilege access. Current best hint from docs: Read-only OCI Load Balancer and Identity access for the target compartments/tenancy scope.

Quick start (fast path)

Minimal steps to safely get value from this tool without reading the entire page first.

Estimated time: 10-15 minutes per tenancyDifficulty: IntermediateAccess: Review / read-only
  1. 1. Confirm scope and permissions

    Use least privilege and test in a non-production scope first. Minimum access hint: Read-only OCI Load Balancer and Identity access for the target compartments/tenancy scope.

  2. 2. Get the tool package / source

    View on GitHub and review the files before running.

    GitHub
  3. 3. Check prerequisites

    • ✅ Python 3.6+ with OCI Python SDK installed and configured
    • ✅ OCI authentication configured (config file, instance principal, or resource principal)
    • ✅ IAM permissions for Load Balancer and Identity services with read access
  4. 4. Run safely and review output

    GitHub-hosted OCI load balancer analysis script. Confirm OCI auth mode and compartment scope before scheduling or sharing generated reports. Start with a small sample scope, then expand once results look correct.