MATLAB Answers

3

How do I monitor the usage of license keys for MATLAB and toolboxes?

I would like to monitor the usage (number of users) of license keys for MATLAB and other MathWorks products.

Tags

No tags entered yet.

1 Answer

Answer by MathWorks Support Team on 9 Aug 2018
Edited by MathWorks Support Team on 9 Aug 2018
 Accepted Answer

If you have a network license, there are several ways to monitor license usage.
*(1) *To check current license usage, you can use the lmstat function (if the license server is running Linux or Mac OS X).
The lmstat function will display the following information:
- Username of person that checked out the license.
- Hostname of computer that the license was checked out on.
- Date and time that license was checked out.
To use the lmstat function, open Terminal and run the following commands.
Linux:
cd $MATLABROOT/etc/glnxa64
./lmutil lmstat -a
Mac:
cd $MATLAB/etc/maci64
./lmutil lmstat -a
Windows:
- Open the folder $MATLABROOT\etc\win64
- Run "lmtools.exe".
- Go to the "Server Status" tab.
- Click on "Perform Status Enquiry".
For more information about lmtools, please see the following documentation:
Alternatively, you can open Command Prompt and run the following commands.
R2011a and later (64-bit):
cd $MATLABROOT\etc\win64
lmutil lmstat -c license.dat -a
R2011a and later (32-bit):
cd $MATLABROOT\etc\win32
lmutil lmstat -c license.dat -a
R2010b and earlier:
cd $MATLABROOT\flexlm
lmutil lmstat -c license.dat -a
By default, $MATLABROOT = C:\Program Files\MATLAB\R20XXx
If you cannot find the above directories, you may not be on the license server. Please refer to following support article:
Is there a way for licenses to be monitored from the client machine instead of the server?
(2) For a long-term record of license usage, view the license manager log file.
The license manager log file will show license check-ins and check-outs.
When someone starts using a product, it checks out a key.
When someone stops using a product, it checks the key back in
Linux:
/var/tmp/lm_TMW.log
Mac:
/var/tmp/lm_TMW.log
Windows:
$MATLABROOT\etc\lmlog.txt
You can also view the log file in lmtools.exe.
- Go to "Config Services" tab.
- Click on "View Log".
The log will be displayed in a pop-up window.
Example of lmlog.txt:
11:40:22 (lmgrd) -----------------------------------------------
11:40:22 (lmgrd) Please Note:
11:40:22 (lmgrd)
11:40:22 (lmgrd) This log is intended for debug purposes only.
11:40:22 (lmgrd) There are many details in licensing policies
11:40:22 (lmgrd) that are not reported in the information logged
11:40:22 (lmgrd) here, so if you use this log file for any kind
11:40:22 (lmgrd) of usage reporting you will generally produce
11:40:22 (lmgrd) incorrect results.
11:40:22 (lmgrd)
11:40:22 (lmgrd) -----------------------------------------------
11:40:22 (lmgrd)
11:40:22 (lmgrd)
11:40:22 (lmgrd) Done rereading
11:40:22 (lmgrd) FLEXnet Licensing (v11.4.0.0 build 31341) started on license_server (IBM PC) (4/20/2008)
11:40:22 (lmgrd) Copyright (c) 1988-2006 Acresso Software Inc. All Rights Reserved.
11:40:22 (lmgrd) US Patents 5,390,297 and 5,671,412.
11:40:22 (lmgrd) World Wide Web: <http://www.acresso.com>
11:40:22 (lmgrd) License file(s): C:\Program Files\MATLAB\R2007a\flexlm\license.dat
11:40:22 (lmgrd) lmgrd tcp-port 27000
11:40:22 (lmgrd) Starting vendor daemons ...
11:40:22 (lmgrd) Started MLM (pid 10216)
11:40:22 (MLM) Server started on license_server for:MATLAB
11:40:22 (MLM) SIMULINK
11:40:22 (lmgrd) MLM using TCP-port 1253
11:40:24 (MLM) OUT: "MATLAB" jsmith@license_server
11:51:04 (MLM) IN: "MATLAB" jsmith@license_server
12:18:07 (MLM) OUT: "MATLAB" jsmith@license_server
12:20:25 (MLM) OUT: "SIMULINK" jsmith@license_server
This logfile indicates that the user jsmith took out a MATLAB key from the server license_server at 11:40 and that it was returned at 11:51 when he exited MATLAB. Then, at 12:18 he took out a MATLAB key again, and this time, took out a SIMULINK key at 12:20.
(3) Flexera Software offers FlexNet Manager, which is software used for tracking and monitoring license usage.
For more information, please visit Flexera's website:

  3 Comments

Historically speaking, I used to find the license logging a bit fragile. In the case of MATLAB crashing, or even just the user closing the terminal session without logging out, the return of the keys did not always get logged.
Could you elaborate on "Used to"? Is it better now?
In my experience, a dirty exit (matlab crash) has actually kept the keys checked out, and prevented others from being able to get a key - slightly different from an unlogged return.
I have not administered a license server for over 7 years, so I do not know if it has improved.

Sign in to comment.