Docker - Logging and MonitoringYou want to monitor multiple Docker hosts with Prometheus and cAdvisor. Which setup is best?ARun cAdvisor on each host exposing metrics, configure Prometheus to scrape all hostsBRun one cAdvisor container on a central host to monitor all hostsCRun Prometheus on each host and aggregate metrics manuallyDUse Docker Compose to run a single cAdvisor and Prometheus on one host onlyCheck Answer
Step-by-Step SolutionSolution:Step 1: Understand cAdvisor scopecAdvisor monitors containers on the host it runs on; to monitor multiple hosts, run cAdvisor on each host.Step 2: Configure Prometheus for multi-host scrapingPrometheus can scrape metrics from multiple cAdvisor instances by listing all hosts in its config.Step 3: Evaluate other optionsCentral cAdvisor cannot monitor other hosts; running Prometheus on each host complicates aggregation; single host setup misses other hosts.Final Answer:Run cAdvisor on each host exposing metrics, configure Prometheus to scrape all hosts -> Option AQuick Check:One cAdvisor per host + Prometheus scrape all = Run cAdvisor on each host exposing metrics, configure Prometheus to scrape all hosts [OK]Quick Trick: One cAdvisor per host, Prometheus scrapes all [OK]Common Mistakes:Thinking one cAdvisor can monitor all hostsRunning multiple Prometheus instances unnecessarilyIgnoring multi-host scraping config
Master "Logging and Monitoring" in Docker9 interactive learning modes - each teaches the same concept differentlyLearnWhyDeepVisualTryChallengeProjectRecallTime
More Docker Quizzes Docker Security - User namespace remapping - Quiz 3easy Docker Security - Read-only filesystem containers - Quiz 10hard Docker Swarm - Service scaling - Quiz 12easy Docker Swarm - Why orchestration matters - Quiz 11easy Docker Swarm - Swarm vs Kubernetes decision - Quiz 8hard Docker in CI/CD - Deploying from CI/CD pipeline - Quiz 15hard Docker in CI/CD - GitLab CI with Docker - Quiz 1easy Image Optimization - Reducing image size strategies - Quiz 8hard Logging and Monitoring - Docker logging drivers - Quiz 10hard Production Patterns - Backup and restore strategies - Quiz 14medium