prometheus / jmx_exporter

A process for exposing JMX Beans via HTTP for Prometheus consumption
Apache License 2.0
2.97k stars 1.19k forks source link

Example config for Tomcat #902

Open danlz opened 6 months ago

danlz commented 6 months ago

https://github.com/prometheus/jmx_exporter/blob/main/example_configs/tomcat.yml

You have to add a rule for exporting the java_lang_operatingsystem_* properties, ie:

  - pattern: 'java.lang<type=OperatingSystem><>(.*):'
    name: java_lang_operatingsystem_$1
    type: COUNTER
dhoard commented 5 months ago

@danlz Can you provide usage context? Are you using the exporter in agent mode or standalone mode?

danlz commented 5 months ago

I'm using it in agent mode. You are including the java.lang:type=OperatingSystem MBean, but not exposing any of its attributes.

dhoard commented 5 months ago

@danlz the issue with adding an OperatingSystem MBean rule is that it's only valid in agent mode. In standalone mode, the OperatingSystem MBean would refer to the standalone exporter's JVM which would produce misleading metrics.

I'm inclined to remove "java.lang:type=OperatingSystem" from the whitelistObjectNames configuration.

Thoughts?

danlz commented 5 months ago

ok, the config will be consistent.