How to enable exposing jmx metrics for monitoring infinispan?

467 Views Asked by At

I'm trying to configure monitoring of infinispan with prometheus. By default infinispan doesn't expose metrics. Tried to configure it like this in standalone.xml and domain.xml (for domain mode) infinispan's configuration:

    <subsystem xmlns="urn:infinispan:server:core:9.3" default-cache-container="local">
        <cache-container name="local" default-cache="default" statistics="true">
            <metrics gauges="true" histograms="true" />
            <global-state/>
            <local-cache name="default"/>
            <local-cache name="namedCache"/>
        </cache-container>
        <metrics enabled="true">
            <metrics-infinispan default-enabled="true">
                <jmx enabled="true" domain="infinispan" expose-jmx="true"/>
                <prometheus enabled="true" prefix="infinispan"/>
            </metrics-infinispan>
        </metrics>
    </subsystem>

But when I verify locally that statistics are exported to the metrics endpoint getting "Connection refused":

curl -v http://localhost:11222/metrics

Where am I doing wrong?

2

There are 2 best solutions below

2
Diego On
<infinispan>
  <cache-container statistics="true">
    <metrics gauges="true"
             histograms="true" />
  </cache-container>
</infinispan>
curl -v http://localhost:11222/metrics --digest -u username:password
7
Tristan Tarrant On

Look at the 9.4 documentation, which should be the closest: https://infinispan.org/docs/9.4.x/server_guide/server_guide.html#exposing_jmx_beans_to_prometheus I would also really recommend upgrading to a more recent version.