Proxmox Virtual Environment is a hypervisor on which you can host Virtual Machines and containers. It is a complex environment with open-source clustering and advanced backup and network capabilities. Therefore, it is really important to have a proper network insight, and in this blog post we will show just how easy it is to set everything up. Let's get started.

First, we need to install hsflowd package. Depending on your distro (Proxmox VE - short PVE - 5, 6, 7 or other series), install it with:

apt install hsflowd -y

If you don't have the package in your repo, you can download the latest version from the following link: Host sFlow, and then install it.

For example, let's say you have PVE 7. The procedure would be:

wget https://github.com/sflow/host-sflow/releases/download/v2.0.29-7/hsflowd-ubuntu20nvml_2.0.29-7_amd64.deb
dpkg -i hsflowd-ubuntu20nvml_2.0.29-7_amd64.deb

To enable the app, use:

systemctl enable hsflowd

Afterward, we need to make necessary configurations on hsflowd side, by editing /etc/hsflowd.conf:

sflow {
  ...
  # collectors:
  collector { ip=172.16.4.226 udpport=6343 }
  ...
  pcap { dev = vmbr0 }
  # Open vSwitch sFlow configuration:
  ovs { }
  # KVM (libvirt) hypervisor and VM monitoring:
  kvm { }
  ...
}

As you may have noticed, there is an OvS sFlow export. To learn more on OvS NetFlow configuration, check out our post where we have covered it in detail: Open vSwitch NetFlow configuration. However, if you are not using OvS, then you would need to set it up.

IP and port are inserted for your NetLlow Analyzer, and pcap { dev = vmbr0 } is your bridge name (it could be named differently, so keep that in mind). By default, the hsflowd process collects with a sampling rate of 400, but you can change it if you need to.

To review all configuration parameters, you can check out /etc/the hsflowd.auto:

# WARNING: Do not edit this file. It is generated automatically by hsflowd.
rev_start=1
hostname=SPS2
sampling=400
header=128
datagram=1400
polling=30
agentIP=172.16.0.110
agent=vmbr0.701
ds_index=1
collector=172.16.4.226/6343//
rev_end=1

That should do it for the NetFlow configuration. Should you need a device and interface discovery, don't forget to install and enable SNMP.