安装包下载
mkdir /data && cd /data
wget https://github.com/prometheus/prometheus/releases/download/v2.30.0/prometheus-2.30.0.linux-amd64.tar.gz
tar zxvf prometheus-2.30.0.linux-amd64.tar.gz
ln -s prometheus-2.30.0.linux-amd64 prometheus
wget https://github.com/prometheus/pushgateway/releases/download/v1.4.1/pushgateway-1.4.1.linux-amd64.tar.gz
tar zxvf pushgateway-1.4.1.linux-amd64.tar.gz
ln -s pushgateway-1.4.1.linux-amd64 pushgateway
修改配置文件
mkdir /data/prometheus/data
vim /data/prometheus/prometheus.yml
新增:
- job_name: 'pushgateway'
static_configs:
- targets: ['localhost:9091']
labels:
instance: pushgateway
启动prometheus
nohup /data/prometheus/prometheus --config.file=/data/prometheus/prometheus.yml \
--storage.tsdb.path=/data/prometheus/data > /data/prometheus/prometheus.log 2>&1 &
启动pushgateway
nohup /data/pushgateway/pushgateway > /data/pushgateway/pushgateway.log 2>&1 &
prometheus与pushgateway停止
ps -ef | grep prometheus
ps -ef | grep pushgateway
通过以上方法找出相关进行,然后通过kill命名进行停止。