47 lines
1.2 KiB
Bash
47 lines
1.2 KiB
Bash
#!/bin/bash
|
|
|
|
#add user
|
|
useradd -s /bin/false pve-exporter
|
|
|
|
# pacotes e dependencias do python
|
|
|
|
apt update && apt install python3-venv python3-setuptools python3-dev python3-pip libffi-dev libssl-dev build-essential -y && apt install python3-pip -y
|
|
|
|
# Crie e ative o venv, instale o prometheus-pve-exporter
|
|
python3 -m venv /opt/prometheus-pve-exporter source /opt/prometheus-pve-exporter/bin/activate
|
|
|
|
pip install prometheus-pve-exporter
|
|
|
|
deactivate
|
|
|
|
# criando yml do pve exporter
|
|
|
|
touch /etc/prometheus/pve.yml
|
|
|
|
echo '
|
|
default:
|
|
user: pve-exporter@pve
|
|
password: <password>
|
|
verify_ssl: false ' > /etc/prometheus/pve.yml
|
|
|
|
chown root:pve-exporter /etc/prometheus/pve.yml
|
|
chmod 640 /etc/prometheus/pve.yml
|
|
|
|
# set permissions
|
|
echo '[Unit]
|
|
Description=Prometheus Proxmox VE Exporter
|
|
Documentation=https://github.com/prometheus-pve/prometheus-pve-exporter
|
|
|
|
[Service]
|
|
Restart=always
|
|
User=pve-exporter
|
|
ExecStart=/opt/prometheus-pve-exporter/bin/pve_exporter --config.file /etc/prometheus/pve.yml
|
|
|
|
[Install]
|
|
WantedBy=multi-user.target' > /etc/systemd/system/prometheus-pve-exporter.service
|
|
|
|
# enable pve-exporter
|
|
systemctl daemon-reload
|
|
systemctl enable prometheus-pve-exporter.service
|
|
systemctl start prometheus-pve-exporter.service
|