From gcx
Manages Grafana SLO definitions: create, update, pull, push via GitOps, delete using gcx CLI. Use for SLO lifecycle tasks excluding health checks or investigations.
npx claudepluginhub grafana/gcx --plugin gcxThis skill is limited to using the following tools:
Create, update, sync, and delete SLO definitions using gcx.
Checks SLO health, budgets, burn rates, and trends using gcx CLI commands. Displays overviews of all SLOs, specific status, timelines, and graphs for Grafana Cloud.
Establishes SLOs, SLIs, SLAs with error budget tracking, burn rate alerts, and reporting using Prometheus, Sloth, or Pyrra. For defining reliability targets in customer-facing services and SRE practices.
Defines and implements SLIs, SLOs, and error budgets for service reliability using PromQL queries and YAML configs. Useful for availability, latency SLIs, targets, and alerting.
Share bugs, ideas, or general feedback.
Create, update, sync, and delete SLO definitions using gcx.
--dry-run before any push operation; proceed only if dry-run succeeds-o json for agent processing; default table/yaml for user displaySelect query type based on what the user describes:
| User describes | Query type |
|---|---|
| "percentage of successful requests", "success rate", "error rate" | ratio |
| "raw PromQL expression", "custom metric formula" | freeform |
| "metric above/below threshold", "latency under X ms", "availability percentage" | threshold |
Use the metric name suffix to pick the query type when the user provides a metric name:
| Metric suffix / type | Query type | Rationale |
|---|---|---|
_total counter | ratio | success_total / all_total |
_bucket histogram | threshold | use le-bound threshold on quantile |
_gauge or up metric | threshold | compare to fixed threshold |
| None of the above | freeform | last resort only |
Guardrail: Freeform is a last resort. Before choosing freeform, verify the SLI cannot be expressed as ratio or threshold.
Hard requirement: Freeform queries MUST use $__rate_interval in all rate()/increase() calls. Literal ranges like [5m] are rejected by the SLO API.
gcx datasources list --type prometheus
Use the UID from the output. If multiple Prometheus datasources exist, ask the user which to use.
See references/slo-templates.md for complete templates. Key structure:
apiVersion: slo.ext.grafana.app/v1alpha1
kind: SLO
metadata:
name: "" # leave empty for new SLO (server assigns UUID on create)
spec:
name: "my-api-availability"
description: "API availability over 28 days"
query:
type: ratio # freeform | ratio | threshold
ratio: # field matches type
successMetric:
prometheusMetric: http_requests_total{status!~"5.."}
totalMetric:
prometheusMetric: http_requests_total
groupByLabels: [cluster, service]
objectives:
- value: 0.999 # 0.9 to 0.9999 typical range
window: 28d # 7d | 14d | 28d | 30d
destinationDatasource:
uid: <prometheus-uid>
gcx slo definitions push slo.yaml --dry-run
gcx slo definitions push slo.yaml
Push semantics:
metadata.name empty → always creates (server assigns UUID)metadata.name set to UUID → upsert (updates if exists, creates if not)After creation, server assigns UUID. Run gcx slo definitions list to confirm.
gcx slo definitions get <UUID> -o yaml > slo.yaml
Edit the relevant fields (objective value, query, alerting, etc.).
Do not modify metadata.name (UUID) or readOnly fields.
gcx slo definitions push slo.yaml --dry-run
gcx slo definitions push slo.yaml
gcx slo definitions pull -d ./slos
# Writes to ./slos/SLO/<uuid>.yaml
gcx slo definitions push ./slos/SLO/*.yaml --dry-run
gcx slo definitions push ./slos/SLO/*.yaml
gcx slo definitions list
gcx slo definitions get <UUID>
Confirm the UUID and name with the user before deletion.
gcx slo definitions delete <UUID> -f
Use -f to skip confirmation prompt when running in agent mode.
Objective values (stored as 0–1, displayed as percentage):
Window options: 7d, 14d, 28d, 30d
Alerting best practices:
fastBurn: Pages on-call (high burn rate, short window — catches rapid budget consumption)slowBurn: Creates tickets (low burn rate, long window — catches gradual degradation)Labels: Use consistent label keys (team, service, environment, tier) for filtering and grouping.
GroupByLabels (ratio/threshold queries): Add labels like cluster, service, endpoint for dimensional breakdown in status and investigation.
After create/update:
SLO: <name>
UUID: <uuid>
Status: Created | Updated
Objective: <value>% over <window>
Datasource: <uid>
After pull:
Pulled <N> SLO definitions to <dir>/SLO/
After delete:
Deleted: <uuid> (<name>)
destinationDatasource.uid is validmetadata.name not found; check with gcx slo definitions listgcx config view for active contextgcx slo definitions list