-
Notifications
You must be signed in to change notification settings - Fork 4.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Jolokia Module with dynamic JMX Metricset
This is the implementation of a module for Jolokia which contains a dynamic jmx metricset. An example configuration looks as following: ``` - module: jolokia metricsets: ["jmx"] enabled: true period: 1s hosts: ["localhost:8778"] namespace: "metrics" jmx.mappings: - mbean: 'java.lang:type=Runtime' attributes: - attr: Uptime field: uptime - mbean: 'java.lang:type=GarbageCollector,name=ConcurrentMarkSweep' attributes: - attr: CollectionTime field: gc.cms_collection_time - attr: CollectionCount field: gc.cms_collection_count - mbean: 'java.lang:type=Memory' attributes: - attr: HeapMemoryUsage field: memory.heap_usage - attr: NonHeapMemoryUsage field: memory.non_heap_usage ``` For each mbeat the attributes which should be fetched can be defined. The field defines under which field name the event will be put. The namespace defines the metricset namespace. This PR replaces #3051 Further changes: * Added support for method and body to http helper * Handle empty fields in generators. This happens for a module which only contains dynamic metricsets which is currently the case for jolokia. TODO: * [x] Add system tests * [x] Check documentation * [x] Add integration test * [ ] Open issue for metricset which contains basic memory info
- Loading branch information
Showing
30 changed files
with
816 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
//// | ||
This file is generated! See scripts/docs_collector.py | ||
//// | ||
|
||
[[metricbeat-module-jolokia]] | ||
== Jolokia Module | ||
|
||
beta[] | ||
|
||
This is the Jolokia Module. | ||
|
||
|
||
|
||
[float] | ||
=== Example Configuration | ||
|
||
The Jolokia module supports the standard configuration options that are described | ||
in <<configuration-metricbeat>>. Here is an example configuration: | ||
|
||
[source,yaml] | ||
---- | ||
metricbeat.modules: | ||
#- module: jolokia | ||
# metricsets: ["jmx"] | ||
# enabled: true | ||
# period: 10s | ||
# hosts: ["localhost"] | ||
# namespace: "metrics" | ||
# path: "/jolokia/?ignoreErrors=true&canonicalNaming=false" | ||
# jmx.mapping: | ||
# jmx.application: | ||
# jmx.instance: | ||
---- | ||
|
||
[float] | ||
=== Metricsets | ||
|
||
The following metricsets are available: | ||
|
||
* <<metricbeat-metricset-jolokia-jmx,jmx>> | ||
|
||
include::jolokia/jmx.asciidoc[] | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
//// | ||
This file is generated! See scripts/docs_collector.py | ||
//// | ||
|
||
[[metricbeat-metricset-jolokia-jmx]] | ||
include::../../../module/jolokia/jmx/_meta/docs.asciidoc[] | ||
|
||
|
||
==== Fields | ||
|
||
For a description of each field in the metricset, see the | ||
<<exported-fields-jolokia,exported fields>> section. | ||
|
||
Here is an example document generated by this metricset: | ||
|
||
[source,json] | ||
---- | ||
include::../../../module/jolokia/jmx/_meta/data.json[] | ||
---- |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
# Tomcat is started to fetch Jolokia metrics from it | ||
FROM jolokia/java-jolokia:7 | ||
ENV TOMCAT_VERSION 7.0.55 | ||
ENV TC apache-tomcat-${TOMCAT_VERSION} | ||
|
||
EXPOSE 8778 | ||
RUN wget http://archive.apache.org/dist/tomcat/tomcat-7/v${TOMCAT_VERSION}/bin/${TC}.tar.gz | ||
RUN tar xzf ${TC}.tar.gz -C /opt | ||
|
||
CMD env CATALINA_OPTS=$(jolokia_opts) /opt/${TC}/bin/catalina.sh run |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
#- module: jolokia | ||
# metricsets: ["jmx"] | ||
# enabled: true | ||
# period: 10s | ||
# hosts: ["localhost"] | ||
# namespace: "metrics" | ||
# path: "/jolokia/?ignoreErrors=true&canonicalNaming=false" | ||
# jmx.mapping: | ||
# jmx.application: | ||
# jmx.instance: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
== Jolokia Module | ||
|
||
beta[] | ||
|
||
This is the Jolokia Module. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
JOLOKIA_HOST=jolokia | ||
JOLOKIA_PORT=8778 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
- key: jolokia | ||
title: "Jolokia" | ||
description: > | ||
[]beta | ||
Jolokia Module | ||
short_config: false | ||
fields: | ||
- name: jolokia | ||
type: group | ||
description: > | ||
jolokia contains metrics exposed via jolokia agent | ||
fields: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
/* | ||
Package jolokia is a Metricbeat module that contains MetricSets. | ||
*/ | ||
package jolokia |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
{ | ||
"@timestamp": "2016-05-23T08:05:34.853Z", | ||
"beat": { | ||
"hostname": "host.example.com", | ||
"name": "host.example.com" | ||
}, | ||
"jolokia": { | ||
"testnamespace": { | ||
"memory": { | ||
"heap_usage": { | ||
"committed": 1.09051904e+08, | ||
"init": 3.2753408e+07, | ||
"max": 6.20756992e+08, | ||
"used": 5.8796168e+07 | ||
}, | ||
"non_heap_usage": { | ||
"committed": 3.244032e+07, | ||
"init": 2.4576e+07, | ||
"max": 2.24395264e+08, | ||
"used": 1.7975176e+07 | ||
} | ||
}, | ||
"uptime": 6.1802139e+07 | ||
} | ||
}, | ||
"metricset": { | ||
"host": "127.0.0.1:8778", | ||
"module": "jolokia", | ||
"name": "jmx", | ||
"namespace": "testnamespace", | ||
"rtt": 115 | ||
}, | ||
"type": "metricsets" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
=== jolokia jmx MetricSet | ||
|
||
This is the jmx metricset of the module jolokia. | ||
|
||
[float] | ||
=== Features and configuration | ||
Tested with Jolokia 1.3.4. | ||
|
||
Metrics to be collected from each Jolokia instance are defined in the mapping section with an MBean ObjectName and | ||
an array of Attributes to be requested with Elastic field names under which the return values should be saved. | ||
|
||
For example: to get the "Uptime" attribute from the "java.lang:type=Runtime" MBean and map it to something like | ||
"uptime" (actually "jolokia.jmx.uptime", the prexif is added by beats framework) you have to configure following | ||
mapping: | ||
|
||
``` | ||
- module: jolokia | ||
metricsets: ["jmx"] | ||
hosts: ["localhost:8778"] | ||
namespace: "metrics" | ||
jmx.mappings: | ||
- mbean: 'java.lang:type=Runtime' | ||
attributes: | ||
- attr: Uptime | ||
field: uptime | ||
``` | ||
|
||
In case the underlying attribute is an object (e.g. see HeapMemoryUsage attribute in java.lang:type=Memory) it`s | ||
structure will be published to Elastic "as is". | ||
|
||
It is possible to configure nested metric aliases by using dots in the mapping name (e.g. gc.cms_collection_time). For examples please refer to the | ||
/jolokia/jmx/test/config.yml. | ||
|
||
All metrics from a single mapping will be POSTed to the defined host/port and sent to Elastic as a single event. | ||
To make it possible to differentiate between metrics from multiple similar applications running on the same host, | ||
please configure multiple modules. | ||
|
||
It is required to set a namespace in the general module config section. | ||
|
||
[float] | ||
=== Limitations | ||
No authentication against Jolokia is supported yet. No wildcards in Jolokia requests supported yet. | ||
All Jolokia requests have canonicalNaming set to false (details see here: https://jolokia.org/reference/html/protocol.html). | ||
|
||
|
||
[float] | ||
=== Exposed fields, Dashboards, Indexes, etc. | ||
Since this is a very general module that can be tailored for any application that exposes it's metrics over Jolokia, it | ||
comes with no exposed fields description, dashboards or index patterns. |
Empty file.
Oops, something went wrong.