Command Palette

Search for a command to run...

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

thanos

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

Thanos extends Prometheus with long-term metric storage in object storage, a global query view across many Prometheus servers, downsampling and deduplication…

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

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

Thanos

Overview

Thanos is a set of components around Prometheus. The sidecar uploads Prometheus's 2-hour TSDB blocks to object storage, the store gateway serves those blocks, the querier fans a PromQL query out to all of them and deduplicates the result, the compactor merges, downsamples and expires blocks, and the ruler evaluates rules against the global view. Release 0.42.4 is current at the time of writing; Thanos is pre-1.0, so flags can change between minor versions. Check thanos <component> --help for the version you run. All flags below were checked against 0.42.4.

Images: quay.io/thanos/thanos:v0.42.4 (the Docker Hub thanosio/thanos repository mirrors it). Pin a version tag, never latest.

Instructions

Step 1: Prometheus and sidecar

Every Prometheus needs external_labels that are unique across the whole system (Thanos uses them to tell sources apart and to find HA replicas). Equal min-block-duration and max-block-duration turn off Prometheus's local compaction, which would otherwise rewrite blocks the sidecar is uploading.

# prometheus.yml
global:
  scrape_interval: 30s
  external_labels:
    cluster: eu-west-1
    replica: prom-0        # differs between the two members of an HA pair
scrape_configs:
  - job_name: node
    static_configs:
      - targets: ["node-exporter:9100"]
# docker-compose.yml: Prometheus with a Thanos sidecar uploading to S3
services:
  prometheus:
    image: prom/prometheus:v3.15.1
    command:
      - '--config.file=/etc/prometheus/prometheus.yml'
      - '--storage.tsdb.path=/prometheus'
      - '--storage.tsdb.min-block-duration=2h'
      - '--storage.tsdb.max-block-duration=2h'
      - '--web.enable-lifecycle'
      - '--web.enable-admin-api'
    volumes:
      - ./prometheus.yml:/etc/prometheus/prometheus.yml:ro
      - prom_data:/prometheus
    ports: ["127.0.0.1:9090:9090"]

  thanos-sidecar:
    image: quay.io/thanos/thanos:v0.42.4
    command:
      - 'sidecar'
      - '--tsdb.path=/prometheus'
      - '--prometheus.url=http://prometheus:9090'
      - '--objstore.config-file=/etc/thanos/bucket.yml'
      - '--grpc-address=0.0.0.0:10901'
      - '--http-address=0.0.0.0:10902'
    environment:
      AWS_ACCESS_KEY_ID: ${THANOS_S3_ACCESS_KEY}
      AWS_SECRET_ACCESS_KEY: ${THANOS_S3_SECRET_KEY}
    volumes:
      - prom_data:/prometheus        # read-write: the sidecar records upload state here
      - ./bucket.yml:/etc/thanos/bucket.yml:ro

volumes:
  prom_data:

Thanos does not expand ${VAR} inside its config files. For S3, leave out access_key and secret_key and the client reads AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY from the environment (or set aws_sdk_auth: true for instance roles and web identity).

# bucket.yml: object storage (S3)
type: S3
config:
  bucket: "metrics-prod-eu-west-1"
  endpoint: "s3.eu-west-1.amazonaws.com"
  region: "eu-west-1"
# bucket.yml: GCS alternative. Credentials come from GOOGLE_APPLICATION_CREDENTIALS
# (the `service_account` key takes the JSON content itself, not a path).
type: GCS
config:
  bucket: "metrics-prod-eu-west-1"

For quick local tests only, type: FILESYSTEM with config: {directory: /var/thanos/bucket} works with every component.

Step 2: Querier (global view)

--endpoint lists the gRPC addresses of sidecars, store gateways, rulers and other queriers. The old --store flag was removed and now fails with unknown long flag '--store'. Static --endpoint flags are marked deprecated in favour of a service-discovery file, which can be reloaded without a restart:

# endpoints.yml, passed with --endpoint.sd-config-file=/etc/thanos/endpoints.yml
endpoints:
  - address: "thanos-sidecar-eu:10901"
  - address: "thanos-sidecar-us:10901"
  - address: "thanos-store:10901"
  - address: "thanos-ruler:10901"
# docker-compose-query.yml
services:
  thanos-query:
    image: quay.io/thanos/thanos:v0.42.4
    command:
      - 'query'
      - '--http-address=0.0.0.0:9091'
      - '--grpc-address=0.0.0.0:10901'
      - '--endpoint.sd-config-file=/etc/thanos/endpoints.yml'
      - '--query.replica-label=replica'
      - '--query.auto-downsampling'
    volumes:
      - ./endpoints.yml:/etc/thanos/endpoints.yml:ro
    ports: ["127.0.0.1:9091:9091"]

--query.replica-label names the external label that distinguishes HA replicas; series that differ only in that label are merged. The querier serves the Prometheus HTTP API and a web UI:

curl -s "http://127.0.0.1:9091/api/v1/query" \
  --data-urlencode 'query=sum(rate(http_requests_total[5m])) by (cluster, service)' \
  --data-urlencode 'dedup=true' | jq '.data.result[] | {cluster: .metric.cluster, service: .metric.service, rate: .value[1]}'

Step 3: Store gateway

The gateway serves historical blocks from the bucket. --index-cache-size must not be smaller than the largest index item (about 125 MB by default), otherwise the process exits at start with `

Полный SKILL.md на GitHub

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

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

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

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

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

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

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

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

_scores.json

FAQ

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

Thanos extends Prometheus with long-term metric storage in object storage, a global query view across many Prometheus servers, downsampling and deduplication of HA pairs. Use when asked to keep Prometheus metrics for months or years, query several clusters from one place, run Prometheus in high availability, or set up Thanos sidecar, query, store gateway, compactor or ruler.

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

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

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

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

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

Сравнить thanos с