Skip to content
GreenKube

Reports & Exports

import { Aside } from ‘@astrojs/starlight/components’;

GreenKube provides powerful reporting capabilities for regulatory compliance (CSRD/ESRS E1), cost analysis, and sustainability tracking.

Generate reports via the CLI:

Terminal window
# Last 24 hours, terminal table
greenkube report --last 24h --daily
# Last 7 days in JSON
greenkube report --last 7d --format json
# Last 3 months grouped monthly
greenkube report --last 3m --monthly
# Custom date range
greenkube report --start 2024-01-01 --end 2024-03-31 --monthly
# Full calendar year (CSRD use case)
greenkube report --years 2024 --monthly --format csv -o 2024-annual.csv
# Multi-year comparison
greenkube report --years 2023 --years 2024 --yearly
# Namespace breakdown
greenkube report --last 30d --monthly --group-by-namespace

The /report page in the web dashboard provides a visual interface:

  1. Pick a relative window or custom date range
  2. Optionally filter by namespace
  3. Choose aggregation granularity (hourly → yearly)
  4. Preview row count and totals
  5. Download CSV or JSON directly to your browser

When running as a service (greenkube start), metrics are collected every 5 minutes and stored in the database. Reports can query any historical period, with raw data auto-compressed to hourly aggregates after 24 h and retained indefinitely by default.

Each report row includes per-pod data:

MetricUnitDescription
EnergyJoulesEstimated energy consumption
CO₂e (Scope 2)gramsOperational emissions from electricity
Embodied CO₂e (Scope 3)gramsHardware manufacturing emissions
Total CO₂egramsScope 2 + Scope 3
CostUSDAllocated infrastructure cost
CPU UsagemillicoresActual CPU utilization
CPU RequestmillicoresRequested CPU resources
Memory UsagebytesActual memory consumption
Memory RequestbytesRequested memory
Network Rx/TxbytesNetwork traffic in/out
Disk Read/WritebytesDisk I/O
RestartscountContainer restart count
NodeNode name and instance type
ZoneElectricity Maps carbon zone

Rich terminal tables with color-coded values:

Terminal window
greenkube report --last 24h

Comma-separated values for spreadsheet analysis:

Terminal window
greenkube report --last 7d --format csv -o weekly-report.csv

Structured JSON for programmatic processing:

Terminal window
greenkube report --last 30d --format json -o monthly-report.json
SyntaxMeaning
1hLast 1 hour
6hLast 6 hours
24hLast 24 hours
7dLast 7 days
30dLast 30 days
3mLast 3 months
6mLast 6 months
1yLast 12 months
ytdYear-to-date
--years 2024Full calendar year 2024
--start / --endArbitrary ISO 8601 range
OptionDescription
--hourlyOne row per pod per hour
--dailyOne row per pod per day
--weeklyOne row per pod per week
--monthlyOne row per pod per month
--yearlyOne row per pod per year
--group-by-namespaceAggregate all pods within a namespace
Terminal window
# By namespace
greenkube report --last 7d -n production
# By pod name
greenkube report --last 7d --pod "api-server"
# By node
greenkube report --last 7d --node "worker-1"

Use --fail-on-co2 and --fail-on-cost to enforce carbon and cost budgets in your CI/CD pipelines:

Terminal window
# Fail if daily CO₂e exceeds 50 kg (50,000 g)
greenkube report --last 24h --fail-on-co2 50000
# Fail if monthly cost exceeds $500
greenkube report --last 30d --fail-on-cost 500
# Combine with report output
greenkube report --last 24h --fail-on-co2 50000 --fail-on-cost 1000

Exit code 1 is returned when the threshold is exceeded, blocking the pipeline. This enables carbon-aware CI/CD workflows.

GreenKube is designed to generate the data required for CSRD (Corporate Sustainability Reporting Directive) annual GHG disclosures under ESRS E1 (Climate Change):

ESRS RequirementGreenKube Implementation
Scope 2 emissions (market-based)co2e_grams per pod/namespace/cluster
Scope 3 upstream emissions (Category 1)embodied_co2e_grams — hardware manufacturing
Total GHG (Scope 2 + 3)total_co2e_all_scopes
Yearly reporting period--years 2024
Custom date range--start / --end
Business unit allocation--group-by-namespace
Multi-year retentionInfinite aggregated retention (default)
GranularityMonthly aggregation for annual reports
Terminal window
# Annual report for 2024, monthly granularity, by namespace
greenkube report --years 2024 --monthly --group-by-namespace \
--format csv --output 2024-csrd-report.csv
# Or via API
curl -O -J \
"http://greenkube:8000/api/v1/report/export?format=csv&years=2024&granularity=monthly&group_by_namespace=true"
Terminal window
# Report preview (row count + totals)
GET /api/v1/report/summary?last=30d
# Download report file
GET /api/v1/report/export?format=csv&years=2024&granularity=monthly
# Namespace breakdown
GET /api/v1/metrics/by-namespace?last=30d
# Pre-computed summary (cached, fast)
GET /api/v1/metrics/dashboard-summary

See the API Reference for complete endpoint documentation.