|
5.4.3 Using MonitorLM
MonitorLM is now a stand-alone application that can run on Windows, Unix, or Mac OS X. This replaces the old monitorlm script that was available only for Unix platforms. MonitorLM gives information on the total number of licenses available and checked out, the fully qualified domain and username of those who have them checked out, and so on. MonitorLM can send output to the terminal, open a web browser, or write to a file. The output for MonitorLM is customizable by means of a configuration file.
Starting MonitorLM
To start MonitorLM, change the directory to the location in which MathLM is installed, type .\monitorlm server, then press (on Windows or Unix) or (on Mac OS X). The first argument of the monitorlm command specifies the name of the license server running MathLM. If you do not specify a server name explicitly, the local machine name is chosen as the default.
MonitorLM Command-Line Options
The following options are available using the monitorlm command. The syntax for specifying an option is: monitorlm servername options.
-template file. Specifies the file that acts as a template for the output of MonitorLM.
-output file. Specifies the file to which output should be directed. If this option is not set, MonitorLM will write to stdout. The format of the output is determined by the -format option.
-localtime uses local time, instead of GMT, in all references to time.
-format f. Specifies the format for the output of MonitorLM. The possible values are:
text sends output in text format to stdout. This is the default for Unix.
html sends output in HTML format to a temporary file and launches a web browser to display the file. This is the default for Windows and Mac OS X.
cgi sends output in HTML format to stdout. This is used when MonitorLM is launched directly by a web browser.
file sends output to stdout in the format given in the specified file.
This shows what the output of MonitorLM looks like, with -format set to text.
 This shows what the output of MonitorLM looks like in a web browser, with -format set to html.
 This shows what the output of MonitorLM looks like in a web browser, with -format set to cgi.
 Customizing the Output of MonitorLM
You can customize the content and format of the output from MonitorLM by editing a template file. This is a plain text file, which can contain the following types of elements.
- Constant Tags—These tags represent data that is static during the execution of MonitorLM and license-independent, such as the current date. Each of these tag names has the prefix CONST.
- Variable Tags—These tags act as wrappers to constant tags. They are useful in defining the format for data to be outputted in series, for example, the table of current MathLM users. They are useful for improving readability of the template file. Each of these tag names has the prefix VAR.
- Process-dependent Tags—The value of these tags depends upon which Mathematica process is being displayed and includes data like the process owner's username and IP address. Each of these tag names has the prefix PROC.
- Repeated Tags—These tags serve as placeholders for information regarding an unknown number of licenses. They are the only tags whose size is not predetermined. Only the checkout lines are repeated, and there is one checkout line per license. Each of these tag names has the prefix REP.
- Text Wrappers—This is the text that a user can wrap around the tags, for presentation and formatting.
Each tag in the template file has the form %var#, where
-
var represents a variable whose value is provided by the server.
-
# is a number defining a specific format for the display of the variable var.
In addition to the %var# commands, the template file can also include plain text such as brackets, dashes, quotation marks, and arbitrary comments. The text can be used to include comments and separators in the server messages for formatting purposes. All text included in the string appears literally in the server message with the following two exceptions: use %q to include a double quote ("), and use %% to include a percentage sign (%).
Here is a list of tag names that can be included in the template file along with the numeric values for their possible formats.
Predefined Constant Tags
%CONST_DATE_D#
Day of month [ 1 ... 31 ]
%CONST_DATE_W#
Day of week
1 - Numeric [ 1 ... 7 ]
2 - Abbreviated [ Sun ... Sat ]
3 - Verbose [ Sunday ... Saturday ]
%CONST_DATE_M#
Month
1 - Numeric [ 1 ... 12 ]
2 - Abbreviated [ Jan ... Dec ]
3 - Verbose [ January ... December ]
%CONST_DATE_Y#
Year
1 - Two-digit [ 03 ]
2 - Four-digit [ 2003 ]
%CONST_DATE_T#
Time
1 - Twelve-hour [ 10:20:15 ]
2 - Twenty-four-hour [ 22:20:15 ]
3 - GMT offset [ -0500 ]
%CONST_SERVER_IP
MathLM IP address.
%CONST_SERVER_HOST
MathLM hostname.
%CONST_SERVER_DOMAIN
MathLM domain.
%CONST_SERVER_FQDN
MathLM FQDN.
%CONST_SERVER_VERSION
MathLM version.
%CONST_CA_FE_AUTHORIZED
Number of class A front ends authorized.
%CONST_CB_FE_AUTHORIZED
Number of class B front ends authorized.
%CONST_CX_FE_AUTHORIZED
Number of class X front ends authorized.
%CONST_TOTAL_FE_AUTHORIZED
Total number of front ends authorized.
%CONST_CA_KE_AUTHORIZED
Number of class A kernels authorized.
%CONST_CB_KE_AUTHORIZED
Number of class B kernels authorized.
%CONST_CX_KE_AUTHORIZED
Number of class X kernels authorized.
%CONST_TOTAL_KE_AUTHORIZED
Total number of kernels authorized.
%CONST_CA_FE_AVAILABLE
Number of class A front ends available.
%CONST_CB_FE_AVAILABLE
Number of class B front ends available.
%CONST_CX_FE_AVAILABLE
Number of class X front ends available.
%CONST_TOTAL_FE_AVAILABLE
Total number of front ends available.
%CONST_CA_KE_AVAILABLE
Number of class A kernels available.
%CONST_CB_KE_AVAILABLE
Number of class B kernels available.
%CONST_CX_KE_AVAILABLE
Number of class X kernels available.
%CONST_TOTAL_KE_AVAILABLE
Total number of kernels available.
%CONST_CA_FE_OUT
Number of class A front ends checked out.
%CONST_CB_FE_OUT
Number of class B front ends checked out.
%CONST_CX_FE_OUT
Number of class X front ends checked out.
%CONST_TOTAL_FE_OUT
Total number of front ends checked out.
%CONST_CA_KE_OUT
Number of class A kernels checked out.
%CONST_CB_KE_OUT
Number of class B kernels checked out.
%CONST_CX_KE_OUT
Number of class X kernels checked out.
%CONST_TOTAL_KE_OUT
Total number of kernels checked out.
Customizable Variable Tags
%VAR_DATE_AMPM = "A.M." "P.M."
Specify the text to use for a.m. and p.m. when displaying time.
%VAR_MPROCESS = "FE" "KE"
Title for Mathematica processes. The first string in quotes is the front end title and the second is the kernel title.
%VAR_LIC_CLASS = "A" "B" "X"
Labels for each class of processes.
%VAR_CA_AUTHORIZED_HEADER = "A \t %CONST_CA_FE_AUTHORIZED \t %CONST_CA_KE_AUTHORIZED"
Number of authorized class A licenses.
%VAR_CB_AUTHORIZED__HEADER
Number of authorized class B licenses.
%VAR_CX_AUTHORIZED_HEADER
Number of authorized class C licenses.
%VAR_TOTAL_AUTHORIZED_HEADER
Total number of authorized licenses.
%VAR_CA_CHECKEDOUT_HEADER = "A \t %CA_FE_OUT \t %CA_KE_OUT \nSlot # \t Program \t User \t Host"
Number of class A licenses checked out.
%VAR_CB_CHECKEDOUT_HEADER
Number of class B licenses checked out.
%VAR_CX_CHECKEDOUT_HEADER
Number of class X licenses checked out.
%VAR_CHECKEDOUT_HEADER = "%CONST_TOTAL_FE_OUT\t CONST_TOTAL_KE_OUT \n Slot Number \t Program \t User \t Host"
Total number of licenses checked out.
Process-dependent Tags
%PROC_UID
User ID of Mathematica process owner.
%PROC_USER
Username of Mathematica process owner.
%PROC_IP
IP address of machine taking Mathematica process.
%PROC_HOST
Hostname of machine taking Mathematica process.
%PROC_DOMAIN
Domain of machine taking Mathematica process.
%PROC_FQDN
Fully qualified domain name of machine taking Mathematica process.
%PROC_SLOTNUM
Slot number of Mathematica process.
%PROC_VERSION
Version of client.
%PROC_DURATION
Time client has been running.
Repeated Tags
%REP_CA_CHECKOUT_LINE = "%LCLASS \t %MP \t %USER \t %FQDN"
Class A checkout line. This specifies the format of each line in the table/block that lists the checked-out class A processes.
%REP_CX_CHECOUT_LINE
Class X checkout line.
%REP_CB_CHECKOUT_LINE
Class B checkout line.
%REP_GENERAL_CHECKOUT_LINE
General checkout line. Use this if you do not want to separate classes.
Samples and Behavior
Here is a simple comma-delimited text file that just shows the number of processes authorized, available, and taken. This example does not need to define any variable definition tags.
%TEXT
Time/Date : [%CONST_DATE_T2] [%CONST_DATE_M3 %CONST_DATE_D, %CONST_DATE_Y2]
Front End Processes Authorized, %CONST_TOTAL_FE_AUTHORIZED
Kernel Processes Authorized, %CONST_TOTAL_KE_AUTHORIZED
Front End Processes Available, %CONST_TOTAL_FE_AVAILABLE
Kernel Process Available, %CONST_TOTAL_KE_AVAILABLE
Front End Processes Taken, %CONST_TOTAL_FE_OUT
Kernel Processes Taken, %CONST_TOTAL_KE_OUT
The resulting output has the form shown below.
 Here is a slightly more sophisticated example. It is identical to the one above except that it also lists the processes taken.
# Begin variable tag definitions
%VAR_MPROCESS = "FE" "KE"
%VAR_TOTAL_CHECKEDOUT_HEADER = "Slot\t Program\t User\t Host\n"
%REP_GENERAL_CHECKOUT_LINE = "%PROC_SLOTNUM\t %VAR_MPROCESS\t %PROC_USER\t %PROC_HOST\n"
%TEXT
Time/Date : [%CONST_DATE_T2] [%CONST_DATE_M3 %CONST_DATE_D, %CONST_DATE_Y2]
Front End Processes Authorized, %CONST_TOTAL_FE_AUTHORIZED
Kernel Processes Authorized, %CONST_TOTAL_KE_AUTHORIZED
Front End Processes Available, %CONST_TOTAL_FE_AVAILABLE
Kernel Process Available, %CONST_TOTAL_KE_AVAILABLE
Front End Processes Taken, %CONST_TOTAL_FE_OUT
Kernel Processes Taken, %CONST_TOTAL_KE_OUT
%VAR_TOTAL_CHECKEDOUT_HEADER
%REP_GENERAL_CHECKOUT_LINE
The resulting output has the form shown below.
 The following example demonstrates HTML output. This is useful, for example, if you want to view the MonitorLM output in a web browser.
%VAR_MPROCESS = "Front End" "Kernel"
%VAR_TOTAL_CHECKEDOUT_HEADER = "<TR><TD><B>Slot</B></TD> <TD><B>Program</B></TD> <TD><B>User</B></TD> <TD><B>FQDN</B></TD> </TR>\n"
%REP_GENERAL_CHECKOUT_LINE = "<TR> <TD>%PROC_SLOTNUM</TD> <TD>%VAR_MPROCESS</TD> <TD>%PROC_USER</TD> <TD>%PROC_FQDN</TD> </TR>\n"
%TEXT
<HTML>
<HEAD> <TITLE> MathLM Status </TITLE> </HEAD>
<BODY>
<TABLE BORDER=1 CELLPADDING=5>
<TR><TD COLSPAN=2><B>MathLM Server</B></TD> <TD COLSPAN=2><B>%CONST_SERVER_FQDN</B></TD> </TR>
<TR><TD COLSPAN=2>Time/Date</TD> <TD COLSPAN=2>[%CONST_DATE_T2] [%CONST_DATE_M3 %CONST_DATE_D, %CONST_DATE_Y2]</TD> </TR>
<TR><TD COLSPAN=2>Authorized</TD> <TD>%CONST_TOTAL_FE_AUTHORIZED</TD> <TD>%CONST_TOTAL_KE_AUTHORIZED</TD></TR>
<TR><TD COLSPAN=2>Available</TD> <TD>%CONST_TOTAL_FE_AVAILABLE</TD> <TD>%CONST_TOTAL_KE_AVAILABLE</TD></TR>
<TR><TD COLSPAN=2>Checked Out</TD> <TD>%CONST_TOTAL_FE_OUT</TD> <TD>%CONST_TOTAL_KE_OUT</TD></TR>
%VAR_TOTAL_CHECKEDOUT_HEADER
%REP_GENERAL_CHECKOUT_LINE
</TABLE>
</BODY>
</HTML>
The resulting output has the form shown below.
 |