下载Prometheus二进制文件
wget https://github.com/prometheus/prometheus/releases/download/v2.47.2/prometheus-2.47.2.linux-amd64.tar.gz
解压缩,查看文件内容
tar -xf prometheus-2.47.2.linux-amd64.tar.gz -C /usr/local/
root@node1:~/prometheus-2.47.2.linux-amd64# tree
.
├── console_libraries
│ ├── menu.lib
│ └── prom.lib
├── consoles
│ ├── index.html.example
│ ├── node-cpu.html
│ ├── node-disk.html
│ ├── node.html
│ ├── node-overview.html
│ ├── prometheus.html
│ └── prometheus-overview.html
├── LICENSE
├── NOTICE
├── prometheus # prometheus二进制程序文件
├── prometheus.yml
└── promtool # prometheus配置文件查看工具
创建软链接
root@node1:~# ln -s /usr/local/prometheus-2.47.2.linux-amd64/ /usr/local/prometheus
创建Service文件
root@node1:/usr/local/prometheus# cat /etc/systemd/system/prometheus.service
[Unit]
Description=Prometheus
After=network.target
[Service]
WorkingDirectory=/usr/local/prometheus
ExecStart=/usr/local/prometheus/prometheus --config.file="/usr/local/prometheus/prometheus.yml"
[install]
WantedBy=multi-user.target
发动服务
systemctl daemon-reload
systemctl start prometheus.service
拜访服务
默认端口9090