At home, I usually use RPi-4 as NAS and also for monitoring purposes. As hypervisor I use Proxmox and VMware.

This post is to share how I monitor my VMware cluster using vmware_exporter. Prometheus/Grafana Cloud will share in different post.

setup system

groupadd prometheus
useradd -d /opt/prometheus -g prometheus -m prometheus

install packages

python-venv

apt install python3-venv
python3 -m venv /opt/venv
source /opt/venv/bin/activate

vmware_exporter

pip install vmware_exporter

config

mkdir /opt/vmware_exporter
cd /opt/vmware_exporter
vim config.env
default:
  vsphere_host: "vcenter"
  vsphere_user: "administrator@vsphere.local"
  vsphere_password: ":D"
  ignore_ssl: True
  specs_size: 5000
  fetch_custom_attributes: True
  fetch_tags: True
  fetch_alarms: True
  collect_only:
    vms: True
    vmguests: True
    datastores: True
    hosts: True
    snapshots: True
cat << EOF > /etc/systemd/system/vmware_exporter.service
[Unit]
Description=vmware_exporter
After=syslog.target network.target

[Service]
Type=simple
User=prometheus
ExecStart=/opt/venv/bin/python3 /opt/venv/bin/vmware_exporter -c /opt/vmware_exporter/config.env
Restart=on-abort

[Install]
WantedBy=multi-user.target
EOF
systemctl daemon-reload
systemctl enable --now vmware_exporter

# just in case, wait 5 sec to give time vmware_exporter to scrap metrics
sleep 5; systemctl status vmware_exporter

# and
curl localhost:9272/metrics