Exercise 3: A redis Scrape Job, and Why redis_exporter Is Needed — Possible Solution ==================================================================== scrape_configs: - job_name: 'redis' scrape_interval: 30s static_configs: - targets: ['redis1:9121', 'redis2:9121'] -- Why redis_exporter is needed, rather than scraping Redis directly -- -- -- Prometheus can only scrape targets that expose a /metrics endpoint -- in its own specific text-based exposition format (the # HELP / # -- TYPE / metric-name-and-value lines from obs1-2). Redis itself has -- no built-in HTTP endpoint speaking that format -- it exposes its -- own internal statistics through its native protocol (via commands -- like INFO), a completely different interface Prometheus's scraper -- has no way to understand directly. -- -- redis_exporter is the adapter this chapter describes: it's a -- separate small process that connects to Redis using Redis's own -- native protocol, queries the same statistics a human operator -- would get from running INFO, and then re-exposes those same -- numbers as an ordinary Prometheus-format /metrics endpoint -- which -- is exactly why the two scrape targets in this config point at port -- 9121 (redis_exporter's own default port), not Redis's own default -- port 6379. Without the exporter sitting in between, there would be -- no /metrics endpoint at either redis1 or redis2 for Prometheus to -- scrape at all. WHY THIS WORKS AS AN ANSWER ------------------------------ This writes a correctly structured scrape_configs entry matching the chapter's own example format, then explains the exporter requirement by contrasting Redis's own native protocol against Prometheus's specific exposition-format requirement, and explicitly ties the 9121-vs-6379 port distinction back to the exporter's own separate process running alongside Redis.