Slurm need to be configured with JobAcctGatherType=jobacct_gather/cgroup. Stats are collected from the cgroups created by Slurm for each job.