Introduction to Prometheus: Concepts, Deployment, and Integration with Grafana
This article introduces Prometheus as an open‑source monitoring system and time‑series database, explains its core components such as Server, Exporter, PushGateway and Service Discovery, and provides step‑by‑step Docker deployment instructions together with Grafana integration for visualizing metrics.
Prometheus is an open‑source service monitoring system and time‑series database, characterized by three key aspects: it is free and community‑driven, it focuses on monitoring servers, databases, and applications, and it stores immutable data points ordered by time.
Compared with older solutions like Zabbix, Prometheus excels in container monitoring and is recommended for new monitoring selections, especially for backend developers who need basic monitoring knowledge.
The main concepts include:
Prometheus Server : the core component that scrapes, stores, and queries monitoring data.
Exporter : exposes metrics via an HTTP endpoint that the server pulls; many official exporters exist (e.g., MySQL).
PushGateway : allows push‑mode metrics to be collected and then served to the server.
Service Discovery : automatically discovers services in micro‑service environments, avoiding manual configuration changes.
The "three musketeers": Prometheus, Grafana, and Alertmanager work together for data collection, visualization, and alerting.
Deployment steps (using Docker):
docker run -d -p 9090:9090 -v /Users/yinjihuan/Downloads/prometheus/prometheus.yml:/etc/Prometheus/Prometheus.yml prom/prometheusSample prometheus.yml configuration:
global:
scrape_interval: 15s
external_labels:
monitor: 'codelab-monitor'
scrape_configs:
- job_name: 'prometheus'
scrape_interval: 5s
static_configs:
- targets: ['localhost:9090']
- job_name: beta_node
static_configs:
- targets: ['10.111.83.8:9100']Deploy Grafana:
docker run -d -p 3000:3000 --name=grafana -v /Users/yinjihuan/Downloads/Grafana-storage:/var/lib/grafana grafana/grafanaInstall node_exporter from the official Prometheus site, start it (default port 9100), and ensure its IP matches the target defined in the Prometheus configuration.
In Grafana, add a data source pointing to the Prometheus server (e.g., http://localhost:9090 ) and import ready‑made dashboards for node_exporter metrics to visualize machine‑level monitoring.
The author plans to share further experiences and troubleshooting notes after deeper exploration.
Full-Stack Internet Architecture
Introducing full-stack Internet architecture technologies centered on Java
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.