For monitoring and load balancing purposes, I'd like to count the number of connected (NFS) clients to Ganesha.

I tried to do this, but didn't get very far:
For NFSv3, I increment a gauge (counter) on mount and decrement on umount.
For NFSv4, I'm not sure how to do this. I don't understand how connections are established.

Questions:
What is the most accurate way of counting clients?
Which code accepts and closes TCP sessions for nfsv4?
What happens when an nfsv3 goes away without issuing a umount call?

Thanks,
Bjorn