Skip to main content

Monitoring Stack Installation on buzz.deome.loc

Monitoring Stack Installation on buzz.deome.loc

Overview

This guide details the installation and configuration of a monitoring stack on buzz.deome.loc using Node Exporter, Prometheus, and Grafana. This setup will allow for system metrics collection, visualization, and alerting.


1. Node Exporter Installation (for System Metrics)

  1. Download and Install Node Exporter:

    • Navigate to the desired installation directory and download the latest Node Exporter release:
      cd /usr/local/bin
      wget https://github.com/prometheus/node_exporter/releases/download/v1.6.0/node_exporter-1.6.0.linux-amd64.tar.gz
      tar xvfz node_exporter-1.6.0.linux-amd64.tar.gz
      mv node_exporter-1.6.0.linux-amd64/node_exporter .
      rm -rf node_exporter-1.6.0.linux-amd64*
      
  2. Create a Systemd Service for Node Exporter:

    • Create a new service file:
      sudo nano /etc/systemd/system/node_exporter.service
      
    • Add the following configuration:
      [Unit]
      Description=Node Exporter
      After=network.target
      
      [Service]
      User=node_exporter
      ExecStart=/usr/local/bin/node_exporter
      
      [Install]
      WantedBy=default.target
      
  3. Start and Enable Node Exporter:

    • Enable and start Node Exporter:
      sudo systemctl daemon-reload
      sudo systemctl enable node_exporter
      sudo systemctl start node_exporter
      
  4. Verify Node Exporter:

    • Node Exporter should now be running on port 9100. Check by navigating to http://buzz.deome.loc:9100/metrics in a web browser.

2. Prometheus Installation and Configuration

  1. Download and Install Prometheus:

    • Download the latest Prometheus release:
      cd /usr/local/bin
      wget https://github.com/prometheus/prometheus/releases/download/v2.47.0/prometheus-2.47.0.linux-amd64.tar.gz
      tar xvfz prometheus-2.47.0.linux-amd64.tar.gz
      mv prometheus-2.47.0.linux-amd64/prometheus .
      mv prometheus-2.47.0.linux-amd64/promtool .
      rm -rf prometheus-2.47.0.linux-amd64*
      
  2. Configure Prometheus:

    • Create the configuration file:
      sudo nano /usr/local/bin/prometheus.yml
      
    • Add the following configuration:
      global:
        scrape_interval: 15s
      
      scrape_configs:
        - job_name: 'node_exporter'
          static_configs:
            - targets: ['localhost:9100']
      
  3. Create a Systemd Service for Prometheus:

    • Create a new service file:
      sudo nano /etc/systemd/system/prometheus.service
      
    • Add the following configuration:
      [Unit]
      Description=Prometheus
      After=network.target
      
      [Service]
      User=prometheus
      ExecStart=/usr/local/bin/prometheus --config.file=/usr/local/bin/prometheus.yml --storage.tsdb.path=/var/lib/prometheus
      
      [Install]
      WantedBy=default.target
      
  4. Start and Enable Prometheus:

    • Enable and start Prometheus:
      sudo systemctl daemon-reload
      sudo systemctl enable prometheus
      sudo systemctl start prometheus
      
  5. Verify Prometheus:

    • Access Prometheus at http://buzz.deome.loc:9090.

3. Grafana Installation and Configuration

  1. Install Grafana:

    • Add the Grafana repository and install Grafana:
      sudo apt update
      sudo apt install -y software-properties-common
      sudo add-apt-repository "deb https://packages.grafana.com/oss/deb stable main"
      sudo apt update
      sudo apt install grafana -y
      
  2. Start and Enable Grafana:

    • Enable and start Grafana:
      sudo systemctl start grafana-server
      sudo systemctl enable grafana-server
      
  3. Access Grafana:

    • Grafana will be accessible at http://buzz.deome.loc:3000. Default login is admin / admin (you will be prompted to change the password upon first login).
  4. Add Prometheus Data Source in Grafana:

    • In Grafana:
      • Go to Configuration > Data Sources > Add Data Source.
      • Select Prometheus and set the URL to http://localhost:9090.
      • Save and test the data source.

4. Setting Up Basic Dashboards and Alerts

  1. Import Node Exporter Dashboard:

    • Grafana provides pre-made dashboards. For Node Exporter metrics, import dashboard ID 1860 from Grafana’s dashboard library:
      • Go to Create > Import in Grafana.
      • Enter 1860 and follow the prompts to import the Node Exporter dashboard.
  2. Create Alerts in Prometheus (Optional):

    • Alerts can be set up in Prometheus for key metrics (e.g., CPU usage, memory).
    • Edit the Prometheus configuration file to add alert rules, and restart Prometheus for changes to take effect.

5. Maintenance and Updates

  1. Update the Stack:

    • Periodically check for updates to Node Exporter, Prometheus, and Grafana:
      sudo apt update && sudo apt upgrade -y
      
  2. Data Backup:

    • Regularly back up Grafana dashboards and Prometheus data as needed.

This setup guide provides a full configuration for a monitoring stack on buzz.deome.loc using Node Exporter, Prometheus, and Grafana. Let me know if there are additional steps or customizations you’d like!