Search

11.11. Enabling the JBoss Metrics Plug-in

download PDF
The JBoss Metrics plug-in supports JBoss EAP 6 and JBossAS 7 version cartridges and is used to print JBoss metrics to stdout.
Enable the JBoss metrics plug-in by ensuring your JBoss application has the following in the application's standalone.xml file within the <extensions> element:
<extension module="com.openshift.metrics"/>
Then configure the metrics subsystem inside the <profile> element to look similar to the following:

Example 11.16. JBoss Metrics Plug-in XML

<subsystem xmlns="urn:redhat:openshift:metrics:1.0">
  <max-line-length>1024</max-line-length>
  <metrics-group cron="*/5 * * * * ?">
    <source type="jboss" path="core-service=platform-mbean/type=memory-pool/name=CMS_Old_Gen">
      <metric source-key="usage.used" publish-key="oldgen.used" />
      <metric source-key="usage.max" publish-key="oldgen.max" />
      <metric source-key="usage.committed" publish-key="oldgen.committed" />
    </source>
    <source path="java.lang:type=Memory" type="mbean">
      <metric source-key="HeapMemoryUsage.used" publish-key="jmx.heap.used"/>
    </source>
  </metrics-group>
</subsystem>
As in the above example, you can specify one or more sources inside a metrics group. Anything that is a valid JBoss resource, such as core-service=platform-mbean/type=memory-pool/name=CMS_Old_Gen, or a valid MBean, such as java.lang:type=Memory can be a source. Each source has a type (jboss or mbean) and a path, which is the name of the resource. A source contains one or more data points that can be read and published. You can specify a source-key (the location in the source of the data point) and a publish-key (the label of the information when written to stdout). Metrics are printed to stdout similar to the following:

Example 11.17. Logged Metrics Data

Jun 10 16:25:39 vm openshift-platform[29398]: type=metric appName=php6 gear=53961099e659c55b08000102 app=53961099e659c55b08000102 ns=demo quota.blocks.used=988 quota.blocks.limit=1048576 quota.files.used=229 quota.files.limit=80000
You can specify one or more metrics-group entries in order to group together the data points you wish to emit at any interval. For example, to emit memory data every 10 seconds but database connection pool data every 30 seconds, you would need two different metrics groups, because their schedules are different.
Note that you can add enabled="false" to any <metrics-group>, <source>, or <metric> attribute to disable it from being logged:
<metrics-group enabled="false">
Red Hat logoGithubRedditYoutubeTwitter

Learn

Try, buy, & sell

Communities

About Red Hat Documentation

We help Red Hat users innovate and achieve their goals with our products and services with content they can trust.

Making open source more inclusive

Red Hat is committed to replacing problematic language in our code, documentation, and web properties. For more details, see the Red Hat Blog.

About Red Hat

We deliver hardened solutions that make it easier for enterprises to work across platforms and environments, from the core datacenter to the network edge.

© 2024 Red Hat, Inc.