您好,登录后才能下订单哦!
监控容器服务器CPU、内存、磁盘、I/O等信息,首先需要安装node_exporter。node_exporter的作用是用于机器系统数据收集。
(1)下载node_exporter
https://prometheus.io/download/
shell> cd /Download/
shell> wget https://github.com/prometheus/node_exporter/releases/download/v0.18.1/node_exporter-0.18.1.linux-amd64.tar.gz
(2)解压安装
shell> tar -xvf node_exporter-0.18.1.linux-amd64.tar.gz
shell>cd node_exporter-0.18.1.linux-amd64
shell> mv node_exporter-0.18.1.linux-amd64 node_exporter
shell> chown -R prometheus.prometheus node_exporter
shell> systemctl restart node_exporter
shell>systemctl status node_exporter
shell>netstat -tunlp | grep node_exporter
(3)创建systemd服务
shell>cat > /etc/systemd/system/node_exporter.service << EOF
[Unit]
Description=node_exporter
After=network.target
[Service]
Type=simple
User=prometheus
ExecStart=/Download/node_exporter/node_exporter
Restart=on-failure
[Install]
WantedBy=multi-user.target
EOF
shell>systemctl daemon-reload
shell> systemctl start node_exporter #启动node_exporter服务
shell> systemctl status node_exporter
(4)prometheus_server 中添加job
shell> vim /Download/prometheus/prometheus.yml
shell>systemctl restart prometheus #重启prometheus服务
(5)查看prometheus控制台是否获取到了数据
浏览器->x.x.x.x:9090 ->status->targets 就可以看到所监控的node
免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。