How to use Prometheus and Grafana for monitoring

· Category: Linux

Short answer

Prometheus collects metrics; Grafana visualizes them. Together they provide powerful monitoring for Linux systems and applications.

Steps

  1. Install Prometheus and Grafana from packages or Docker.
  2. Configure Prometheus targets in prometheus.yml:
scrape_configs:
  - job_name: 'node'
    static_configs:
      - targets: ['localhost:9100']
  1. Run Node Exporter on Linux hosts.
  2. Add Prometheus as a data source in Grafana.
  3. Import dashboards (e.g., Node Exporter Full).

Tips

  • Use recording rules and alerts in Prometheus for proactive monitoring.
  • Secure Grafana with HTTPS and strong authentication.
  • Federation scales Prometheus across multiple environments.

Common issues

  • High cardinality metrics can overload Prometheus memory.
  • Clock skew between nodes causes scraping inconsistencies.