PVE主机上安装proxmox-pve-exporter(prometheus监控)

1.创建用户

groupadd --system prometheus
useradd -s /sbin/nologin --system -g prometheus prometheus
mkdir /etc/prometheus/

2.安装软件

--break-system-packages选项的作用是告诉pip忽略当前环境的外部管理,并强制安装Python包到当前环境中。这对于在特定环境中管理Python包非常有用,比如虚拟环境或用户级别的Python包管理。

apt install python3 python3-pip
pip3 install prometheus-pve-exporter --break-system-packages

3.创建配置文件

vi /etc/prometheus/pve.yml

4.填入下面的内容

pve宿主机的账号密码

default:
  user: root@pam
  password: your_password_here
  verify_ssl: false

5.设置权限

chown -R prometheus:prometheus /etc/prometheus/
chmod -R 775 /etc/prometheus/

6.创建systemed

第四行可以注释掉

tee /etc/systemd/system/prometheus-pve-exporter.service<<EOF
[Unit]
Description=Prometheus exporter for Proxmox VE
#Documentation=https://github.com/znerol/prometheus-pve-exporter

[Service]
Restart=always
User=prometheus
ExecStart=/usr/local/bin/pve_exporter --config.file /etc/prometheus/pve.yml

[Install]
WantedBy=multi-user.target
EOF

7.设置开机启动

systemctl daemon-reload
systemctl start prometheus-pve-exporter
systemctl enable prometheus-pve-exporter

此时输入pve_ip:9221/pve 。就可以进入一个页面 

 

 8.在prometheus上面添加监控配置

vi /etc/prometheus/prometheus.yml

 在最后写入

- job_name: 'proxmox'
  metrics_path: /pve
  static_configs:
  - targets: ['10.13.14.2:9221']

注意,在target处,替换自己的pve_ip。同时注意格式,对齐。

 

重启一下服务 

systemctl restart prometheus

 说明:关注grafana+prometheus安装配置这里不说明,服务器监控可以使用node-exporter客户端

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值