Operations 4 min read

Deploying Prometheus and Node Exporter on a Linux Host

This guide walks through installing Prometheus and Node Exporter on a Linux server, copying binaries to system paths, configuring Prometheus with scrape jobs for the local node and remote hosts, and running the exporters with specific collector options for system metrics.

Practical DevOps Architecture
Practical DevOps Architecture
Practical DevOps Architecture
Deploying Prometheus and Node Exporter on a Linux Host

Click the blue “DevOps架构实战” to follow me.

Share to “朋友圈”, every morning at 07:30, dry‑goods push!

1、部署 prometheus

[root@mha ~]# tar -zxvf prometheus-2.32.1.linux-amd64.tar.gz

[root@mha ~]# cd prometheus-2.32.1.linux-amd64

[root@mha prometheus-2.32.1.linux-amd64]# ll

total 193448

-rw-r--r-- 1 3434 3434 11357 Dec 18 06:18 LICENSE

-rw-r--r-- 1 3434 3434 3646 Dec 18 06:18 NOTICE

drwxr-xr-x 2 3434 3434 38 Dec 18 06:18 console_libraries

drwxr-xr-x 2 3434 3434 173 Dec 18 06:18 consoles

-rwxr-xr-x 1 3434 3434 103070626 Dec 18 06:10 prometheus

-rw-r--r-- 1 3434 3434 934 Dec 18 06:18 prometheus.yml

-rwxr-xr-x 1 3434 3434 94996583 Dec 18 06:13 promtool

[root@mha prometheus-2.32.1.linux-amd64]# cp prometheus promtool /usr/local/bin/

[root@mha prometheus-2.32.1.linux-amd64]# prometheus --config.file "/etc/prometheus/prometheus.yml"

2、部署 node_exporter

[root@mha ~]# tar -xf node_exporter-1.3.1.linux-amd64.tar.gz

[root@mha ~]# cd node_exporter-1.3.1.linux-amd64

[root@mha ~]# mkdir -p /usr/local/node_exporter/textfile_collector

3、运行

[root@mha ~]# node_exporter --collector.textfile.directory="/usr/local/node_exporter/textfile_collector" --collector.systemd --collector.systemd.unit-whitelist="{docker|ssh|rsyslog|nginx}.service" --web.telemetry-path="/node_metrics"

4、过滤收集器

[root@mha ~]# more /etc/prometheus/prometheus.yml

# my global config

global:

scrape_interval: 15s # Set the scrape interval to every 15 seconds. Default is every 1 minute.

evaluation_interval: 15s # Evaluate rules every 15 seconds. The default is every 1 minute.

# Alertmanager configuration

alerting:

alertmanagers:

- static_configs:

- targets:

# - alertmanager:9093

rule_files:

# - "first_rules.yml"

# - "second_rules.yml"

scrape_configs:

- job_name: "prometheus"

static_configs:

- targets: ["localhost:9090"]

- job_name: "node"

static_configs:

- targets: ["192.168.26.182:9100", "192.168.26.181:9100", "192.168.26.180:9100"]

params:

collect[]:

- cpu

- meminfo

- diskstats

- netdev

- netstat

- filefd

- filesystem

- xfs

- systemd

monitoringdeploymentPrometheusnode exporter
Practical DevOps Architecture
Written by

Practical DevOps Architecture

Hands‑on DevOps operations using Docker, K8s, Jenkins, and Ansible—empowering ops professionals to grow together through sharing, discussion, knowledge consolidation, and continuous improvement.

0 followers
Reader feedback

How this landed with the community

login Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.