OCI Cost Analysis
- Last Updated 6/7/2024, 3:53:11 PM UTC
- About 4 min read
Plugin info
name: oci-cost-analysis
Monitors and reports OCI cost and budget metrics. All reported metrics and events have their source
dimension set to the tenancy name as configured in the source
property (see Configuration ).
# Prerequisites
- OCI API key with access to required OCI cost analysis and budget APIs.
- OCI client configuration is expected in file
$HOME/.oci/config
- Budget period must start at 1st of month
# Events
# Metrics
Metric | Description |
---|---|
oci/cost/tenancy/[usage_period: usage period]/[currency: currency code]/amount | total tenancy cost for a period |
oci/cost/tenancy/[usage_period: usage period]/[currency: currency code]/budget_amount | total tenancy budget for a period |
oci/cost/tenancy/[usage_period: usage period]/[currency: currency code]/amount_forecast | total tenancy cost forecast for a period |
oci/cost/service/[name: service]/[usage_period: usage period]/[currency: currency code]/amount | service cost for a period |
oci/cost/service/[name: service]/[usage_period: usage period]/[currency: currency code]/amount_forecast | service cost forecast for a period |
# Configuration
This section describes the configuration settings for this plugin
IMPORTANT
Sensitive data should be stored inside the agent secrets store and referenced in this file using ${secret key}
notation.
Name | Type | Required | Default | Description |
---|---|---|---|---|
tenant_ocid | string | Yes | tenant OCI ID | |
tenancy_budget_ocid | string | No | tenancy budget OCI ID | |
proxy | string | No | optional http proxy url to use for the OCI endpoint requests | |
api_key_passphrase | string | Yes | the API key passphrase (supports secrets) | |
oci_config_profile | string | No | DEFAULT | the OCI client configuration profile to use |
timeout | duration | No | 60s | how long to wait for each search results page |
source | string | Yes | the source value to use for the generated metrics and events, should reflect the OCI tenancy name | |
look_back_periods | int | No | how many periods to look back and report the first time this plugin runs |
# Examples
tenant_ocid: my.tenancy.ocid
oci_config_profile: DEFAULT
api_key_passphrase: ${oci.api_key_passphrase} # your API key passphrase (secret managed by polaris)
timeout: 30s
source: my-tenancy-name
look_back_periods: 11
This will give you metrics that look like:
oci/cost/tenancy/amount{source="test-tenancy-name", usage_period="2023-07", currency="USD"}: 0.474774
oci/cost/service/amount{source="test-tenancy-name", name="Block Storage", usage_period="2023-07", currency="USD"}: 0.000000
oci/cost/service/amount{source="test-tenancy-name", name="Compute", usage_period="2023-07", currency="USD"}: 0.474774
oci/cost/service/amount{source="test-tenancy-name", name="Telemetry", usage_period="2023-07", currency="USD"}: 0.000000
oci/cost/tenancy/amount{source="test-tenancy-name", usage_period="2023-08", currency="USD"}: 4.608000
oci/cost/service/amount{source="test-tenancy-name", name="Block Storage", usage_period="2023-08", currency="USD"}: 0.000000
oci/cost/service/amount{source="test-tenancy-name", name="Compute", usage_period="2023-08", currency="USD"}: 4.608000
oci/cost/service/amount{source="test-tenancy-name", name="Telemetry", usage_period="2023-08", currency="USD"}: 0.000000
...
oci/cost/service/amount{source="test-tenancy-name", name="Object Storage", usage_period="2024-05", currency="USD"}: 0.136189
oci/cost/service/amount{source="test-tenancy-name", name="Logging", usage_period="2024-05", currency="USD"}: 0.130705
oci/cost/service/amount{source="test-tenancy-name", name="Telemetry", usage_period="2024-05", currency="USD"}: 0.000000
oci/cost/service/amount{source="test-tenancy-name", name="Block Storage", usage_period="2024-05", currency="USD"}: 110.281631
oci/cost/service/amount{source="test-tenancy-name", name="Virtual Cloud Network", usage_period="2024-05", currency="USD"}: 0.000000
oci/cost/service/amount{source="test-tenancy-name", name="Email Delivery", usage_period="2024-05", currency="USD"}: 0.000000
oci/cost/service/amount{source="test-tenancy-name", name="Load Balancer", usage_period="2024-05", currency="USD"}: 9.151200
oci/cost/tenancy/amount{source="test-tenancy-name", usage_period="2024-06", currency="USD"}: 95.201271
oci/cost/tenancy/amount_forecast{source="test-tenancy-name", usage_period="2024-06", currency="USD"}: 482.678070
oci/cost/service/amount{source="test-tenancy-name", name="Oracle Web Application Firewall (WAF)", usage_period="2024-06", currency="USD"}: 0.000000
oci/cost/service/amount{source="test-tenancy-name", name="Logging", usage_period="2024-06", currency="USD"}: 0.000000
oci/cost/service/amount_forecast{source="test-tenancy-name", name="Logging", usage_period="2024-06", currency="USD"}: 0.054896
oci/cost/service/amount{source="test-tenancy-name", name="Block Storage", usage_period="2024-06", currency="USD"}: 22.551472
oci/cost/service/amount_forecast{source="test-tenancy-name", name="Block Storage", usage_period="2024-06", currency="USD"}: 109.122414
oci/cost/service/amount{source="test-tenancy-name", name="Compute", usage_period="2024-06", currency="USD"}: 71.711464
oci/cost/service/amount_forecast{source="test-tenancy-name", name="Compute", usage_period="2024-06", currency="USD"}: 360.057587
oci/cost/service/amount{source="test-tenancy-name", name="Key Management - Shard 3", usage_period="2024-06", currency="USD"}: 0.000000
oci/cost/service/amount{source="test-tenancy-name", name="Email Delivery", usage_period="2024-06", currency="USD"}: 0.000000
oci/cost/service/amount{source="test-tenancy-name", name="Load Balancer", usage_period="2024-06", currency="USD"}: 0.000000
oci/cost/service/amount_forecast{source="test-tenancy-name", name="Load Balancer", usage_period="2024-06", currency="USD"}: 8.995570
oci/cost/service/amount{source="test-tenancy-name", name="Object Storage", usage_period="2024-06", currency="USD"}: 0.012934
oci/cost/service/amount_forecast{source="test-tenancy-name", name="Object Storage", usage_period="2024-06", currency="USD"}: 0.129186
oci/cost/service/amount{source="test-tenancy-name", name="Telemetry", usage_period="2024-06", currency="USD"}: 0.000000
oci/cost/service/amount{source="test-tenancy-name", name="Identity and Access Management Service", usage_period="2024-06", currency="USD"}: 0.925403
oci/cost/service/amount_forecast{source="test-tenancy-name", name="Identity and Access Management Service", usage_period="2024-06", currency="USD"}: 4.318420
oci/cost/service/amount{source="test-tenancy-name", name="Virtual Cloud Network", usage_period="2024-06", currency="USD"}: 0.000000
# Validate Configuration
oci-cost-analysis --run-conf /path/to/config/file.yaml --validate
# Testing
Run the plugin from the command line and get any emitted metrics on stdout
.
oci-cost-analysis --run-conf /path/to/config/file.yaml
# List the metrics and event emitted by a plugin configuration
oci-cost-analysis --metrics
oci-cost-analysis --events