alertmanager-query
Skill2 starsChanged 27 days agoMITView on GitHub
Query AlertManager via curl using the v2 API. Use when listing active/silenced alerts, creating/managing silences, or checking alert inhibition state. Triggers on: alertmanager, silences, silence alerts, alert filters, alert inhibition, alertmanager API, create silence, delete silence.
1 other project uses a version of this, 1 of them edited.
Adopted by
Most recently taken up by
- SawanaLabs/agent-demosedited, first seen Oct 13, 2026
Other versions1 project uses a version of this.
Word for word · 0
None found.
Edited · 1
- SawanaLabs/agent-demos★ 476% same
Wrote their own version · 0
None found.
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository192 other files it gives its agents.
- clickhouse-architecture-advisor/AGENTS.mdAGENTS.md
- clickhouse-best-practices/AGENTS.mdAGENTS.md
- unsafe-checker/AGENTS.mdAGENTS.md
- analyzing-range-distributionSkill
- analyzing-schema-change-storage-riskSkill
- argocdSkill
- aspire-configurationSkill
- aspire-integration-testingSkill
- aspire-service-defaultsSkill
- auditing-cloud-cluster-securitySkill
- auditing-table-statisticsSkill
- benchmarking-transaction-patternsSkill
- cepthSkill
- chdb-datastoreSkill
- chdb-sqlSkill
- clickhouse-architecture-advisorSkill
- clickhouse-best-practicesSkill
- clickhousectl-cloud-deploySkill
- clickhousectl-local-devSkill
- cockroachdb-sqlSkill
- coding-guidelinesSkill
- configuring-audit-loggingSkill
- configuring-ip-allowlistsSkill
- configuring-log-exportSkill
- configuring-private-connectivitySkill
- configuring-sso-and-scimSkill
- create-technical-architecture-documentSkill
- csharp-mstestSkill
- csharp-tunitSkill
- csharp-xunitSkill
- designing-application-transactionsSkill
- designing-multi-region-applicationsSkill
- domain-cliSkill
- domain-cloud-nativeSkill
- domain-embeddedSkill
- domain-fintechSkill
- domain-iotSkill
- domain-mlSkill
- domain-webSkill
- dotnet-aot-wasmSkill
- dotnet-aspire-patternsSkill
- dotnet-benchmarkdotnetSkill
- dotnet-blazor-authSkill
- dotnet-blazor-componentsSkill
- dotnet-blazor-patternsSkill
- dotnet-blazor-testingSkill
- dotnet-channelsSkill
- dotnet-ci-benchmarkingSkill
- dotnet-cli-architectureSkill
- dotnet-cli-distributionSkill
- dotnet-cli-packagingSkill
- dotnet-cli-release-pipelineSkill
- dotnet-containersSkill
- dotnet-cryptographySkill
- dotnet-csharp-dependency-injectionSkill
- dotnet-csharp-modern-patternsSkill
- dotnet-csharp-nullable-reference-typesSkill
- dotnet-csharp-source-generatorsSkill
- dotnet-maui-doctorSkill
- dotnet-maui-doctorSkill
- The first 60 shown.
The file
We split this skill into the rules it gives an agent
4 rules. About 0 are common, 2 are distinctive, and 2 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈2
Distinctive · estimate
This author's own choices. Worth a look.
2
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 37
All curl commands use conditional auth:
- Very specific: line 43
When VM_AUTH_HEADER is empty, -H flag is omitted automatically.
- Very specific: line 127
All timestamps use RFC3339 format: 2026-03-07T00:00:00Z
- Distinctive: line 188
DELETE returns empty body on success (HTTP 200)
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
AlertManager Query (API v2)
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.
Availability Warning
AlertManager runs as an in-cluster pod and may be unavailable (crashloop, DNS failure, not deployed locally). Always check connectivity first. When AlertManager is down, fall back to VictoriaMetrics for alert data:
# Fallback: firing/pending alerts from VictoriaMetrics (always available)
curl -s ${VM_AUTH_HEADER:+-H "$VM_AUTH_HEADER"} \
"$VM_METRICS_URL/api/v1/alerts" | jq '.data.alerts[]'AlertManager provides what VM alerts cannot: silences, inhibition state, and alert routing.
Environment
# $VM_ALERTMANAGER_URL - base URL
# Prod: export VM_ALERTMANAGER_URL="https://alertmanager.example.com"
# Local: N/A (AlertManager typically not deployed locally)
# $VM_AUTH_HEADER - auth header (set for prod, empty for local)Auth Pattern
All curl commands use conditional auth:
curl -s ${VM_AUTH_HEADER:+-H "$VM_AUTH_HEADER"} "$VM_ALERTMANAGER_URL/api/v2/alerts" | jq .When VM_AUTH_HEADER is empty, -H flag is omitted automatically.
Core Endpoints
List Alerts
# All alerts (active, silenced, inhibited)
curl -s ${VM_AUTH_HEADER:+-H "$VM_AUTH_HEADER"} \
"$VM_ALERTMANAGER_URL/api/v2/alerts" | jq .
# Only active (not silenced, not inhibited)
curl -s ${VM_AUTH_HEADER:+-H "$VM_AUTH_HEADER"} \
"$VM_ALERTMANAGER_URL/api/v2/alerts?active=true&silenced=false&inhibited=false" | jq .
# Filter by label matcher (URL-encode the matcher)
curl -s -G ${VM_AUTH_HEADER:+-H "$VM_AUTH_HEADER"} \
--data-urlencode 'filter=alertname="HighMemory"' \
"$VM_ALERTMANAGER_URL/api/v2/alerts" | jq .
# Filter by receiver
curl -s ${VM_AUTH_HEADER:+-H "$VM_AUTH_HEADER"} \
"$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)
List Silences
# All silences
curl -s ${VM_AUTH_HEADER:+-H "$VM_AUTH_HEADER"} \
"$VM_ALERTMANAGER_URL/api/v2/silences" | jq .
# Filter silences by matcher
curl -s -G ${VM_AUTH_HEADER:+-H "$VM_AUTH_HEADER"} \
--data-urlencode 'filter=alertname="HighMemory"' \
"$VM_ALERTMANAGER_URL/api/v2/silences" | jq .Parameters: filter (string array, matcher expressions)
Get Silence by ID
# Note: singular "silence" in path (not "silences")
curl -s ${VM_AUTH_HEADER:+-H "$VM_AUTH_HEADER"} \
"$VM_ALERTMANAGER_URL/api/v2/silence/{silenceID}" | jq .Replace {silenceID} with the UUID.
Create Silence
curl -s ${VM_AUTH_HEADER:+-H "$VM_AUTH_HEADER"} \
-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.
Delete (Expire) Silence
# Note: singular "silence" in path
curl -s ${VM_AUTH_HEADER:+-H "$VM_AUTH_HEADER"} \
-X DELETE \
"$VM_ALERTMANAGER_URL/api/v2/silence/{silenceID}"Replace {silenceID} with the UUID. Returns empty body on success.
Timestamp Format
All timestamps use RFC3339 format: 2026-03-07T00:00:00Z
Response Parsing (jq)
# 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}'Common Patterns
# Quick connectivity check
curl -sf -o /dev/null -w "%{http_code}" ${VM_AUTH_HEADER:+-H "$VM_AUTH_HEADER"} \
"$VM_ALERTMANAGER_URL/api/v2/alerts" && echo " OK" || echo " UNREACHABLE"
# Count firing alerts
curl -s ${VM_AUTH_HEADER:+-H "$VM_AUTH_HEADER"} \
"$VM_ALERTMANAGER_URL/api/v2/alerts?active=true&silenced=false&inhibited=false" | jq 'length'
# Silence an alert for 2 hours from now
curl -s ${VM_AUTH_HEADER:+-H "$VM_AUTH_HEADER"} \
-X POST -H "Content-Type: application/json" \
-d "$(jq -n --arg start "$(date -u +%Y-%m-%dT%H:%M:%SZ)" \
--arg end "$(date -u -d '+2 hours' +%Y-%m-%dT%H:%M:%SZ)" \
'{matchers: [{name: "alertname", value: $ARGS.named.alert, isRegex: false, isEqual: true}],
startsAt: $start, endsAt: $end, createdBy: "claude", comment: $ARGS.named.reason}' \
--arg alert "AlertName" --arg reason "Investigation in progress")" \
"$VM_ALERTMANAGER_URL/api/v2/silences" | jq .
# Check if a specific alert is silenced
curl -s -G ${VM_AUTH_HEADER:+-H "$VM_AUTH_HEADER"} \
--data-urlencode 'filter=alertname="TargetAlert"' \
"$VM_ALERTMANAGER_URL/api/v2/alerts?active=false&silenced=true" | jq 'length'Environment Switching
# Check current environment
echo "VM_ALERTMANAGER_URL: $VM_ALERTMANAGER_URL"
if [ -n "$VM_AUTH_HEADER" ]; then
echo "VM_AUTH_HEADER: (set, length=${#VM_AUTH_HEADER})"
else
echo "VM_AUTH_HEADER: (unset or empty)"
fiImportant Notes
- Path difference: plural
/api/v2/silencesfor list/create, singular/api/v2/silence/{id}for get/delete - POST endpoints require
Content-Type: application/json - DELETE returns empty body on success (HTTP 200)
filterparameter uses PromQL-style matchers:alertname="Foo",severity=~"critical|warning"- AlertManager may be down — always have a fallback plan using
$VM_METRICS_URL/api/v1/alerts - For full endpoint details, parameters, and response formats, see
references/api-reference.md
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

