Deploy local Node Exporters to generate metrics, configure Prometheus TSDB to scrape targets, and build interactive Grafana analytical dashboards.
Environment
Ubuntu / Prometheus / Grafana
Difficulty
Advanced
Course Module
Chapter 11: Observability
Deliverables
prom.yml & Dashboard Proof
1. System Architecture & Workflow
The monitoring topology below displays the scraping loop, showing how host resource metrics are collected, stored in Prometheus, and visualized in Grafana.
2. Part 1: Step-by-Step Action Items & Key Execution Steps
STEP 1
Install and Configure Node Exporter
Download and run Node Exporter on the target host to collect server metrics like CPU and memory utilization.
This command queries Prometheus's targets API to verify that the local Node Exporter instance is being scraped successfully.
1. Open your browser and navigate to http://localhost:3000 (login with username admin and password admin). Change the default password.
2. Go to Connections -> Data Sources, click Add Data Source, select Prometheus, set the URL to http://localhost:9090, and click Save & Test.
3. Go to Dashboards -> Import, enter dashboard ID 1860 (Node Exporter Full Dashboard), and click Load to import a preconfigured dashboard.
3. Operational Pipeline Architecture
The workflow below traces the scrape-to-alert loop, showing how host activity triggers metric updates, Prometheus scrapes targets, and Grafana updates dashboards.
4. Part 2: Complete Deliverable Assets & Production Templates
To monitor your system, we will configure Prometheus and set up Node Exporter as a background systemd service. Below is a step-by-step breakdown of how these configuration files are constructed, followed by the final combined files.
Step-by-Step Script Construction
Step 1
Define Prometheus Global Timing Settings
Setup the primary server scraping frequency configurations.
This run configuration starts the Node Exporter binary located in /usr/local/bin as the user devops, and registers the service to start automatically under standard multi-user boot targets.
Combined Complete Configuration Files
Create these files in their respective folders inside the VM:
1. prometheus.yml
Save this configuration file as /etc/prometheus/prometheus.yml:
global:
scrape_interval: 15s # Set the default scrape interval to every 15 seconds
evaluation_interval: 15s # Evaluate rules every 15 seconds
scrape_configs:
- job_name: 'prometheus'
static_configs:
- targets: ['localhost:9090']
- job_name: 'node_exporter'
static_configs:
- targets: ['localhost:9100']
2. node_exporter.service
Save this systemd service definition as /etc/systemd/system/node_exporter.service: