thanos
FreeNo executable scriptsNot checkedThanos extends Prometheus with long-term metric storage in object storage, a global query view across many Prometheus servers, downsampling and deduplication…
by TerminalSkills★ 221 GitHub starsAbout this skill
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 `
Install thanos in Claude Code & Claude Desktop
Sign up to install this skill
Create a free account to reveal the install command and save the skill to your library.
- Reveal the one-line install command
- Save skills to your synced library
- Get notified when skills update
Allowed tools
Tools this skill is permitted to call.
No restriction — this skill can use any tool.
Bundled files
FAQ
What does the thanos skill do?
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.
How do I install the thanos skill?
Copy the skill folder into ~/.claude/skills (the Claude Code tab above does this in one command), or install it as a plugin.
Does the thanos skill run scripts?
No, this skill is instructions only (SKILL.md) with no executable scripts.
Related skills
theme-factory
Toolkit for styling artifacts with a theme. These artifacts can be slides, docs, reportings, HTML landing pages, etc. There are 10 pre-set themes with…
by Anthropicaccess
Manage Discord channel access — approve pairings, edit allowlists, set DM/group policy. Use when the user asks to pair, approve someone, check who's allowed…
by Anthropicconfigure
Set up the Discord channel — save the bot token and review access policy. Use when the user pastes a Discord bot token, asks to configure Discord, asks "how…
by Anthropicaccess
Manage iMessage channel access — approve pairings, edit allowlists, set DM/group policy. Use when the user asks to pair, approve someone, check who's allowed…
by Anthropic