Java OpenResty Spring Spring Boot MySQL Redis MongoDB PostgreSQL Linux Android Nginx 面试 小程序 Arthas JVM AQS juc Kubernetes Docker 诊断工具


Prometheus+Grafana+node_exporter 监控 Linux 服务器

Prometheus Grafana DevOps 评论 1 大约 1459 字

node_exporter 下载地址

https://github.com/prometheus/node_exporter/releases

后台启动

nohup /root/exporter/node_exporter-1.3.1/node_exporter > node_exporter.out 2>&1 &

设置开机启动

编辑

vim /etc/systemd/system/node_exporter.service

内容:ExecStart需要修改为node_exporter二进制文件的绝对路径

[Unit]
Description=node_exporter
Documentation=https://github.com/prometheus/node_exporter
After=network.target

[Service]
Type=simple
User=root
ExecStart= /root/exporter/node_exporter-1.3.1/node_exporter
Restart=on-failure

[Install]
WantedBy=multi-user.target

设为开机启动

sudo systemctl enable node_exporter.service

启动node_exporter

sudo systemctl start node_exporter.service

node_exporter 默认端口

http://localhost:9100

修改 Prometheus 配置

scrape_configs下新增job_namelinux(名称随意)

  - job_name: 'linux'
    static_configs:
      - targets: ['192.168.0.100:9100']

完整的scrape_configs如下

scrape_configs:
  - job_name: "prometheus"
    static_configs:
      - targets: ["localhost:9090"]
  - job_name: 'linux'
    static_configs:
      - targets: ['192.168.0.100:9100']

重启 Prometheus

重启后可查看node_exporter是否上线。

http://localhost:9090/targets

Grafana Dashboard

Node Exporter Full - dashboard id 1860: https://grafana.com/grafana/dashboards/1860

Node Exporter for Prometheus Dashboard 中文版 - dashboard id 8919: https://grafana.com/grafana/dashboards/8919

Node Exporter for Prometheus Dashboard 英文版 - dashboard id 11074: https://grafana.com/grafana/dashboards/11074

开源地址

https://github.com/prometheus/node_exporter

阅读 1933 · 发布于 2022-02-19

————        END        ————

Give me a Star, Thanks:)

https://github.com/fendoudebb

扫描下方二维码关注公众号和小程序↓↓↓

扫描二维码关注我
昵称:
  • fHLvlxbf 1楼
    e
    Chrome | Windows 10 2023-07-24
随便看看 换一批