I thought that functionality was built into ZHA already?
EDIT: It is , you just download the diagnostic data, see: I tracked channel utilization with ZHA to find the best Zigbee channel - #4 by tristipasta
It would be nice if Z2M had a utility like this.