码迷,mamicode.com
首页 > 其他好文 > 详细

promethus粘贴复制式部署文档

时间:2020-03-04 12:36:54      阅读:62      评论:0      收藏:0      [点我收藏+]

标签:rest   ocs   conf   eth   https   down   com   pre   参考   

Prometheus安装

 cd /usr/src/
 wget https://github.com/prometheus/prometheus/releases/download/v2.12.0/prometheus-2.12.0.linux-amd64.tar.gz
tar xf prometheus-2.12.0.linux-amd64.tar.gz  -C /usr/local/
cd /usr/local/
ln -s prometheus-2.12.0.linux-amd64  prometheus

设置systemctl prometheus 启动

cat > /usr/lib/systemd/system/prometheus.service     << EOF
[Unit]
Description=Prometheus: the monitoring system
Documentation=http://prometheus.io/docs/

[Service]
ExecStart=/usr/local/prometheus/prometheus  --config.file=/usr/local/prometheus/prometheus.yml
Restart=always
StartLimitInterval=0
RestartSec=10

[Install]
WantedBy=multi-user.target
EOF
systemctl enable prometheus       ##制作开机启动prometheus  
systemctl start prometheus            ##启动prometheus 
systemctl status prometheus         ##查看promethus状态

node_exporter安装部署 -> promethus依赖node_exporter来采集信息

cd /usr/src/
wget https://github.com/prometheus/node_exporter/releases/download/v0.18.1/node_exporter-0.18.1.linux-amd64.tar.gz
tar xf node_exporter-0.18.1.linux-amd64.tar.gz  -C /usr/local/
cd  /usr/local/
ln -s node_exporter-0.18.1.linux-amd64  node_exporter

制作systemctl方式启动node_exporter

cat >  /usr/lib/systemd/system/node_exporter.service  <<  EOF
[Unit]
Description=Prometheus node exporter
After=local-fs.target network-online.target network.target
Wants=local-fs.target network-online.target network.target

[Service]
Restart=on-failure
ExecStart="/usr/local/node_exporter/node_exporter"

[Install]
WantedBy=multi-user.target
EOF

制作node_exporter服务启动

systemctl enable node_exporter.service     ##制作开机启动node_exporter
systemctl start node_exporter.service          ##启动node_exporter
systemctl status node_exporter.service       ##查看node_exporter状态

访问方式

http://localhost:9090

获取主机信息

curl http://localhost:9090/metrics

如需要设置报警面板显示和监控多台机器可参考142机器的promethus.yml

promethus粘贴复制式部署文档

标签:rest   ocs   conf   eth   https   down   com   pre   参考   

原文地址:https://www.cnblogs.com/sxgaofeng/p/12408601.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!