You can get a "snapshot" of what licenses are in use from the command:
lmutil lmstat -f <featurename> -c <path_to_license_server>
lmutil lmstat -f dmscapacuser -c 1717@myserver
However, I do not recommend you use "lmstat" regularly in a script more than once every 10 minutes. "lmstat" takes priority over license checkouts, and will cause slow checkout performance if used too much.
Regarding xDM Library Server, I believe that you will see all the licenses checked out by "mgcserveruser" or your local equivalent user. You can then use the Admin tool to get details of the actual users. This is probably too complex to answer in the discussion forum, so please raise a service request via Supportnet and a local support engineer can give you more details if you need them.
I tested your command,but I cannot monito dmscapacuser.
I can monitor the next command
lmutil lmstat -f dmscapusr100
However, It is not what I expect.
I will discuss with Mentor Japan about this problem.