mcpField
O
oodle-cli

oodle-cli

github.com/oodle-aiCloud & DevOps0124 installsUpdated 3w ago
Repository

About oodle-cli

oodle-cli is an agent skill for using the `oodle` CLI safely across its subcommands. It covers resource discovery, authentication, time formats, output handling, and command sequencing.

Key features

  1. 01Discover resources before acting
  2. 02Set up authentication
  3. 03Choose JSON, table, or YAML output
  4. 04Use time flags and file inputs
  5. 05Handle retries and destructive actions

Use cases

  1. 01Find and inspect monitoring resources
  2. 02Query logs, metrics, and traces
  3. 03Create or update dashboards and monitors
  4. 04Run CLI operations in CI

Install

Copy the command and run it in a terminal.

$npx skills add https://github.com/oodle-ai/agent-skills --skill oodle-cli

After installing, type/oodle-cliin Claude Code to confirm it loaded.

Details

From the project README

Oodle CLI — Core Usage

This skill teaches the agent to invoke the oodle CLI safely, with the right flags, time formats, and authentication for any subcommand.

Prerequisites

Install the CLI before running any other command in this repo:

# Install via Homebrew (macOS / Linux)
brew install oodle-ai/oodle/oodle

# Or via Go (any platform with Go 1.25+)
go install github.com/oodle-ai/oodle-cli/cmd/oodle@latest

# Configure auth (interactive — writes ~/.oodle/config.yaml)
oodle configure

# Or set env vars (preferred for CI / containers)
export OODLE_API_KEY=<your-api-key>
export OODLE_INSTANCE=<your-instance-id>
export OODLE_DEPLOYMENT=<your-deployment-url>   # e.g. https://app.oodle.ai

Verify the CLI works before issuing any other command:

oodle version
oodle monitors list -o json | head

Command Execution Order

Before running any oodle command:

  1. Check whether the required resource ID or name is already in context.
  2. If not, run the discovery command (e.g., oodle <resource> list -o json).
  3. If the result is ambiguous, ask the user to confirm before proceeding.
  4. Run the target command with the resolved ID.
  5. Do not run speculative commands (e.g., do not delete without first get-ing the resource).

Quick Reference

CommandPurpose
oodle monitorsManage metric monitors
oodle dashboardsManage dashboards
oodle foldersManage dashboard folders
oodle notifiersManage notification channels
oodle notification-policiesManage routing of alerts to notifiers
oodle muting-rulesSilence alerts during maintenance
oodle metrics queryRun PromQL instant query
oodle metrics query-rangeRun PromQL range query
oodle logs index-patternsList available log index patterns
oodle logs querySearch logs using OpenSearch Query DSL
oodle metricsQuery metric names, labels, label values
oodle tracesSearch and fetch traces
oodle traces traceql search / metricsFind traces, or compute rates, counts, and quantiles, with TraceQL (see the oodle-traces skill)
oodle log-metricsManage log-derived metric rules
oodle synthetic-monitorsManage HTTP/TCP synthetic checks
oodle drop-rulesManage metric drop rules
oodle api-keysManage API keys
oodle usersManage users
oodle configureInteractive auth setup
oodle skillsInstall and manage agent skills (this repo)

Common Operations

Output formats

-o selects the output format. Default is table (human-readable). Use json whenever a result is consumed by another tool.

# ✅ CORRECT — JSON for scripting; jq can parse it
oodle monitors list -o json | jq '.[].id'

# ✅ CORRECT — table for humans skimming a list
oodle monitors list -o table

# ✅ CORRECT — yaml when round-tripping into a `-f` input file
oodle monitors get mon_123 -o yaml > monitor.yaml

# ✅ CORRECT — csv for spreadsheets / quick grep
oodle metrics names -o csv

# ❌ WRONG — parsing the default table format with awk/grep is fragile
oodle monitors list | awk '{print $1}'
Non-interactive flags
# ✅ CORRECT — --force skips destructive-action confirmation in CI
oodle monitors delete mon_123 --force

# ❌ WRONG — running a destructive command without --force in a non-TTY pipeline
oodle monitors delete mon_123
Retries on transient failures
# ✅ CORRECT — retry transient 5xx / network errors up to 3 times
oodle monitors list -o json --retries 3

# ❌ WRONG — wrapping the command in a custom shell loop instead of using --retries
until oodle monitors list -o json; do sleep 5; done
Time flags

--start, --end, and --time accept these formats (there is no --from or --to flag):

FormatExampleMeaning
Epoch seconds1731628800absolute unix timestamp (ms, µs, and ns are also accepted)
RFC 33392026-10-07T10:00:00Zabsolute time
nownowcurrent server time
Relative duration-1h, -30m, -7dnow minus the duration

Most commands default to --start -1h --end now. oodle traces list and oodle traces get require both flags.

# ✅ CORRECT — relative duration is timezone-safe and readable
oodle traces list --service api --start -1h --end now -o json

# ✅ CORRECT — epoch when the caller has an exact timestamp
oodle traces list --service api --start 1731628800 --end 1731632400 -o json

# ❌ WRONG — human strings are not parsed
oodle traces list --service api --start "1 hour ago" --end now
File input (-f)

create and update commands accept -f <file> and detect JSON or YAML from the file extension or the leading byte.

# ✅ CORRECT — JSON file
oodle monitors create -f monitor.json

# ✅ CORRECT — YAML file
oodle monitors create -f monitor.yaml

# ✅ CORRECT — round-trip through yaml for in-place edits
oodle monitors get mon_123 -o yaml > monitor.yaml
$EDITOR monitor.yaml
oodle monitors update mon_123 -f monitor.yaml

# ❌ WRONG — passing JSON inline as a flag value (no -f)
oodle monitors create --body '{"name":"x"}'

Best Practices

Use -o json whenever output is consumed by another tool

If the next step in the workflow is a jq filter, a script, or another oodle command, request JSON. Table output is for humans only.

# ✅ CORRECT
ID=$(oodle monitors list -o json | jq -r '.[] | select(.name=="High CPU") | .id')

# ❌ WRONG — column positions in table output can change between releases
ID=$(oodle monitors list | grep "High CPU" | awk '{print $1}')
Use --force in CI, never in interactive sessions you don't own

--force skips the destructive-action confirmation prompt. Always pair it with a prior get for safety.

# ✅ CORRECT — in CI: confirm the resource exists, then delete
oodle monitors get mon_123 -o json > /dev/null && oodle monitors delete mon_123 --force

# ❌ WRONG — blanket --force on a name match without verifying the ID
oodle monitors delete $(oodle monitors list | grep CPU | head -1 | awk '{print $1}') --force
Use environment variables for credentials in CI

Never hardcode the API key or write it into shell history.

# ✅ CORRECT — credentials come from the CI secret store
export OODLE_API_KEY="$CI_OODLE_API_KEY"
export OODLE_INSTANCE="$CI_OODLE_INSTANCE"
oodle monitors list -o json

# ❌ WRONG — credential in plain text on the command line
OODLE_API_KEY=sk_live_abc123 oodle monitors list -o json
Pin command sequences to discovered IDs

When a workflow modifies a resource, capture the ID once and reuse it.

# ✅ CORRECT
ID=$(oodle monitors list -o json | jq -r '.[] | select(.name=="High CPU") | .id')
oodle monitors get "$ID" -o json
oodle monitors update "$ID" -f monitor.json

# ❌ WRONG — re-resolving the name on every step (race conditions, extra latency)
oodle monitors get $(oodle monitors list -o json | jq -r '.[] | select(.name=="High CPU") | .id')
oodle monitors update $(oodle monitors list -o json | jq -r '.[] | select(.name=="High CPU") | .id') -f monitor.json

Failure Handling

ErrorCauseFix
401 UnauthorizedInvalid or missing API keyRun oodle configure or set OODLE_API_KEY
404 Not FoundResource ID does not existVerify with oodle <resource> list -o json
connection refusedWrong OODLE_DEPLOYMENT URLCheck OODLE_DEPLOYMENT env var, ensure no trailing slash, confirm network egress
429 Too Many RequestsRate limitedAdd --retries 3, back off 5–10s, batch fewer requests per minute
unknown commandCLI version too oldUpgrade with brew upgrade oodle or go install ...@latest
error parsing -f fileFile is not valid JSON/YAMLValidate with python3 -m json.tool or yq . before retrying

References

Comments

Markdown supported