Prometheus监控主机指标

2022-10-27 14:41:34 浏览数 (3)

下载node_exporter

https://github.com/prometheus/node_exporter/releases 解压后,把node_exporter拷贝到/usr/loca/bin/目录下

创建启动脚本

vim /usr/lib/systemd/system/node_exporter.service

代码语言:javascript复制
[Unit]
Description=node_exporter
After=network.target

[Service]
User=root
Group=root
ExecStart=/usr/local/bin/node_exporter

[Install]
WantedBy=multi-user.target

启动

代码语言:javascript复制
systemctl daemon-reload
systemctl start node_exporter
systemctl enable node_exporter

修改prometheus配置

vim /etc/prometheus/prometheus.yml

代码语言:javascript复制
...
- job_name: 'node_exporter'
  static_configs:
    - targets:
      - 192.168.1.100:9100
      - 192.168.1.200:9100
...

重新加载prometheus配置

0 人点赞