Using JMX Tools to Manage SAS Resources

About JMX and MBeans

SAS servers implement common administrative interfaces. These interfaces enable you to perform basic administrative functions such as stopping, pausing, and resuming servers. You can also use the interfaces to monitor the health of the servers via real-time and historical metrics. Java Management Extensions (JMX) is a Java technology that supplies tools for managing and monitoring applications, system objects, devices (such as printers), and service-oriented networks. JMX managed beans, known as MBeans, have been implemented to provide a standard way of managing SAS resources.

Accessing the SAS MBeans

About Accessing the SAS MBeans

You can use any of the standard JMX monitoring tools to access the MBeans that manage SAS resources. To use these tools, you must do the following:
  1. Enable access to the MBeans from the Web application server. See Configure the Web Application Server to Enable JMX Client Access.
  2. Use an application to connect and access the SAS MBeans. Follow the specific instructions for your JMX tool. For information about using the JConsole tool, see Manage SAS Resources Using JConsole.

Configure the Web Application Server to Enable JMX Client Access

You configure the Web application server to enable access to the MBeans by setting specific Java system options.
Specify the following Java Virtual Machine (JVM) argument to access the MBeans locally:
com.sun.management.jmxremote
Specify the following JVM argument to access the MBeans from a remote system. Replace portNum with the port number to use for JMX RMI connections:
com.sun.management.jmxremote.port=portNum
Remote monitoring and management requires security to ensure that unauthorized persons cannot control or monitor your application. It is recommended that you set the following JVM arguments when MBeans are accessed remotely:
com.sun.management.jmxremote.authenticate=true | false
com.sun.management.jmxremote.ssl=true  | false
For information about these arguments, see the Java documentation.

Manage SAS Resources Using JConsole

JConsole is a JMX tool that is included with the standard Java Development Kit (JDK). The information provided through JMX technology enables JConsole to provide information about application performance and functions. You can use JConsole to interact with the JMX MBeans that are available to manage SAS resources. The console's simple user interface displays all MBeans in a tree navigator on the left side of the window. When you select a specific MBean, its attributes, operations, notifications, and other information are displayed on the right side of the window.
To access information about SAS resources using JConsole, follow these steps:
  1. Start JConsole by running the following command:
    JDK-HOME\bin\jconsole
  2. Connect to the MBean server as follows:
    • If you are accessing the MBeans locally, the Local tab should display every JVM that is running on the local system that was started with the same user ID as JConsole. Select the appropriate JVM and click Connect.
    • If you are accessing the MBeans remotely, follow these steps:
      1. Select the Remote tab.
      2. Enter the host on which the JVM is running, along with the port where the RMI connector was registered.
      3. You might need to specify credentials if authentication to the MBean server is required.
      4. Click Connect to connect to the MBean server.
  3. Select the MBeans tab. This tab displays a tree view of all the registered MBeans.
  4. Expand the com.sas.services domain to see all MBeans registered in this domain.
  5. Select the ServerFactory MBean.
  6. In the right pane, select the Operations tab. You can now see the operations (listing, stopping, pausing, and so on) so that you can list the defined SAS servers and manage your running SAS servers. When you invoke one of the manage-server operations, a new MBean is registered that is connected to the specified, running SAS server. The newly registered MBean can then be used to manage and monitor that particular SAS server.

Understanding How to Use the SAS MBeans

About the SAS MBeans

There are three primary MBeans provided by the SAS Web Infrastructure Platform for managing and monitoring SAS resources:
  • ServerFactory MBean
  • Spawner MBean
  • Server MBean
The following sections describe these MBeans.

ServerFactory MBean

The ServerFactory MBean is the starting point for managing SAS servers. This MBean is registered during deployment of the SAS Web Infrastructure Platform and is named as follows:
com.sas.services:type=ServerFactory
During initialization, the ServerFactory MBean connects to the SAS Metadata Server. This enables the MBean to list all SAS servers defined in the metadata. The MBean can then be used to register additional MBeans that enable the running servers to be managed and monitored directly. The ServerFactory MBean does not have any attributes, but supports three operations:
listDefinedServers()
provides a list of SAS IOM servers that are defined in the Metadata Server. Information that is returned for each defined server includes the server name, host, port, and server type. To begin actively managing a server, specify the name of the server on the manageServerByName operation.
manageServerByName(String ServerName, String Host)
registers a Server MBean that enables you to actively manage the specified IOM server. The newly registered MBean connects to the running IOM server and can then be used to manage and monitor that server. The host name can be left blank if the IOM server is defined to run on only one host. If defined to run on multiple hosts, the proper host name should be provided.
The manageServerByName() operation does not work on a server that is spawned by the SAS Object Spawner.
manageServer(String Host, Integer Port, String Username, String Password)
registers a Server MBean that enables you to actively manage the specified IOM server. The IOM server that is managed is identified by the host and port provided on the manageServer operation. The newly registered MBean can be used to manage and monitor that specific IOM server. This operation is useful when the IOM server is not defined in the Metadata Server.

Spawner MBean

The Spawner MBean is created whenever an IOM Spawner is identified in one of the ServerFactory MBean's manageServer operations. The name of the registered MBean uses the form:
com.sas.services:type=Server,serverType=Spawner,
     name="Server Name",
     host=Host Name,port=Port
The Spawner MBean enables you to manage and monitor the running Object Spawner. You can perform SAS Spawner operations such as stop, pause, and resume.
Here are some commonly used Spawner MBean attributes:
  • the number of times the counters have been reset
  • the amount of time the server has been idle
  • the number of currently connected clients
  • the server start time
  • the number of currently abandoned servers
  • the number of currently launched servers
  • the total number of servers that have been launched
  • the number of currently failed servers
  • the process identifier of the server process
  • the amount of time spent in server method calls
  • the number of method calls that the server has processed

Server MBean

The Server MBean is created whenever a SAS server is identified in one of the ServerFactory MBean's manageServer operations or when a server is managed via the Spawner MBean's manageLaunchedServer(s) operation.
A server MBean can represent a SAS Workspace Server, a SAS Stored Process Server, a SAS Framework Data Server, a SAS Metadata Server, or a SAS OLAP Server. The name of the registered SAS Server MBean uses one of these three forms:
com.sas.services:type=Server, serverType=Workspace, logicalServer=
     "LogicalServerName", name="Server Name",
     instanceid="Unique instance ID"
com.sas.services:type=Server, serverType=StoredProcess, logicalServer=
     "LogicalServerName", name="Server Name", 
     instanceid="Unique instance ID"
com.sas.services:type=Server, serverType=Table, logicalServer=
     "LogicalServerName", name="Server Name",
     host=Host Name, 
     port=Port Number
The Server MBean enables you to manage and monitor the running SAS server. You can perform server operations such as stop, pause, and resume.
Here are some commonly used Server MBean attributes:
  • the number of times the counters have been reset
  • the amount of time the server has been idle
  • the number of currently connected clients
  • the server start time
  • the last time the counters were reset
  • the execution state of the server
  • the amount of time spent in server method calls
  • the number of method calls that the server has processed
  • the number of clients that the server has serviced
  • the process identifier of the server process
  • the identity under which the server process is executing