Maybe you can use a ready made solution from
openlm
It is able to monitor user activity and release the license back to the pool when licenses are needed by other user. It also supply end user tool to query the availbility of licenses.
Network load is very low and the software is relaible and working in many sites.