[id='enabling-jmx_{context}']
= Registering JMX MBeans

{brandname} can register JMX MBeans that you can use to collect statistics and
perform administrative operations.
You must also enable statistics otherwise {brandname} provides `0` values for all statistic attributes in JMX MBeans.

[IMPORTANT]
====
Use JMX Mbeans for collecting statistics only when {brandname} is embedded in applications and not with a remote {brandname} server.

When you use JMX Mbeans for collecting statistics from a remote {brandname} server, the data received from JMX Mbeans might differ from the data received from other APIs such as REST. In such cases the data received from the other APIs is more accurate.
====

.Procedure

. Open your {brandname} configuration for editing.
. Add the `jmx` element or object to the cache container and specify `true` as the value for the `enabled` attribute or field.
. Add the `domain` attribute or field and specify the domain where JMX MBeans are exposed, if required.
. Save and close your client configuration.

[discrete]
== JMX configuration

.XML
[source,xml,options="nowrap",subs=attributes+,role="primary"]
----
include::xml/jmx_enabled_cache_container.xml[]
----

.JSON
[source,json,options="nowrap",subs=attributes+,role="secondary"]
----
include::json/jmx_enabled_cache_container.json[]
----

.YAML
[source,yaml,options="nowrap",subs=attributes+,role="secondary"]
----
include::yaml/jmx_enabled_cache_container.yaml[]
----

ifdef::embedded_caches[]
.GlobalConfigurationBuilder
[source,java,options="nowrap",subs=attributes+,role="secondary"]
----
include::code_examples/JmxGlobalConfigurationBuilder.java[]
----
endif::embedded_caches[]
