Prometheus monitoring architecture components¶
Prometheus monitoring architecture components refers to the ecosystem of open-source tools that facilitate the collection, storage, querying, and visualization of time-series data, particularly within cloud-native environments like Kubernetes[400-devops__06-Kubernetes__k8s-paas__07.Promtheus监控k8s企业级应用.md][400-devops__06-Kubernetes__k8s-paas__07.Promtheus监控k8s企业级应用.md].
The architecture is designed around a central server that "pulls" Metrics, unlike traditional push-based monitoring systems^[400-devops__06-Kubernetes__k8s-paas__07.Promtheus监控k8s企业级应用.md].
Core Components¶
Prometheus Server¶
The Prometheus Server is the central core component of the monitoring architecture^[400-devops__06-Kubernetes__k8s-paas__07.Promtheus监控k8s企业级应用.md]. It is responsible for scraping and storing time-series Metrics data^[400-devops__06-Kubernetes__k8s-paas__07.Promtheus监控k8s企业级应用.md]. It provides a flexible query language known as PromQL to retrieve this data^[400-devops__06-Kubernetes__k8s-paas__07.Promtheus监控k8s企业级应用.md].
Service Discovery¶
Service Discovery allows Prometheus to dynamically detect monitoring targets rather than relying on static configuration^[400-devops__06-Kubernetes__k8s-paas__07.Promtheus监控k8s企业级应用.md]. It supports multiple mechanisms, including file-based discovery, DNS, and integrations with platforms like Kubernetes, Consul, and EC2^[400-devops__06-Kubernetes__k8s-paas__07.Promtheus监控k8s企业级应用.md]. In a Kubernetes environment, this enables the automatic monitoring of pods, services, and nodes as they are created or destroyed^[400-devops__06-Kubernetes__k8s-paas__07.Promtheus监控k8s企业级应用.md].
Exporters¶
Exporters are specialized agents that collect Metrics from target objects (such as hosts, containers, or databases) and expose them via an HTTP interface for the Prometheus Server to scrape^[400-devops__06-Kubernetes__k8s-paas__07.Promtheus监控k8s企业级应用.md].
Common exporters include:
- Node Exporter: Collects hardware and OS-level Metrics from compute nodes^[400-devops__06-Kubernetes__k8s-paas__07.Promtheus监控k8s企业级应用.md].
- cAdvisor: Collects resource usage statistics specific to containers^[400-devops__06-Kubernetes__k8s-paas__07.Promtheus监控k8s企业级应用.md].
- Kube-state-metrics: An exporter specifically for Kubernetes that collects Metrics about the state of Kubernetes objects (e.g., pods, deployments, nodes)^[400-devops__06-Kubernetes__k8s-paas__07.Promtheus监控k8s企业级应用.md].
- Blackbox Exporter: Used to probe endpoints (HTTP, HTTPS, TCP, ICMP) to monitor availability and latency^[400-devops__06-Kubernetes__k8s-paas__07.Promtheus监控k8s企业级应用.md].
Pushgateway¶
The Pushgateway acts as an intermediary for metrics^[400-devops__06-Kubernetes__k8s-paas__07.Promtheus监控k8s企业级应用.md]. Since Prometheus primarily uses a "pull" model, components that can only "push" Metrics send their data to the Pushgateway^[400-devops__06-Kubernetes__k8s-paas__07.Promtheus监控k8s企业级应用.md]. The Pushgateway then exposes these Metrics for the Prometheus Server to scrape^[400-devops__06-Kubernetes__k8s-paas__07.Promtheus监控k8s企业级应用.md].
Alerting and Visualization¶
Alertmanager¶
The Alertmanager handles alerts sent by the Prometheus Server^[400-devops__06-Kubernetes__k8s-paas__07.Promtheus监控k8s企业级应用.md]. It is responsible for deduplicating alerts, grouping them, and routing them to the correct receiver (such as email, PagerDuty, or other webhooks)^[400-devops__06-Kubernetes__k8s-paas__07.Promtheus监控k8s企业级应用.md].
Grafana¶
Grafana is an open-source visualization platform often integrated with Prometheus^[400-devops__06-Kubernetes__k8s-paas__07.Promtheus监控k8s企业级应用.md]. While Prometheus includes a built-in web UI, Grafana is preferred for its powerful and aesthetically pleasing dashboards^[400-devops__06-Kubernetes__k8s-paas__07.Promtheus监控k8s企业级应用.md]. It connects to Prometheus as a data source to display the Metrics collected by the architecture^[400-devops__06-Kubernetes__k8s-paas__07.Promtheus监控k8s企业级应用.md].
Related Concepts¶
- Prometheus
- Metrics
- [[Time-series database]]
Sources¶
^[400-devops__06-Kubernetes__k8s-paas__07.Promtheus监控k8s企业级应用.md]