Skip to content

[CENTOS] PROMETHEUS GRAFABA NODE EXPORTER

fourslickz edited this page Aug 13, 2025 · 3 revisions

NODE EXPORTER

wget https://github.com/prometheus/node_exporter/releases/download/v1.8.0/node_exporter-1.8.0.linux-amd64.tar.gz
tar zxvf node_exporter-1.8.0.linux-amd64.tar.gz
mv node_exporter-1.8.0.linux-amd64/node_exporter /usr/local/bin/
nano /etc/systemd/system/node_exporter.service
# /etc/systemd/system/node_exporter.service
[Unit]
Description=Prometheus Node Exporter
After=network.target

[Service]
User=nobody
ExecStart=/usr/local/bin/node_exporter --web.listen-address=10.130.249.227:9100

[Install]
WantedBy=default.target

systemctl enable node_exporter
systemctl start node_exporter
systemctl status node_exporter

PROMETHEUS

# Sample config for Prometheus.

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.
  # scrape_timeout is set to the global default (10s).

  # Attach these labels to any time series or alerts when communicating with
  # external systems (federation, remote storage, Alertmanager).
  external_labels:
      monitor: 'example'

# Alertmanager configuration
alerting:
  alertmanagers:
  - static_configs:
    - targets: ['localhost:9093']

# Load rules once and periodically evaluate them according to the global 'evaluation_interval'.
rule_files:
  # - "first_rules.yml"
  # - "second_rules.yml"

# A scrape configuration containing exactly one endpoint to scrape:
# Here it's Prometheus itself.
scrape_configs:
  # The job name is added as a label `job=<job_name>` to any timeseries scraped from this config.
  - job_name: 'prometheus'

    # Override the global default and scrape targets from this job every 5 seconds.
    scrape_interval: 5s
    scrape_timeout: 5s

    # metrics_path defaults to '/metrics'
    # scheme defaults to 'http'.

    static_configs:
      - targets: ['localhost:9090']

#  - job_name: node
#    # If prometheus-node-exporter is installed, grab stats about the local
#    # machine by default.
#    static_configs:
#      - targets: ['localhost:9100']

  - job_name: 'mysql'
    static_configs:
      - targets: ['10.130.249.210:9104']

  - job_name: 'node'
    static_configs:
      - targets: ['10.130.249.210:9100']
        labels:
          instance: 'node-mongo-prod'
      - targets: ['103.139.192.18:9100']
        labels:
          instance: 'node-app-vue-prod'
      - targets: ['10.130.249.148:9100']
        labels:
          instance: 'node-app-be-prod'
      - targets: ['10.130.249.227:9100']
        labels:
          instance: 'node-be-service-prod'
      - targets: ['10.130.249.225:9100']
        labels:
          instance: 'node-redis-prod'
      - targets: ['10.130.135.84:9100']
        labels:
          instance: 'node-mongo-prod'

GRAFANA

1. Plus icon (➕) → Import.
2. Di kolom Import via Grafana.com, masukkan 1860 (ini ID dashboard Node Exporter yang populer).
3. Pilih data source Prometheus yang tadi dibuat.
4. Klik Import.

Clone this wiki locally