Complete guide to getting started with FinOpsMetrics
FinOpsMetrics is an Enterprise FinOps platform designed for AI/ML cost observability and optimization. It provides comprehensive visibility into your cloud and AI infrastructure spending with real-time dashboards, intelligent recommendations, and multi-cloud support.
FinOpsMetrics can be installed via pip, from source, or using Docker. The package supports Python 3.8 and above.
pip install finopsmetrics
# Install with all cloud providers and features
pip install finopsmetrics[all]
# Or install specific integrations
pip install finopsmetrics[aws]
pip install finopsmetrics[azure]
pip install finopsmetrics[gcp]
pip install finopsmetrics
Note: For Web UI functionality, ensure you have flask-socketio and eventlet installed. These are included in the base installation.
Get up and running with FinOpsMetrics in under 5 minutes. This guide will show you how to launch the Web UI and start monitoring your costs.
# Using the CLI
finopsmetrics server --host 127.0.0.1 --port 8080
# Or using Python
python -m finopsmetrics server
Open your browser and navigate to:
http://localhost:8080/
http://localhost:8080/dashboard/cfo
http://localhost:8080/dashboard/coo
http://localhost:8080/dashboard/infrastructure
Important: FinOpsMetrics uses agents that automatically discover resources and calculate costs.
from agents.aws_telemetry_agent import AWSTelemetryAgent
# Initialize AWS agent
agent = AWSTelemetryAgent(
finopsmetrics_endpoint="http://localhost:8080",
aws_region="us-west-2"
)
# Register and run
if agent.register_agent():
print("✓ Agent registered")
# Collects metrics every 5 minutes
agent.run_continuous(interval_seconds=300)
The Web UI provides beautiful, real-time dashboards with WebSocket-based live updates. All dashboards feature glassmorphism design, Chart.js visualizations, and responsive layouts.
from finopsmetrics.webui import start_server
# Start with custom configuration
start_server(
host='0.0.0.0',
port=8080,
debug=False
)
The Observability Hub receives and processes telemetry data from agents. Note: You don't call these methods directly - agents call them automatically.
Agent-Based Design: Deploy telemetry agents in your cloud accounts. Agents automatically discover resources, collect metrics, calculate costs, and send to the ObservabilityHub server.
from finopsmetrics import ObservabilityHub
from finopsmetrics.observability.cost_observatory import CostObservatory
# Initialize (server-side)
hub = ObservabilityHub()
cost_obs = CostObservatory()
# Query cluster health (populated by agents)
health = hub.get_cluster_health_summary()
for cluster_id, metrics in health.items():
print(f"{cluster_id}: {metrics['health_status']}")
# Query costs (populated by agents)
summary = cost_obs.get_cost_summary(time_range_hours=24)
print(f"Total 24h cost: ${summary['total_cost']:.2f}")
FinOpsMetrics provides role-based dashboards tailored for different stakeholders in your organization.
from finopsmetrics.dashboard import CFODashboard
# Initialize CFO dashboard
cfo_dash = CFODashboard()
# Generate financial report
report = cfo_dash.generate_financial_report()
print(report.total_spend)
print(report.roi_analysis)
print(report.budget_status)
from finopsmetrics.dashboard import InfrastructureLeaderDashboard
# Initialize infrastructure dashboard
infra_dash = InfrastructureLeaderDashboard()
# Get resource utilization
utilization = infra_dash.get_resource_utilization()
print(f"CPU: {utilization.cpu_percent}%")
print(f"Memory: {utilization.memory_percent}%")
Deploy telemetry agents as separate processes to automatically collect metrics and costs.
# deploy_aws_agent.py
from agents.aws_telemetry_agent import AWSTelemetryAgent
# Initialize agent (uses boto3 credential chain)
agent = AWSTelemetryAgent(
finopsmetrics_endpoint="http://localhost:8080",
aws_region="us-west-2"
)
# Register with server
if agent.register_agent():
print("✓ Agent registered")
# Run continuous collection (every 5 minutes)
# Agent automatically:
# - Discovers EC2, EKS, Lambda, RDS, S3
# - Queries CloudWatch for metrics
# - Calculates costs from instance types
# - Sends to FinOpsMetrics server
agent.run_continuous(interval_seconds=300)
# Azure agent
from agents.azure_telemetry_agent import AzureTelemetryAgent
agent = AzureTelemetryAgent(
finopsmetrics_endpoint="http://localhost:8080",
subscription_id="your-subscription-id"
)
agent.register_agent()
agent.run_continuous(interval_seconds=300)
# GCP agent
from agents.gcp_telemetry_agent import GCPTelemetryAgent
agent = GCPTelemetryAgent(
finopsmetrics_endpoint="http://localhost:8080",
project_id="your-project-id"
)
agent.register_agent()
agent.run_continuous(interval_seconds=300)
Security Note: Always use IAM roles with minimal permissions when deploying telemetry agents. Never hardcode credentials.
FinOpsMetrics provides specialized agents for data platforms like Databricks and Snowflake, with automatic cost calculation based on DBUs, credits, and storage usage.
Track Databricks DBU consumption, cluster costs, job execution, and SQL warehouse usage.
# Install Databricks SDK
pip install databricks-sdk requests
# Set credentials
export DATABRICKS_HOST=https://your-workspace.cloud.databricks.com
export DATABRICKS_TOKEN=dapi***
# Run agent
python agents/databricks_telemetry_agent.py \
--finopsmetrics-endpoint http://localhost:8080 \
--databricks-host $DATABRICKS_HOST \
--databricks-token $DATABRICKS_TOKEN \
--interval 300
Databricks Pricing:
Monitor Snowflake credit consumption, warehouse usage, storage, and query patterns.
# Install Snowflake connector
pip install snowflake-connector-python requests
# Set credentials
export SNOWFLAKE_USER=your_user
export SNOWFLAKE_PASSWORD=your_password
# Run agent
python agents/snowflake_telemetry_agent.py \
--finopsmetrics-endpoint http://localhost:8080 \
--snowflake-account xy12345.us-east-1 \
--snowflake-warehouse COMPUTE_WH \
--edition enterprise \
--interval 300
Snowflake Editions:
Track costs from popular SaaS services including MongoDB Atlas, Redis Cloud, GitHub Actions, DataDog, and more.
The SaaS services agent can monitor multiple services from a single configuration.
# Create sample configuration
python agents/saas_services_telemetry_agent.py \
--create-config saas_config.json
# Run agent
python agents/saas_services_telemetry_agent.py \
--finopsmetrics-endpoint http://localhost:8080 \
--config saas_config.json \
--interval 3600
{
"mongodb_atlas": {
"enabled": true,
"public_key": "your_public_key",
"private_key": "your_private_key",
"project_id": "your_project_id"
},
"redis_cloud": {
"enabled": true,
"api_key": "your_api_key",
"secret_key": "your_secret_key",
"account_id": "your_account_id"
},
"github_actions": {
"enabled": true,
"token": "ghp_your_token",
"org_name": "your_org"
},
"datadog": {
"enabled": true,
"api_key": "your_api_key",
"app_key": "your_app_key"
}
}
Supported SaaS Services (v0.3.0):
✅ All integrations are fully functional! Configure any combination of services in your saas_services_config.json
file.
NEW IN v0.2.1
FinOpsMetrics supports persistent storage for telemetry data, enabling historical analysis and long-term trend identification. Choose from multiple storage backends based on your needs.
from finopsmetrics.observability import ObservabilityHub, CostObservatory
from finopsmetrics.observability.persistence import PersistenceConfig, StorageBackend
# Configure SQLite persistence
config = PersistenceConfig(
backend=StorageBackend.SQLITE,
connection_string="sqlite:///finopsmetrics.db",
retention_days=90 # Keep 90 days of history
)
# Initialize with persistence
hub = ObservabilityHub(persistence_config=config)
cost_obs = CostObservatory(persistence_config=config)
# Data now persists across restarts
from finopsmetrics.observability.persistence import PersistenceConfig, StorageBackend
# Configure TimescaleDB with compression
config = PersistenceConfig(
backend=StorageBackend.TIMESCALEDB,
connection_string="postgresql://user:pass@localhost:5432/finopsmetrics",
retention_days=365, # 1 year of history
enable_compression=True # Enables automatic compression
)
hub = ObservabilityHub(persistence_config=config)
cost_obs = CostObservatory(persistence_config=config)
Query historical metrics to analyze trends and patterns over time.
import time
# Query last 30 days of metrics
thirty_days_ago = time.time() - (30 * 24 * 3600)
metrics = hub.query_historical_metrics(
start_time=thirty_days_ago,
cluster_id="production",
limit=10000
)
# Query historical cost data
costs = cost_obs.query_historical_costs(
start_time=thirty_days_ago,
category="compute"
)
# Calculate total cost
total = sum(entry['amount'] for entry in costs)
print(f"30-day compute cost: ${total:.2f}")
Command-line utilities for database management:
# Initialize database
finopsmetrics database init --backend sqlite
# View statistics
finopsmetrics database stats --backend sqlite \
--connection-string "sqlite:///finopsmetrics.db"
# Query recent data
finopsmetrics database query --backend sqlite \
--connection-string "sqlite:///finopsmetrics.db" --days 7
# Cleanup old data
finopsmetrics database cleanup --retention-days 90
# With PostgreSQL support
pip install finopsmetrics[postgres]
# With all features
pip install finopsmetrics[all]
NEW IN v0.2.1
FinOpsMetrics features a powerful plugin system that enables unlimited extensibility without modifying core code. Create custom plugins for telemetry collection, cost attribution, recommendations, dashboards, and more.
FinOpsMetrics supports 7 plugin types:
from finopsmetrics.plugins import TelemetryPlugin, PluginMetadata, PluginType
class MyCloudPlugin(TelemetryPlugin):
@property
def metadata(self):
return PluginMetadata(
name="my-cloud-plugin",
version="1.0.0",
author="Your Name",
description="Collect costs from My Cloud Provider",
plugin_type=PluginType.TELEMETRY
)
def initialize(self):
# Get configuration
self.api_key = self.get_config_value("api_key", required=True)
self.endpoint = self.get_config_value("endpoint")
# Initialize cloud client
def collect_telemetry(self):
# Collect and return cost data
return [
{
"service": "compute",
"resource_id": "vm-12345",
"cost": 125.50,
"timestamp": time.time()
}
]
def shutdown(self):
# Cleanup resources
pass
from finopsmetrics.plugins import registry
# Register your plugin
registry.register(MyCloudPlugin)
# Load with configuration
plugin = registry.load_plugin("my-cloud-plugin", config={
"api_key": "your-api-key",
"endpoint": "https://api.mycloud.com"
})
# Use the plugin
data = plugin.collect_telemetry()
# Unload when done
registry.unload_plugin("my-cloud-plugin")
FinOpsMetrics provides decorators for common patterns:
from finopsmetrics.plugins.decorators import retry, cache_result, rate_limit
class MyPlugin(TelemetryPlugin):
@retry(max_attempts=3, delay=1.0)
def fetch_data_with_retry(self):
# Automatically retries on failure
pass
@cache_result(ttl=300) # Cache for 5 minutes
def get_expensive_data(self):
# Result is cached
pass
@rate_limit(max_calls=10, period=60) # 10 calls per minute
def api_call(self):
# Rate limited
pass
Plugins can be distributed via PyPI for easy installation. Add the following
entry point to your setup.py
:
setup(
name="finopsmetrics-mycloud-plugin",
version="1.0.0",
entry_points={
"finopsmetrics.plugins": [
"mycloud = mycloud_plugin:MyCloudPlugin"
]
}
)
💡 Plugin Development Guide: For complete plugin development documentation, examples, and best practices, contact our support team at finops@infinidatum.net for the detailed Plugin Architecture Guide.
FinOpsMetrics can be configured via environment variables, configuration files, or programmatically.
export OPENFINOPS_HOST=0.0.0.0
export OPENFINOPS_PORT=8080
export OPENFINOPS_DEBUG=false
# Cloud provider credentials
export AWS_ACCESS_KEY_ID=your_key
export AWS_SECRET_ACCESS_KEY=your_secret
export AZURE_SUBSCRIPTION_ID=your_sub_id
export GCP_PROJECT_ID=your_project
# config.yaml
server:
host: 0.0.0.0
port: 8080
debug: false
observability:
update_interval: 5
retention_days: 90
alerts:
budget_threshold: 10000
anomaly_detection: true
notification_channels:
- email
- webhook