Показать активные алерты

Показывает только сработавшие алерты с именем и severity

curl -s http://prometheus:9090/api/v1/alerts | jq '.data.alerts[] | select(.state=="firing") | {name: .labels.alertname, severity: .labels.severity}'

инструмент
prometheus30 команд
теги
prometheusmonitoring

Другие команды prometheus

  • curl -s http://prometheus:9090/api/v1/label/__name__/values | jq '.data | length, .[0:20]'

    Считает все имена метрик и показывает первые 20

  • count by (job) ({__name__=~".+"})

    PromQL: считает активные временные ряды по каждой метке job

  • amtool silence add alertname=HighMemory --duration=2h --comment='Investigating'

    Создаёт silence в Alertmanager на 2 часа

  • curl -s http://prometheus:9090/api/v1/status/tsdb | jq '{head_chunks: .data.headStats.numChunks, series: .data.headStats.numSeries}'

    Показывает статистику head блока TSDB: чанки и активные серии

  • histogram_quantile(0.95, sum by(le,job)(rate(http_request_duration_seconds_bucket[5m])))

    p95 задержки по каждому job. Перед histogram_quantile всегда агрегируй `_bucket` по `le`

все 30 команд prometheus