CentOS8 安装Prometheus
时间: 2024-12-12 13:14:22 浏览: 14
CentOS 8 安装 Prometheus 首先需要通过官方仓库添加其软件源,并更新系统。以下是安装步骤:
1. 添加Prometheus仓库:
```
curl -fsSL https://raw.githubusercontent.com/prometheus/prometheus/master/contrib/rpm/filelist | sudo tee /etc/yum.repos.d/prometheus-community.repo
```
2. 更新yum缓存:
```
sudo yum makecache fast
```
3. 安装Prometheus和必备依赖:
```
sudo yum install prometheus prometheus-operator -y
```
4. 启动Prometheus服务:
```
sudo systemctl start prometheus
```
5. 设置服务开机自启:
```
sudo systemctl enable prometheus
```
6. (可选)验证安装并查看监控状态:
```
sudo curl http://localhost:9090/graph
```
如果需要设置prometheus.yml配置文件,可以编辑`/etc/prometheus/prometheus.yml`。此外,为了全面管理Prometheus及其 alertmanager、kube-state-metrics等组件,还可以安装prometheus-operator。
阅读全文