/query:alertmanager-queryfrom query
Queries Prometheus AlertManager v2 API via curl for listing alerts, managing silences, and checking inhibition state. Includes fallback to vmalert when AlertManager is down.
Ships in query. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
Query Prometheus-compatible AlertManager HTTP API v2 directly via curl. Covers alert listing with filters, silence management (list, create, get, delete), and alert state inspection.
AlertManager runs as an in-cluster pod and may be unavailable (crashloop, DNS failure, not deployed). Always check connectivity first. When AlertManager is down, ask vmalert for the firing and pending alerts:
# Fallback: firing/pending alerts from vmalert
curl -q --config "${VM_CURL_CONFIG:-/dev/null}" -s \
"$VM_ALERT_URL/api/v1/alerts" | jq '.data.alerts[]'
$VM_METRICS_URL/api/v1/alerts gives the same list only when VictoriaMetrics runs with -vmalert.proxyURL. Without that flag it answers with an empty list.
AlertManager provides what VM alerts cannot: silences, inhibition state, and alert routing.
# $VM_ALERTMANAGER_URL - base URL
# Example: export VM_ALERTMANAGER_URL="https://alertmanager.example.com"
# Example: export VM_ALERTMANAGER_URL="http://localhost:9093"
# $VM_ALERT_URL - vmalert base URL, for the fallback
# Example: export VM_ALERT_URL="http://localhost:8880"
# $VM_CURL_CONFIG - curl config file with auth header (unset if no auth is required)
# With auth: export VM_CURL_CONFIG="$HOME/.config/victoriametrics/curl.conf"
# No auth: leave unset (defaults to /dev/null)
All curl commands load auth from a curl config file:
curl -q --config "${VM_CURL_CONFIG:-/dev/null}" -s "$VM_ALERTMANAGER_URL/api/v2/alerts" | jq .
When VM_CURL_CONFIG is unset, curl reads /dev/null and sends no auth header. When set, it must point to a mode-0600 curl config file containing header = "Authorization: Bearer <token>". Never print its contents.
# All alerts (active, silenced, inhibited)
curl -q --config "${VM_CURL_CONFIG:-/dev/null}" -s \
"$VM_ALERTMANAGER_URL/api/v2/alerts" | jq .
# Only active (not silenced, not inhibited)
curl -q --config "${VM_CURL_CONFIG:-/dev/null}" -s \
"$VM_ALERTMANAGER_URL/api/v2/alerts?active=true&silenced=false&inhibited=false" | jq .
# Filter by label matcher (URL-encode the matcher)
curl -q --config "${VM_CURL_CONFIG:-/dev/null}" -s -G \
--data-urlencode 'filter=alertname="HighMemory"' \
"$VM_ALERTMANAGER_URL/api/v2/alerts" | jq .
# Filter by receiver
curl -q --config "${VM_CURL_CONFIG:-/dev/null}" -s \
"$VM_ALERTMANAGER_URL/api/v2/alerts?receiver=slack-critical" | jq .
Parameters: active (bool, default true), silenced (bool, default true), inhibited (bool, default true), unprocessed (bool, default true), filter (string array, matcher expressions), receiver (string regex)
The list holds only alerts that have not resolved. An alert leaves it once it resolves, so an empty list does not mean the alert never reached AlertManager. For past alerts, read ALERTS, which vmalert writes to VictoriaMetrics when it runs with -remoteWrite.url:
# When did HighMemory fire in the last 30 minutes (first and last firing evaluation)
curl -q --config "${VM_CURL_CONFIG:-/dev/null}" -s \
--data-urlencode 'query=ALERTS{alertname="HighMemory", alertstate="firing"}[30m]' \
"$VM_METRICS_URL/api/v1/query" | jq -r '.data.result[] | "\(.values[0][0] | todate) .. \(.values[-1][0] | todate)"'
# All silences
curl -q --config "${VM_CURL_CONFIG:-/dev/null}" -s \
"$VM_ALERTMANAGER_URL/api/v2/silences" | jq .
# Filter silences by matcher
curl -q --config "${VM_CURL_CONFIG:-/dev/null}" -s -G \
--data-urlencode 'filter=alertname="HighMemory"' \
"$VM_ALERTMANAGER_URL/api/v2/silences" | jq .
Parameters: filter (string array, matcher expressions)
# Note: singular "silence" in path (not "silences")
curl -q --config "${VM_CURL_CONFIG:-/dev/null}" -s \
"$VM_ALERTMANAGER_URL/api/v2/silence/{silenceID}" | jq .
Replace {silenceID} with the UUID.
curl -q --config "${VM_CURL_CONFIG:-/dev/null}" -s \
-X POST -H "Content-Type: application/json" \
-d '{
"matchers": [
{"name": "alertname", "value": "HighMemory", "isRegex": false, "isEqual": true}
],
"startsAt": "2026-03-07T00:00:00Z",
"endsAt": "2026-03-08T00:00:00Z",
"createdBy": "claude",
"comment": "Maintenance window"
}' \
"$VM_ALERTMANAGER_URL/api/v2/silences" | jq .
Returns {"silenceID": "uuid-here"}. Matcher fields: name (label name), value (match value), isRegex (bool), isEqual (bool — false for negative match). Times in RFC3339.
# Note: singular "silence" in path
curl -q --config "${VM_CURL_CONFIG:-/dev/null}" -s \
-X DELETE \
"$VM_ALERTMANAGER_URL/api/v2/silence/{silenceID}"
Replace {silenceID} with the UUID. Returns empty body on success.
All timestamps use RFC3339 format: 2026-03-07T00:00:00Z
# Count alerts by state
... | jq 'group_by(.status.state) | map({state: .[0].status.state, count: length})'
# List alert names and states
... | jq '.[] | {alertname: .labels.alertname, state: .status.state, severity: .labels.severity}'
# Active silences only (not expired)
... | jq '[.[] | select(.status.state == "active")]'
# Silence details (ID, matchers, expiry)
... | jq '.[] | {id: .id, matchers: [.matchers[] | "\(.name)=\(.value)"], endsAt: .endsAt, createdBy: .createdBy}'
# Quick connectivity check: 200 = up, 401 or 403 = auth problem, 000 = no HTTP response (host down, DNS, TLS or timeout)
curl -q --config "${VM_CURL_CONFIG:-/dev/null}" -s -o /dev/null -w "%{http_code}\n" \
"$VM_ALERTMANAGER_URL/api/v2/alerts"
# Count firing alerts
curl -q --config "${VM_CURL_CONFIG:-/dev/null}" -s \
"$VM_ALERTMANAGER_URL/api/v2/alerts?active=true&silenced=false&inhibited=false" | jq 'length'
# Silence an alert for 2 hours from now
curl -q --config "${VM_CURL_CONFIG:-/dev/null}" -s \
-X POST -H "Content-Type: application/json" \
-d "$(jq -n --arg alert "AlertName" --arg reason "Investigation in progress" \
'{matchers: [{name: "alertname", value: $alert, isRegex: false, isEqual: true}],
startsAt: (now | todate), endsAt: (now + 7200 | todate), createdBy: "claude", comment: $reason}')" \
"$VM_ALERTMANAGER_URL/api/v2/silences" | jq .
# Check if a specific alert is silenced (an inhibited alert is also "suppressed", so read silencedBy)
curl -q --config "${VM_CURL_CONFIG:-/dev/null}" -s -G \
--data-urlencode 'filter=alertname="TargetAlert"' \
"$VM_ALERTMANAGER_URL/api/v2/alerts" | jq '[.[] | select(.status.silencedBy | length > 0)] | length'
# Check current environment
echo "VM_ALERTMANAGER_URL: $VM_ALERTMANAGER_URL"
echo "VM_CURL_CONFIG: ${VM_CURL_CONFIG:-(unset - no auth)}"
/api/v2/silences for list/create, singular /api/v2/silence/{id} for get/deleteid. If the matchers change, AlertManager expires the old silence and returns a new ID: use the new one from then onContent-Type: application/jsonfilter parameter uses PromQL-style matchers: alertname="Foo", severity=~"critical|warning"$VM_ALERT_URL/api/v1/alertsreferences/api-reference.mdWhat SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
4 skills in this plugin
/victorialogs-queryQuery VictoriaLogs via curl. Use when searching logs with LogsQL, running log stats queries, discovering log fields/streams, analyzing log hit patterns, or exploring log facets. Triggers on: log queries, LogsQL, log search, log stats, field discovery, stream discovery, log facets, log hits, log field values.
/victoriametrics-queryQuery VictoriaMetrics metrics via curl. Use when running PromQL/MetricsQL queries, discovering metrics/labels, checking alerts and rules, inspecting TSDB status, exporting raw data, checking metric usage statistics, or debugging relabeling/downsampling/retention configs. Triggers on: metric queries, PromQL, MetricsQL, label discovery, series exploration, cardinality checks, alert status, recording rules, active/top queries, export data, metric statistics, relabel debug, downsampling debug, retention debug, flags.
/victoriatraces-querynpx claudepluginhub victoriametrics/skills --plugin queryOther plugins' skills for the same job