Skip to main content
CloudCostChefs Tools
Sustainability

OCI Carbon EmissionsData Collector

Professional Python script that harvests carbon emissions data from Oracle Cloud Infrastructure like a sustainability chef gathering premium ingredients. Generate comprehensive reports for data-driven environmental optimization.

Oracle Cloud
Python Script
CSV & JSON Export

Multi-Compartment Collection

Harvest data across your entire OCI tenancy

Flexible Export Formats

CSV and JSON outputs for any dashboard

Enterprise Authentication

OCI config file and profile support

Carbon data collection quick start

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

Prerequisites

  • Python environment with OCI SDK installed (`pip install oci`)
  • OCI credentials and profile configured with Usage/Cost API access
  • Read access to target compartments and emissions/usage APIs
  • Writable path for CSV and JSON export outputs

Data availability timing

OCI carbon/emissions data can lag by 1-2 months. Schedule recurring collections after the data availability window to avoid empty datasets.

Standard collection workflow

  1. 1Start with a single compartment or small scope to validate authentication and output shape.
  2. 2Use monthly granularity first to align with sustainability dashboards and reporting cadence.
  3. 3Expand to tenancy-wide collection once you confirm API access, date availability, and export formats.
  4. 4Automate monthly collections and feed CSV/JSON outputs into dashboards or downstream analysis.
bash
pip install oci
bash
python oci-carbon-emissions-collector.py --profile DEFAULT --compartment-id ocid1.compartment... --granularity monthly
bash
python oci-carbon-emissions-collector.py --all-compartments --output ./carbon-reports --format csv,json

Filters and outputs

CapabilityWhy it mattersTypical use
Compartment filteringTarget business units/environmentsPilot runs, delegated ownership reviews
Time/date filteringControl reporting windowsMonthly/quarterly sustainability reports
CSV exportDashboard ingestion and analysisPower BI / Tableau
JSON exportAutomation and data pipelinesCustom integrations / APIs

Recommended reporting cadence

CadenceScopeGoal
MonthlyAll production + shared compartmentsTrend tracking and stakeholder reporting
QuarterlyFull tenancyProgram review and optimization planning
Ad hocSpecific compartmentInvestigate spikes or anomalies
  • Keep a consistent output path/naming convention to make historical comparisons easier.

Troubleshooting

  • If results are empty, confirm the requested date range is available in OCI and retry with an older reporting window.
  • If authentication fails, verify OCI config/profile settings and test CLI/API access before rerunning.
  • If the script errors on filters, simplify to a minimal query first (single compartment + monthly granularity) and expand incrementally.

Data interpretation

Treat exported values as OCI-sourced sustainability inputs; validate methodology alignment before comparing against other providers in a single dashboard.

Blaze
Blaze says:OCI carbon data usually has a 1-2 month processing delay. Schedule your collection runs on the 5th of each month so last month's data is actually ready -- running earlier just gives you empty results.

Quick Start Guide

Get your OCI carbon emissions data cooking in minutes with our step-by-step recipe for sustainability success.

1

Setup & Authentication

• Install OCI SDK: pip install oci

• Configure OCI credentials and profile

• Verify Usage API access permissions

2

Run Your First Collection

• Start with single compartment testing

• Use monthly granularity for initial runs

• Verify data availability and format

3

Scale & Automate

• Expand to enterprise-wide collection

• Schedule automated monthly reports

• Integrate with sustainability dashboards

Comprehensive Carbon Intelligence

Our OCI Carbon Emissions Collector provides enterprise-grade features for complete sustainability visibility across your Oracle Cloud Infrastructure.

Multi-Compartment Collection

Harvest carbon emissions data across your entire OCI tenancy with compartment-specific filtering and aggregation.

Flexible Export Formats

Generate CSV and JSON reports optimized for Power BI, Tableau, and custom sustainability dashboards.

Enterprise Authentication

OCI config file and profile-based authentication with support for multiple tenancies and environments.

Advanced Filtering

Service, region, compartment, and time-based filtering with support for complex query combinations.

Multiple Granularities

Daily and monthly carbon emissions reporting with automatic date validation and formatting.

Comprehensive Error Handling

Detailed error reporting with troubleshooting guidance and graceful handling of API limitations.

Flexible Date Ranges

Custom date range selection with automatic first-of-month validation and data availability checks.

Multiple Emission Types

Location-based and market-based carbon emission calculations with power-based and spend-based methods.

Recipe Examples

Master the art of carbon data collection with these proven recipes for different sustainability scenarios.

Basic Monthly Collection

Perfect for getting started with carbon emissions tracking across your OCI environment.

python oci_carbon_emissions.py \
  --start-date 2024-01-01 \
  --end-date 2024-03-01 \
  --output-format csv
Quick testing and development

Compartment-Specific Analysis

Target specific compartments for detailed carbon footprint analysis and optimization.

python oci_carbon_emissions.py \
  --start-date 2024-01-01 \
  --end-date 2024-02-01 \
  --compartment-ids comp1,comp2 \
  --group-by service,region \
  --output-format json
Targeted analysis and optimization

Daily Granularity Reporting

Generate detailed daily carbon emissions reports for precise tracking and analysis.

python oci_carbon_emissions.py \
  --start-date 2024-01-01 \
  --end-date 2024-01-31 \
  --granularity DAILY \
  --emission-type MARKET_BASED \
  --output-format csv
Detailed daily tracking

Enterprise Automation

Automated execution for scheduled sustainability reporting with custom profiles.

python oci_carbon_emissions.py \
  --config-file /path/to/config \
  --profile PRODUCTION \
  --start-date 2024-01-01 \
  --end-date 2024-02-01 \
  --limit 500 \
  --summary
Scheduled monthly reporting

Technical Specifications

Enterprise-grade carbon emissions collection with comprehensive OCI integration and professional-quality output formats.

Requirements

Python 3.6+ with OCI SDK

Install with: pip install oci

OCI Configuration

Config file or environment variables properly configured

Usage API Access

Permissions on target OCI compartments

Internet Connectivity

Access to OCI API endpoints

Data Availability Understanding

Carbon data is available monthly with processing delays

Configuration Options

Emission Types

Location-based: Based on grid emission factors

Market-based: Based on contractual arrangements

Calculation Methods

Power-based: Energy consumption calculations

Spend-based: Financial spend calculations

Output Formats

CSV: Optimized for Excel and dashboard tools

JSON: Structured data for API integration

Granularity Options

Daily: Detailed day-by-day tracking

Monthly: Month-over-month trends

Chef's Best Practices

Master the art of carbon emissions collection with these proven techniques from the CloudCostChefs kitchen.

Start Small, Scale Smart

Begin with a single compartment and monthly granularity to test authentication and service availability before scaling to enterprise-wide carbon data collection.

Pro Tip: Like testing a new recipe with a small portion first, validate your setup with limited scope before expanding to full production collection.

Monthly Automation Schedule

Schedule monthly runs on the 5th to ensure data availability for the previous month. Carbon data typically has processing delays.

Implementation: Use cron jobs or task schedulers with OCI config file authentication for automated reporting.

Choose Appropriate Granularity

Use monthly granularity for trend analysis and executive reporting. Reserve daily granularity for detailed optimization analysis.

Performance: Monthly reports are faster and more suitable for dashboard consumption and trend analysis.

Monitor and Review Errors

The script provides detailed error messages with troubleshooting guidance. Review error logs regularly and address permission or service issues.

Error Handling: Common issues include API limits, permission errors, and data availability delays.

Ready to Get Started?

Download the OCI Carbon Emissions Data Collector and start harvesting sustainability insights from your Oracle Cloud Infrastructure today.

OCI Carbon Emissions Collector

Professional Python script with comprehensive OCI integration, flexible export formats, and enterprise-grade error handling.

Multi-compartment carbon data collection
CSV and JSON export formats
Enterprise authentication support
Comprehensive error handling

Why CloudCostChefs?

No Enterprise Bloat

Practical, actionable tools without unnecessary complexity or vendor lock-in.

Community-Driven

Open-source tools developed by practitioners for practitioners.

Immediate Value

Start collecting carbon emissions data in minutes, not months.

What to do next

Pick the path that fits where you are right now.

Trust & run-safety metadata

Key execution details for OCI Carbon Harvester 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 3, 2025

Last Tested

February 23, 2026

Minimum Access

Read-only OCI usage/resource visibility for the compartments and tenancy scopes being analyzed

Execution Type

GitHub-hosted reporting workflow (OCI carbon/emissions analysis)

Version

2025-07-03

SHA256 Checksum

Not published yet (recommend adding checksum for downloadable files)

Verification Notes

GreenOps reporting source is GitHub-hosted. Review OCI data collection assumptions and any required SDK/CLI dependencies before running reports.

Safe Usage Checklist

  • Validate reporting scope (tenancy/compartments/regions) before comparing emissions trends between periods.
  • Use the outputs as an estimation aid and keep methodology notes with shared reports.
  • 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 usage/resource visibility for the compartments and tenancy scopes being analyzed.

Quick start (fast path)

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

Estimated time: 15-20 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 usage/resource visibility for the compartments and tenancy scopes being analyzed.

  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 SDK (pip install oci)
    • ✅ OCI configuration file or environment variables properly configured
    • ✅ Usage API access permissions on target OCI compartments
  4. 4. Run safely and review output

    GreenOps reporting source is GitHub-hosted. Review OCI data collection assumptions and any required SDK/CLI dependencies before running reports. Start with a small sample scope, then expand once results look correct.