Prometheus is an open-source monitoring and alerting system used to collect metrics from applications and infrastructure. It is widely used because of its pull-based model, powerful query language (PromQL), and time-series database capabilities.
Example Use Case:
Monitoring CPU, memory, and network usage
Collecting application performance metrics
Alerting on high error rates or latency
How does Prometheus collect data?
Prometheus pulls metrics from target endpoints exposed via HTTP at /metrics. The targets can be defined in a static configuration or discovered dynamically (e.g., Kubernetes service discovery).
PromQL (Prometheus Query Language) is used to query and analyze metrics stored in Prometheus. It enables users to create alerts, dashboards, and graphs.
Grafana is an open-source analytics and visualization tool used to create interactive dashboards for monitoring data from Prometheus, ELK, and other sources.
How do you connect Grafana to Prometheus?
Login to Grafana (http://localhost:3000).
Navigate to "Configuration" → "Data Sources".
Select Prometheus as the data source.
Enter Prometheus URL (http://localhost:9090).
Click Save & Test.
What are Grafana Panels?
Panels are visual components in Grafana used to display data in various formats:
Graph Panel: Time-series data visualization
Single Stat Panel: Displays a single numeric value
Table Panel: Tabular data display
How do you create alerts in Grafana?
Select a panel.
Click "Edit" → "Alert".
Define a condition using PromQL queries.
Set the evaluation interval (e.g., every 1m).
Configure the alert notification (Slack, Email, etc.).
How do you configure a Grafana dashboard using JSON?