- 下载
prometheus
并解压到目录/home/mhy/prometheus
- 建立软连接
sudo ln -s /home/mhy/prometheus/promtool /usr/bin/promtool
- 新建数据目录
mkdir /data/prometheus chmod +rw -R /data/prometheus
- 新建服务文件
vim /usr/lib/systemd/system/prometheus.service
[Unit] Description=Prometheus Server Documentation=https://prometheus.io/ After=network.target [Service] Type=simple User=root Group=root WorkingDirectory=/home/mhy/prometheus ExecStart=/home/mhy/prometheus/prometheus \ --web.listen-address=0.0.0.0:9090 \ --storage.tsdb.path="/data/prometheus" \ --config.file=prometheus.yml Restart=on-failure [Install] WantedBy=multi-user.target
- 相关命令:
promtool check config prometheus.yml #使用promtool工具来验证配置文件 systemctl start prometheus.service
网友评论