资源规划
组件 | bigdata-node1 | bigdata-node2 | bigdata-node3 |
---|---|---|---|
OS | centos7.6 | centos7.6 | centos7.6 |
Prometheus | Prometheus | N.A | N.A |
Pushgateway | pushgateway | N.A | N.A |
安装介质
版本:pushgateway-0.8.0.linux-amd64.tar.gz
下载:https://prometheus.io/download/#pushgateway
环境准备
安装Prometheus
参考:《CentOS7.6-安装Prometheus-2.10.0》
安装Pushgateway
解压缩
cd /share
wget https://github.com/prometheus/pushgateway/releases/download/v0.8.0/pushgateway-0.8.0.linux-amd64.tar.gz
tar -xvzf pushgateway-0.8.0.linux-amd64.tar.gz
rm -rf /usr/local/prometheus/pushgateway
mv /share/pushgateway-0.8.0.linux-amd64 /usr/local/prometheus/pushgateway
授权
chown -R prometheus:prometheus /usr/local/prometheus/pushgateway
服务配置
rm -rf /usr/lib/systemd/system/pushgateway.service
vi /usr/lib/systemd/system/pushgateway.service
配置如下:
[Unit]
Description=pushgateway
Documentation=https://prometheus.io/
After=network.target
[Service]
Type=simple
User=prometheus
ExecStart=/usr/local/prometheus/pushgateway/pushgateway
Restart=on-failure
[Install]
WantedBy=multi-user.target
启动
# 方式1
systemctl daemon-reload
systemctl enable pushgateway
systemctl start pushgateway
systemctl stop pushgateway
# 方式2
cd /usr/local/prometheus/pushgateway
./pushgateway &
验证
systemctl status pushgateway
ps -ef | grep pushgateway
# 端口查看
netstat -anpt
Prometheus服务配置
vi /usr/local/prometheus/prometheus.yml
配置如下(scrape_configs节点):
- job_name: 'pushgateway'
static_configs:
- targets: ['192.168.0.101:9091']
labels:
instance: 'pushgateway'
重启Prometheus服务:
systemctl restart prometheus.service
验证Prometheus
systemctl status prometheus.service
ps -ef | grep prometheus
# 端口查看
netstat -anpt
Targets UI:http://192.168.0.101:9090/targets