# Node Exporter + Prometheus

```
wget https://github.com/prometheus/node_exporter/releases/download/v1.9.1/node_exporter-1.9.1.linux-amd64.tar.gz

from this page https://prometheus.io/download/

tar xzvf node_exporter-1.9.1.linux-amd64.tar.gz

mv node_exporter-1.9.1.linux-amd64.tar.gz node_exporter

nano /etc/systemd/system/node_exporter.service

[Unit]
Description=Node Exporter

[Service]
User=root
ExecStart=/opt/node_exporter/node_exporter --web.listen-address="127.0.0.1:9100"

[Install]
WantedBy=default.target


systemctl daemon-reload
systemctl start node_exporter
systemctl status node_exporter

```

```
wget https://github.com/prometheus/prometheus/releases/download/v3.5.0/prometheus-3.5.0.linux-amd64.tar.gz

tar xzvf prometheus-3.5.0.linux-amd64.tar.gz

mv prometheus-3.5.0.linux-amd64 prometheus

cd prometheus

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

# Alertmanager configuration
alerting:
  alertmanagers:
    - static_configs:
        - targets:
          # - alertmanager: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"

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

    static_configs:
      - targets: ["127.0.0.1:9090"]
  - job_name: "node_exporter"
    static_configs:
      - targets: ["127.0.0.1:9100"]       
# The label name is added as a label `label_name=<label_value>` to any timeseries scraped from this config.
        labels:
          app: "prometheus"
          
          
          
./promtool check config prometheus.yml

nano /etc/systemd/system/prometheus.service

[Service]
User=root
ExecStart=/opt/prometheus/prometheus \
        --web.listen-address=0.0.0.0:9090 \
        --config.file=/opt/prometheus/prometheus.yml
        --storage.tsdb.path=/var/lib/prometheus
        --storage.tsdb.retention.time=30d

[Install]
WantedBy=default.target



systemctl daemon-reload
systemctl start prometheus
systemctl status prometheus
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.devops.my.id/cloud-computing/node-exporter-+-prometheus.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
