JMX Notification Configuration

JMX Monitoring can be configured to send notifications using the notification service. This allows you to forward data from exposed MBeans to your configured notifiers.

Configuration

The JMX Monitoring configuration page can be found under Configurations<config-name>Monitoring.

Monitoring Page

From the Monitoring page, select the tab labelled JMX:

Full JMX Monitoring Page

The JMX page allows you to specify the time between notifications, how notifications will be delivered, and the MBeans which will be included within the message.

Enabling JMX Monitoring via the Admin Console

By default, both JMX and AMX start disabled.

To enable JMX Monitoring for the JVM, select Enabled:

JMX Monitoring Page

To enable AMX (recommended), go to General monitoring page and select AMX Enabled:

JMX Monitoring Page

In versions prior to Payara Server 4.1.2.182 or 5.182, the AMX Enabled option was available on the JMX Monitoring page.

Enabling JMX Monitoring via asadmin

To enable JMX Monitoring for the JVM via asadmin, use the command:

asadmin> set-jmx-monitoring-configuration --enabled=true --amx true

Configuring JMX Monitoring Time via the Admin Console

To configure the frequency of logged data, enter both the intended frequency of logs and the unit of time.

For example, to log every 30 milliseconds:

JMX Log Frequency

Configuring JMX Monitoring Time via asadmin

To configure the data logging frequency via asadmin, use the command:

asadmin> set-jmx-monitoring-configuration --logfrequency <frequency> --logfrequencyunit
NANOSECONDS|MICROSECONDS|MILLISECONDS|SECONDS|MINUTES|HOURS|DAYS

Adding Notifiers via the Admin Console

Before you receive notifications from your chosen notifier, please ensure that you have configured the notification service.

To select notifiers to use for JMX Monitoring, hold the CTRL or SHIFT key to select multiple notifiers, and then click Add >.

Add JMX Notifiers

Adding Notifiers via asadmin

For each notifier you wish to enable use the command:

asadmin> monitoring-<notifier>-notifier-configure --enabled true

Available Notifiers can be viewed on the notifiers page.

Adding Properties via the admin console

By default, JMX will output an empty message as there are no MBeans configured.

To add an MBean to the monitoring service, click Add Attribute on the Monitored Attributes table at the bottom of the page:

Add JMX Property

You can now add your monitoring attributes to the notification service using the following values:

  • attributeName: the MBean attribute name

  • objectName: the MBean object name

  • description: displayed in the get-jmx-monitoring-configuration asadmin command, optional

MBean attribute names and domain names can be discovered using JConsole, JVisualVM, Java Mission Control or other programs. To browse available MBean attributes, after enabling JMX and AMX in the admin console, connect to your Payara Server Community instance from your chosen program:

JConsole adding Payara

From here, to find an MBean, select the MBeans tab to view all MBeans on the server. If you have enabled "HIGH" monitoring for all components along with JMX monitoring you should be able to see the following files:

All JMX folders

From here you can search MBeans for attributes which you wish to monitor. Once you have located an MBean attributes you can add it to the DAS using the given object name (or, if not present, the type, name, and location of the MBean in the following format):

JConsole view

For example, to monitor the HeapMemoryUsage of the MBean on the DAS with a domain (Object Name) of java.lang:type=Memory, you would enter:

Add MBean

Click the Save button at the top of the page to save and exit. If you have entered all values correctly, you should see a message via your chosen notifier with the MBeans contents:

Via the logs:

[#|2018-07-03T17:37:09.672+0100|INFO|Payara 5.183-SNAPSHOT|fish.payara.nucleus.notification.log.LogNotifierService|_ThreadID=369;_ThreadName=payara-monitoring-service(19);_TimeMillis=1530635829672;_LevelValue=800;|
  JMX-MONITORING: - MBean Attributes: committedHeapMemoryUsage=2444230656 initHeapMemoryUsage=140509184 maxHeapMemoryUsage=5726797824 usedHeapMemoryUsage=2150820424 |#]

Via HipChat:

JMX HipChat Notification

Adding Attributes via asadmin

To add a attribute via asadmin, use the command:

asadmin> set-jmx-monitoring-configuration --addattribute <attribute>

So to replicate the above attributes, use the command:

asadmin> set-jmx-monitoring-configuration --addattribute 'attributeName=HeapMemoryUsage
objectName=java.lang:type=Memory'