Skip to main content

Exporter Scrape Basics (Host and Redis)

These examples focus on the most common pattern in Alloy: connect an exporter to a prometheus.scrape component and forward metrics into the shared relabel pipeline from 01-global.alloy.

Example: Host Metrics (Node/Unix Exporter)

02-system.alloy
prometheus.exporter.unix "local" { }

prometheus.scrape "host" {
targets = prometheus.exporter.unix.local.targets
forward_to = [prometheus.relabel.common_labels.receiver]
}

This exports host metrics and forwards them to the shared prometheus.relabel.common_labels pipeline in 01-global.alloy.

Example: Redis Metrics

03-redis.alloy
prometheus.exporter.redis "local" {
redis_addr = "localhost:6379"
}

prometheus.scrape "redis" {
targets = prometheus.exporter.redis.local.targets
forward_to = [prometheus.relabel.common_labels.receiver]

}

Make sure Redis is running and reachable at the configured address, otherwise the exporter will fail to scrape.