Command Palette

Search for a command to run...

UnylyUnyly
Назад к скиллам

prometheus

БесплатноБез исполняемых скриптовНе проверен

Prometheus is an open-source monitoring server that scrapes metrics from your services over HTTP, stores them as time series, and evaluates PromQL queries and…

TerminalSkillsот TerminalSkills★ 221 звезда на GitHub

Об этом скилле

Prometheus — metrics collection, PromQL and alerting rules

Overview

Prometheus pulls metrics from HTTP endpoints (/metrics) on a schedule, stores them locally in its own time-series database, and lets you query them with PromQL. It also evaluates rule files on a timer: recording rules precompute expensive expressions, alerting rules turn a PromQL condition into an alert that Prometheus sends to Alertmanager.

This skill covers the server itself: configuration, discovery of targets, rules, promtool, the query API and retention. Routing and delivery of alerts (receivers, grouping, silences) belong to prometheus-alertmanager. For long-term or multi-cluster storage see thanos or victoriametrics; for a broader stack design see observability-setup.

Instructions

Installation

Use the release tarball from the project's GitHub releases (it contains prometheus, promtool and a sample prometheus.yml) and verify it against the sha256sums.txt file published with the release.

VERSION=3.15.1   # take the current tag from https://github.com/prometheus/prometheus/releases
curl -fLO https://github.com/prometheus/prometheus/releases/download/v${VERSION}/prometheus-${VERSION}.linux-amd64.tar.gz
curl -fLO https://github.com/prometheus/prometheus/releases/download/v${VERSION}/sha256sums.txt
sha256sum --ignore-missing -c sha256sums.txt
tar xzf prometheus-${VERSION}.linux-amd64.tar.gz
cd prometheus-${VERSION}.linux-amd64 && ./prometheus --version

Docker (the image keeps its config at /etc/prometheus/prometheus.yml):

docker run -d --name prometheus -p 127.0.0.1:9090:9090 \
  -v "$PWD/prometheus.yml:/etc/prometheus/prometheus.yml:ro" \
  -v "$PWD/rules:/etc/prometheus/rules:ro" \
  prom/prometheus

Configuration file

prometheus.yml has four parts you will touch: global, rule_files, scrape_configs and (optionally) alerting. This example scrapes itself plus two hosts discovered from a JSON file:

global:
  scrape_interval: 15s
  evaluation_interval: 15s

rule_files:
  - rules/*.yml            # paths are relative to this file

scrape_configs:
  - job_name: prometheus
    static_configs:
      - targets: ["127.0.0.1:9090"]
        labels:
          env: staging

  - job_name: node
    file_sd_configs:
      - files: ["targets/node.json"]   # re-read automatically when it changes
        refresh_interval: 1m

targets/node.json is a list of target groups:

[{"targets": ["10.0.4.11:9100", "10.0.4.12:9100"], "labels": {"team": "platform"}}]

Other discovery mechanisms (kubernetes_sd_configs, dns_sd_configs, consul_sd_configs, ec2_sd_configs, ...) go in the same place; check what a job resolves to with promtool check service-discovery prometheus.yml node, which prints discovered labels before and after relabel_configs.

To send alerts, add an alerting block pointing at Alertmanager (see prometheus-alertmanager for the receiving side):

alerting:
  alertmanagers:
    - static_configs:
        - targets: ["127.0.0.1:9093"]

Retention and storage settings live in the config file as well: the --storage.tsdb.retention.time and .size flags are deprecated in 3.x in favour of this block (the default is 15 days when nothing is set):

storage:
  tsdb:
    retention:
      time: 30d
      size: 20GB

Rules

Recording rule, in rules/recording.yml:

groups:
  - name: http_recording
    interval: 30s
    rules:
      - record: job:http_requests:rate5m
        expr: sum by (job) (rate(prometheus_http_requests_total[5m]))

Alerting rule, in rules/alerts.yml:

groups:
  - name: availability
    rules:
      - alert: InstanceDown
        expr: up == 0
        for: 5m                 # must hold for 5 minutes before firing
        labels:
          severity: page
        annotations:
          summary: "{{ $labels.instance }} of job {{ $labels.job }} is down"

Rule files are only loaded through rule_files in the config. There is no command-line flag for them.

Validate before you deploy

promtool check config prometheus.yml          # also checks every file named in rule_files
promtool check rules rules/alerts.yml rules/recording.yml

check config fails if a file matched by a rule_files glob is not a rule file. Keep unit-test files in a different directory (such as tests/), never under rules/.

Unit-test alerts with promtool

A test feeds synthetic series and asserts which alerts exist at a given time:

# tests/alerts_test.yml
rule_files:
  - ../rules/alerts.yml
evaluation_interval: 1m
tests:
  - interval: 1m
    input_series:
      - series: 'up{job="node", instance="10.0.4.11:9100"}'
        values: '1 1 0 0 0 0 0 0'
    alert_rule_test:
      - eval_time: 3m
        alertname: InstanceDown
        exp_alerts: []
      - eval_time: 8m
        alertname: InstanceDown
        exp_alerts:
          - exp_labels:
              severity: page
Полный SKILL.md на GitHub

Установить prometheus в Claude Code и Claude Desktop

Зарегайся, чтобы установить скилл

Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.

  • Открой команду установки в одну строку
  • Сохраняй скиллы в синхронизируемую библиотеку
  • Уведомления, когда скиллы обновляются
Зарегаться бесплатноУ меня уже есть аккаунт

Разрешённые инструменты

Инструменты, которые скиллу разрешено вызывать.

Без ограничений — скилл может использовать любой инструмент.

Вложенные файлы

_scores.json

FAQ

Что делает скилл prometheus?

Prometheus is an open-source monitoring server that scrapes metrics from your services over HTTP, stores them as time series, and evaluates PromQL queries and alerting rules. Use this skill to write prometheus.yml scrape configs and service discovery, add recording and alerting rules, validate them with promtool, unit-test alerts, query the HTTP API, and set retention. Trigger phrases: "set up Prometheus", "scrape this service", "write an alert rule", "PromQL query", "promtool check", "reload Prometheus config". Alert routing lives in prometheus-alertmanager.

Как установить скилл prometheus?

Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.

Скилл prometheus запускает скрипты?

Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.

Похожие скиллы

Сравнить prometheus с