Skip to content

Setting Up Application Monitoring using Pm2 and grafana

Emmanuel Nwanochie edited this page Aug 24, 2024 · 4 revisions

Application Monitoring with PM2 and Grafana

This guide outlines the steps to set up application monitoring using PM2, Prometheus, and Grafana.

Major Steps

  1. Install PM2 globally
  2. Install PM2 metrics
  3. Configure Prometheus to scrape PM2 metrics
  4. Import Grafana dashboard for PM2 metrics

Detailed Instructions

1. Install PM2 globally

npm install -g pm2

2. Install PM2 metrics

pm2 install pm2-prometheus-exporter

3. Configure Prometheus to scrape PM2 metrics

scrape_configs:
  - job_name: 'pm2'
    static_configs:
      - targets: ['localhost:9209']

Restart Prometheus to apply changes.

4. Import Grafana dashboard for PM2 metrics

In Grafana, go to "Create" > "Import" Enter the dashboard ID for a PM2 dashboard (e.g., 14371) Select your Prometheus data source Click "Import"

Screenshot 2024-08-24 at 11 00 49 PM

Additional Setup

For detailed instructions on setting up Prometheus and Grafana, please refer to: Server Monitoring And Alerts · hngprojects/hng_boilerplate_python_fastapi_web Wiki (github.com) This guide provides comprehensive information on configuring Prometheus and Grafana for server monitoring and alerts.

Clone this wiki locally