A simple WAR wrapper for instrumenting your app server and exposing metrics.
This is an alternative to the usually preferred jmx_exporter and suitable when you have minimal access to your app server, e.g. in a large centrally managed setup splitting operations and development responsiblities.
The WAR
- registers JVM DefaultExports
- registers JmxCollector
- exposes metrics via MetricsServlet
You can configure the JmxCollector
- by setting system property
jmx_collector_config_file
pointing to a local file - by setting in your web.xml a context parameter pointing to a local file
<context-param> <param-name>jmx_collector_config_file</param-name> <param-value>/PATH/TO/CONFIGFILE</param-value> </context-param>
- by setting the default config directly in the web.xml (default config!)
<context-param> <param-name>jmx_collector_config</param-name> <param-value> --- # Default config embedded in web.xml rules: - pattern: ".*" </param-value> </context-param>
This last setting is the default config. First configuration found wins. So you can always override via system property.
Metric names | Type | Descriptions |
---|---|---|
prometheus_webapp_build_info{version, buildTime, buildScmVersion, buildScmBranch} | Info | Build info of this WAR |
jvm_* | Default JVM metrics, see Prometheus client hotpot | |
jmx_* | Default JMX Collector metrics, see Prometheus jmx_exporter |
mvn clean install
mvn jetty:run
open http://localhost:8080/
For building:
- JDK 8
- Maven 3.6.x