Skip to content

Commit

Permalink
Merge remote-tracking branch 'elastic/master' into filebeat-haproxy-s…
Browse files Browse the repository at this point in the history
…yslog_host

* elastic/master:
  Metricbeat can call Jolokia with GET requests. (elastic#8566)  (elastic#9226)
  Add some missing references to PRs in changelog (elastic#9358)
  • Loading branch information
jasontedor committed Dec 4, 2018
2 parents f4c1901 + 463ce3e commit 18b99e6
Show file tree
Hide file tree
Showing 9 changed files with 1,201 additions and 104 deletions.
8 changes: 5 additions & 3 deletions CHANGELOG.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ https://github.com/elastic/beats/compare/v7.0.0-alpha1...master[Check the HEAD d
==== Breaking changes

*Affecting all Beats*

- Automaticall cap signed integers to 63bits. {pull}8991[8991]

*Auditbeat*
Expand Down Expand Up @@ -40,10 +41,9 @@ https://github.com/elastic/beats/compare/v7.0.0-alpha1...master[Check the HEAD d
*Auditbeat*

*Filebeat*
- Correctly parse `December` or `Dec` in the Syslog input. {pull}xxx[xxx]

- Fix installation of haproxy dashboard. {issue}9307[9307] {pull}[]

- Correctly parse `December` or `Dec` in the Syslog input. {pull}9349[9349]
- Fix installation of haproxy dashboard. {issue}9307[9307] {pull}9313[9313]
- Don't generate incomplete configurations when logs collection is disabled by hints. {pull}9305[9305]
- Stop runners disabled by hints after previously being started. {pull}9305[9305]

Expand All @@ -67,12 +67,14 @@ https://github.com/elastic/beats/compare/v7.0.0-alpha1...master[Check the HEAD d
==== Added

*Affecting all Beats*

- Unify dashboard exporter tools. {pull}9097[9097]
- Use _doc as document type of the Elasticsearch major version is 7. {pull}9056[9056]

*Auditbeat*

*Filebeat*

- Added `detect_null_bytes` selector to detect null bytes from a io.reader. {pull}9210[9210]
- Added `syslog_host` variable to HAProxy module. {pull}9366[9366]

Expand Down
58 changes: 52 additions & 6 deletions metricbeat/module/jolokia/jmx/_meta/docs.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -20,22 +20,25 @@ configure the following mapping:
metricsets: ["jmx"]
hosts: ["localhost:8778"]
namespace: "testnamespace" <1>
http_method: "POST" <2>
jmx.mappings:
- mbean: 'java.lang:type=Runtime'
attributes:
- attr: Uptime
field: uptime <2>
event: uptime <3>
field: uptime <3>
event: uptime <4>
target:
url: "service:jmx:rmi:///jndi/rmi://targethost:9999/jmxrmi"
user: "jolokia"
password: "s!cr!t"
----
<1> The `namespace` setting is required. This setting is used along with the
module name to qualify field names in the output event.
<2> The field where the returned value will be saved. This field will be called
<2> The `http_method` setting is optional. By default all requests to Jolokia
are performed using `POST` HTTP method. This setting allows only two values: `POST` or `GET`.
<3> The field where the returned value will be saved. This field will be called
`jolokia.testnamespace.uptime` in the output event.
<3> The `event` setting is optional. Use this setting to group all attributes
<4> The `event` setting is optional. Use this setting to group all attributes
with the same `event` value into the same event when sending data to Elastic.

If the underlying attribute is an object (such as the `HeapMemoryUsage`
Expand All @@ -54,12 +57,55 @@ configure multiple modules.
When wildcards are used, an event is sent to Elastic for each matching
MBean, and an `mbean` field is added to the event.

[float]
=== Accessing Jolokia via POST or GET method

All requests to Jolokia are made by default using HTTP POST method. However, there are specific circumstances
on the environment where Jolokia agent is deployed, in which POST method can be unavailable. In this case you can use
HTTP GET method, by defining `http_method` attribute. In general you can use either POST or GET, but GET has the following
drawbacks:

1. https://jolokia.org/reference/html/protocol.html#protocol-proxy[Proxy requests]
are not allowed.
2. If more than one `jmx.mappings` are defined, then Metricbeat will perform as many GET requests as the mappings defined.
For example the following configuration with 3 mappings will create 3 GET requests, one for every MBean. On the contrary, if you use HTTP POST, Metricbeat will create only 1 request to Jolokia.

[source,yaml]
----
- module: jolokia
metricsets: ["jmx"]
enabled: true
period: 10s
hosts: ["localhost:8080"]
namespace: "jolokia_metrics"
path: "/jolokia"
http_method: 'GET'
jmx.mappings:
- mbean: 'java.lang:type=Memory'
attributes:
- attr: HeapMemoryUsage
field: memory.heap_usage
- attr: NonHeapMemoryUsage
field: memory.non_heap_usage
- mbean: 'Catalina:name=*,type=ThreadPool'
attributes:
- attr: port
field: catalina.port
- attr: maxConnections
field: catalina.maxConnections
- mbean: 'java.lang:type=Runtime'
attributes:
- attr: Uptime
field: uptime
----

[float]
=== Limitations
All Jolokia requests have `canonicalNaming` set to `false`. See the
1. All Jolokia requests have `canonicalNaming` set to `false`. See the
https://jolokia.org/reference/html/protocol.html[Jolokia Protocol] documentation
for more detail about this parameter.

2. If `http_method` is set to `GET`, then https://jolokia.org/reference/html/protocol.html#protocol-proxy[Proxy requests]
are not allowed. Thus, setting a value to `target` section is going to fail with an error.

[float]
=== Exposed fields, dashboards, indexes, etc.
Expand Down
26 changes: 26 additions & 0 deletions metricbeat/module/jolokia/jmx/_meta/test/jolokia_get_response.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
{
"request": {
"mbean": "java.lang:type=Memory",
"attribute": [
"HeapMemoryUsage",
"NonHeapMemoryUsage"
],
"type": "read"
},
"value": {
"HeapMemoryUsage": {
"init": 1073741824,
"committed": 1037959168,
"max": 1037959168,
"used": 227420472
},
"NonHeapMemoryUsage": {
"init": 2555904,
"committed": 53477376,
"max": -1,
"used": 50519768
}
},
"timestamp": 1472298687,
"status": 200
}
Loading

0 comments on commit 18b99e6

Please sign in to comment.