Skip to content

openobserve/o2-cli

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

9 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

O2 CLI - OpenObserve Command Line Interface

Enterprise-Grade CLI for OpenObserve Management

Version: 1.1.3 | Status: Production-Ready βœ…

⚠️ Requires OpenObserve Enterprise - O2 CLI only works with OpenObserve Enterprise edition.


πŸ“‹ Table of Contents


🎯 Overview

O2 CLI is a command-line interface for managing OpenObserve resources directly, similar to AWS CLI or kubectl. It provides an imperative way to manage OpenObserve alongside the declarative Kubernetes Operator.

⚠️ Enterprise Requirement: O2 CLI requires OpenObserve Enterprise edition. It will not work with the community version. For Enterprise access, visit openobserve.ai/pricing.

Why O2 CLI?

  • βœ… Direct management without Kubernetes
  • βœ… Quick ad-hoc operations
  • βœ… Multi-environment support
  • βœ… Scripting and automation
  • βœ… Resource querying and export

✨ Features

Resource Management

  • βœ… 6 Resources with Full CRUD: Dashboards, Templates, Destinations, Pipelines, Functions, Alerts
  • βœ… 7 Resources Queryable: Including Organizations
  • βœ… Simple YAML Format: No Kubernetes wrapper needed (for most resources)

Enterprise Capabilities

  • βœ… Multi-Environment: Unlimited profiles (dev, staging, prod)
  • βœ… Multi-Tenant: Query across 21+ organizations
  • βœ… 4 Output Formats: table, JSON, YAML, wide
  • βœ… 2 Command Syntaxes: kubectl-style + resource-first

Advanced Features

  • βœ… Auto-detection of YAML format (simple vs full K8s)
  • βœ… Flexible delete/update (by name or from file)
  • βœ… Auto-defaults for missing fields
  • βœ… Filtering (folder, type, enabled-only)
  • βœ… Organization override

πŸ“¦ Installation

Quick Install (macOS/Linux)

curl -fsSL https://raw.githubusercontent.com/openobserve/o2-cli/main/install.sh | bash

Homebrew (Recommended)

brew tap openobserve/tap
brew install o2

Download Binary Directly

# macOS Apple Silicon
curl -L https://github.com/openobserve/o2-cli/releases/latest/download/o2-darwin-arm64.tar.gz | tar xz
sudo mv o2 /usr/local/bin/

# macOS Intel
curl -L https://github.com/openobserve/o2-cli/releases/latest/download/o2-darwin-amd64.tar.gz | tar xz
sudo mv o2 /usr/local/bin/

# Linux AMD64
curl -L https://github.com/openobserve/o2-cli/releases/latest/download/o2-linux-amd64.tar.gz | tar xz
sudo mv o2 /usr/local/bin/

πŸš€ Quick Start

Prerequisites

  • OpenObserve Enterprise instance
  • Valid credentials (username/password or API token)

1. Configure

# Setup default profile
o2 configure
# Enter: endpoint, organization, username, password

# Setup additional environments
o2 configure --profile dev
o2 configure --profile prod

Note: The CLI will validate your OpenObserve instance is Enterprise edition on first command.

2. List Resources

# List all organizations
o2 list organizations

# Get organization summary
o2 organization get default --summary

# List dashboards
o2 list dashboard --folder production

# List alerts
o2 list alert --folder default --enabled-only

3. Manage Resources

# Create a template
o2 create template -f slack-alert.yaml

# List templates
o2 list template

# Delete a template
o2 delete template old-template

βš™οΈ Configuration

Profile Management

Configure Multiple Environments:

o2 configure                    # Default profile
o2 configure --profile dev      # Dev environment
o2 configure --profile staging  # Staging environment
o2 configure --profile prod     # Production environment

List All Profiles:

o2 configure list

Config File Location: ~/.o2/config.yaml

Example Config:

profiles:
  default:
    endpoint: https://openobserve.company.com
    organization: default
    username: user@company.com
    password: your-password
  dev:
    endpoint: https://dev.openobserve.com
    organization: dev-org
    username: dev-user@company.com
    password: dev-password

πŸ“Š Resources

Full CRUD Operations:

Resource Create List Get Update Delete Samples
Organizations βœ… βœ… βœ… (+ summary) - - -
Dashboards βœ… βœ… βœ… βœ… βœ… (by ID) Operator samples
Templates βœ… βœ… βœ… βœ… βœ… 6 files
Destinations βœ… βœ… βœ… βœ… βœ… 3 files
Pipelines βœ… βœ… βœ… βœ… βœ… 2 files
Functions βœ… βœ… βœ… βœ… βœ… 5 files
Alerts βœ… βœ… βœ… βœ… βœ… 2 files

🎯 Command Syntaxes

O2 CLI supports TWO syntaxes - use whichever you prefer!

kubectl-Style (Verb-First)

o2 <verb> <resource> [name] [flags]

# Examples:
o2 list template
o2 get dashboard 123456
o2 create template -f template.yaml
o2 update pipeline -f pipeline.yaml
o2 delete function my-function

Resource-First

o2 <resource> <verb> [name] [flags]

# Examples:
o2 template list
o2 dashboard get 123456
o2 template create -f template.yaml
o2 pipeline update -f pipeline.yaml
o2 function delete my-function

Both syntaxes do the same thing!


πŸ’‘ Examples

Multi-Environment Workflow

# Create in dev
o2 create template -f alert.yaml --profile dev

# Test it
o2 list template --profile dev

# Export from dev
o2 get template MyAlert --profile dev -o yaml > tested.yaml

# Deploy to prod
o2 create template -f tested.yaml --profile prod

Cross-Organization Querying

# List all organizations
o2 list organizations

# Query different orgs
o2 list alert --org org1
o2 list dashboard --org org2 --folder monitoring
o2 list function --org org3

Backup and Restore

# Backup all templates
for t in $(o2 list template --output json | jq -r '.[].name'); do
  o2 get template $t -o yaml > backups/${t}.yaml
done

# Restore templates
for f in backups/*.yaml; do
  o2 create template -f $f
done

Resource Management

# Create destination
o2 create dest -f slack-webhook.yaml

# List HTTP destinations
o2 list dest --type http

# Update destination
o2 update dest -f updated-webhook.yaml

# Delete destination
o2 delete dest slack-webhook

πŸ“š Documentation

Core Documentation

  • COMMANDS.md - Complete command reference with syntax
  • README.md - This file

Sample Files

Located in samples/ directory:

  • templates/ - 6 alert template samples
  • destinations/ - 3 destination samples
  • pipelines/ - 2 pipeline samples
  • functions/ - 5 function samples
  • dashboards/ - 2 dashboard samples
  • alerts/ - 2 alert samples

Developer Documentation

Located in docs/ directory:

  • ARCHITECTURE.md - Technical architecture
  • IMPLEMENTATION_PLAN.md - Development roadmap
  • TESTING.md - Testing guide
  • PROFILES.md - Multi-environment setup
  • DISTRIBUTION.md - Packaging and distribution

πŸ”§ Global Flags

Available on all commands:

Flag Short Default Description
--profile default Use specific profile
--org From profile Override organization
--output -o table Output format: table, json, yaml, wide
--config ~/.o2/config.yaml Custom config file

🎯 Common Operations

Organizations

o2 organization list
o2 organization get default --summary
o2 organization create myorg --identifier myorg
o2 get organization myorg --summary

Templates

o2 create template -f template.yaml
o2 list template
o2 delete template MyTemplate

Destinations

o2 create dest -f destination.yaml
o2 list dest --type http
o2 delete dest my-destination

Dashboards

o2 create dashboard -f dashboard.yaml
o2 list dashboard --folder production
o2 delete dashboard 7417863561566760960  # Use ID from list

Pipelines

o2 create pipeline -f pipeline.yaml
o2 list pipeline
o2 delete pipeline my-pipeline

Functions

o2 create function -f function.yaml
o2 list function
o2 delete function my-function

Alerts

o2 create alert -f alert.yaml
o2 list alert --folder test_alerts --enabled-only
o2 get alert my-alert
o2 update alert -f updated-alert.yaml
o2 delete alert my-alert

🌍 Multi-Environment Usage

# Configure environments
o2 configure --profile dev
o2 configure --profile prod

# Use different environments
o2 list template --profile dev
o2 create template -f alert.yaml --profile prod
o2 list dashboard --profile staging --folder monitoring

πŸ“Š Statistics

What's Available:

  • Commands: 90+
  • Working: 60+
  • Full CRUD Resources: 6
  • Query Resources: 7
  • Sample Files: 18+
  • Organizations: 21+

πŸš€ Production Ready

O2 CLI is production-ready for:

  • Alert template management
  • Destination configuration
  • Pipeline lifecycle
  • Function management
  • Dashboard management
  • Resource querying and auditing
  • Multi-environment workflows
  • Backup and restore operations

πŸ”— Related Tools

Kubernetes Operator: For GitOps and declarative management

kubectl apply -f dashboard.yaml

O2 CLI: For direct management and scripting

o2 create dashboard -f dashboard.yaml

Use both together for complete OpenObserve management!


πŸ“– Getting Help

# General help
o2 --help

# Command help
o2 list --help
o2 create --help
o2 delete --help

# Resource-specific help
o2 template --help
o2 dashboard --help
o2 pipeline --help

πŸŽ‰ Success Stories

Manage OpenObserve like a pro:

  • Create and manage alert templates across environments
  • Configure destinations for Slack, PagerDuty, Email
  • Deploy pipelines for data routing
  • Manage VRL functions for data transformation
  • Query resources across 21+ organizations

For detailed command syntax, see COMMANDS.md

For samples, see samples/ directory

For advanced topics, see docs/ directory

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Packages

No packages published

Contributors 2

  •  
  •  

Languages