Skip to content

Prometheus Alertmanager Silence Not Expiring Fix

DodaTech Updated 2026-06-24 3 min read

In this tutorial, you'll learn about Prometheus Alertmanager Silence Not Expiring Fix. We cover key concepts, practical examples, and best practices.

Your Alertmanager silence did not expire — alerts are still suppressed hours after the silence's endsAt time. The silence matchers are too broad, the time format is UTC but you intended local time, or multiple silences overlap.

The Problem

# Created a silence that should have ended at 18:00 local time
# But used UTC time instead
amtool silence add \
  --duration=2h \
  --comment="Maintenance window"

If the silence was created at 14:00 local (12:00 UTC), a 2h duration sets endsAt to 14:00 UTC = 16:00 local. The silence "expires" 2 hours early from the user's perspective.

Step-by-Step Fix

1. Use explicit start and end times

# Create silence with explicit UTC timestamps
amtool silence add \
  --start="2026-06-24T22:00:00Z" \
  --end="2026-06-25T06:00:00Z" \
  --comment="Nightly maintenance" \
  --author="devops" \
  matcher="service=batch-job"

2. Use precise matchers

# Wrong: too broad — silences ALL alerts
amtool silence add --duration=1h matcher="severity=warning"

# Right: specific matchers for targeted silencing
amtool silence add --duration=2h \
  matcher="alertname=HighCPUUsage" \
  matcher="instance=web-1"

3. Check active silences

# List all silences
amtool silence query \
  --alertmanager.url=http://localhost:9093

# List only active silences
amtool silence query \
  --alertmanager.url=http://localhost:9093 \
  --active

# Check if a specific alert is silenced
amtool alert query \
  --alertmanager.url=http://localhost:9093 \
  --silenced

4. Expire a silence manually

# Expire a silence by ID
amtool silence expire \
  --alertmanager.url=http://localhost:9093 \
  <silence-id>

# Bulk expire by matcher
amtool silence query \
  --alertmanager.url=http://localhost:9093 \
  --matcher="service=batch-job" \
  -q | xargs -I{} amtool silence expire {}

5. Use the API for silence management

# Create silence via API
curl -X POST http://localhost:9093/api/v2/silences \
  -H "Content-Type: application/json" \
  -d '{
    "matchers": [
      {"name": "alertname", "value": "HighCPUUsage", "isRegex": false}
    ],
    "startsAt": "2026-06-24T10:00:00Z",
    "endsAt": "2026-06-24T12:00:00Z",
    "createdBy": "admin",
    "comment": "Debugging CPU spike"
  }'

# List silences
curl http://localhost:9093/api/v2/silences

# Delete silence
curl -X DELETE http://localhost:9093/api/v2/silence/<id>

Expected output:

Silence ID: 1234abcd-5678-efgh-9012-3456abcdef78
Status: Active
Starts: 2026-06-24T22:00:00Z
Ends: 2026-06-25T06:00:00Z
Matchers: service=batch-job
Comment: Nightly maintenance
Created by: devops

Prevention Tips

  • Use --start and --end with explicit UTC timestamps
  • Use specific matchers to avoid unintended silencing
  • Check active silences before creating new ones
  • Use descriptive comments for audit trail
  • Set up scheduled maintenance via Alertmanager API

Common Mistakes with alertmanager silence

  1. Using foldl instead of foldl' causing stack overflow on large lists
  2. Forgetting deriving (Show, Eq) on custom data types needed for debugging
  3. Placing the wildcard pattern first in case expressions, making all subsequent patterns unreachable

These mistakes appear frequently in real-world PROMETHEUS code. DodaTech's contributors have identified these patterns through analysis of open-source projects and production systems.

Practice Exercise

Write a pure function that safely divides two integers using Maybe, then test it with edge cases like division by zero and negative numbers.

This exercise reinforces the concepts covered in this guide. Try implementing it before checking online solutions.

FAQ

### What's the difference between silence and inhibition?

Silence is manual — you create it to suppress alerts for a specific period. Inhibition is automatic — one alert suppresses others based on configured rules. Use silences for planned maintenance, inhibition for logical suppression (critical overrides warning).

Why is my silence not suppressing alerts?

Check: (1) matchers match the alert labels exactly, (2) the silence is active (not expired), (3) the silence's time range covers the current time, (4) the alert is not excluded by namespace or other restrictions. Use amtool alert query --silenced to verify.

Can I create recurring silences?

Alertmanager does not support recurring silences natively. Use automation scripts or tools like silence-operator for Kubernetes to create/expire silences on a schedule. Alternatively, use the Alertmanager API with cron jobs.

Built by the developers of DodaTech

Doda Browser, DodaZIP & Durga Antivirus Pro