资源规划
| 组件 | 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 /sharewget https://github.com/prometheus/pushgateway/releases/download/v0.8.0/pushgateway-0.8.0.linux-amd64.tar.gztar -xvzf pushgateway-0.8.0.linux-amd64.tar.gzrm -rf /usr/local/prometheus/pushgatewaymv /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.servicevi /usr/lib/systemd/system/pushgateway.service
配置如下:
[Unit]Description=pushgatewayDocumentation=https://prometheus.io/After=network.target[Service]Type=simpleUser=prometheusExecStart=/usr/local/prometheus/pushgateway/pushgatewayRestart=on-failure[Install]WantedBy=multi-user.target
启动
# 方式1systemctl daemon-reloadsystemctl enable pushgatewaysystemctl start pushgatewaysystemctl stop pushgateway# 方式2cd /usr/local/prometheus/pushgateway./pushgateway &
验证
systemctl status pushgatewayps -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.serviceps -ef | grep prometheus# 端口查看netstat -anpt
Targets UI:http://192.168.0.101:9090/targets
