Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Jolokia discovery autodiscover provider #7141

Merged
merged 9 commits into from
Jun 4, 2018
Prev Previous commit
Next Next commit
Add documentation for jolokia autodiscover
  • Loading branch information
jsoriano committed May 29, 2018
commit 8dfdcff48cea8ca77d0c8e13d9ef0ce680337df1
1 change: 1 addition & 0 deletions CHANGELOG.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,7 @@ https://github.com/elastic/beats/compare/v6.2.3...master[Check the HEAD diff]
- Add support for loading a template.json file directly instead of using fields.yml. {pull}7039[7039]
- Add support for keyword multifields in field.yml. {pull}7131[7131]
- Add dissect processor. {pull}6925[6925]
- Add experimental Jolokia Discovery autodiscover provider. {pull}7141[7141]

*Auditbeat*

Expand Down
23 changes: 23 additions & 0 deletions filebeat/docs/autodiscover-jolokia-config.asciidoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
Filebeat supports templates for inputs and modules:

["source","yaml",subs="attributes"]
-------------------------------------------------------------------------------
filebeat.autodiscover:
providers:
- type: jolokia
interfaces:
- name: lo
templates:
- condition:
contains:
jolokia.server.product: "kafka"
config:
- module: kafka
log:
enabled: true
var.paths:
- /var/log/kafka/*.log
-------------------------------------------------------------------------------

This configuration starts a jolokia module that collects logs of kafka if it is
running. Discovery probes are sent using the local interface.
1 change: 0 additions & 1 deletion libbeat/autodiscover/providers/jolokia/discovery.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,6 @@ type Event struct {
func (e *Event) BusEvent() bus.Event {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

exported method Event.BusEvent should have comment or be unexported

event := bus.Event{
e.Type: true,
"host": e.Message["url"],
"jolokia": e.Message,
"meta": common.MapStr{
"jolokia": e.Message,
Expand Down
51 changes: 51 additions & 0 deletions libbeat/docs/shared-autodiscover.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,57 @@ contain variables from the autodiscover event. They can be accessed under data n

include::../../{beatname_lc}/docs/autodiscover-kubernetes-config.asciidoc[]

[float]
===== Jolokia (experimental)

The Jolokia autodiscover provider uses Jolokia Discovery to find agents running
in your host or your network.

Jolokia Discovery mechanism is supported by any Jolokia agent since version
1.2.0, it is enabled by default when Jolokia is included in the application as
a JVM agent, but disabled in other cases as the OSGI or WAR (Java EE) agents.
In any case, this feature is controlled with two properties:

* `discoveryEnabled`, to enable the feature
* `discoveryAgentUrl`, if set, this is the URL announced by the agent when
being discovered, setting this parameter implicitely enables the feature

There are multiple ways of setting these properties, and they can vary from
application to application, please refer to the documentation of your
application to find the more suitable way to set them in your case.

Jolokia Discovery is based on UDP multicast requests. Agents join the multicast
group 239.192.48.84, port 24884, and discovery is done by sending queries to
this group. You have to take into account that UDP traffic between Metricbeat
and the Jolokia agents has to be allowed. Also notice that this multicast
address is in the 239.0.0.0/8 range, that is reserved for private use within an
organization, so it can only be used in private networks.

These are the available fields on every event:

* jolokia.agent.id
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are these fields also added to each event indirectly created through auto discovery?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, they are added, I think that by the Autodiscover framework.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

* jolokia.agent.version
* jolokia.secured
* jolokia.server.product
* jolokia.server.vendor
* jolokia.server.version
* jolokia.url

The configuration of this provider consists in a set of network interfaces, as
well as a set of templates as in other providers. The network interfaces will be
the ones used for discovery probes, they have these settings:

* `name`: the name of the interface (e.g. `br0`), it can contain a wildcard
at as suffix to apply the same settings to multiple network interfaces of
the same type (e.g. `br*`).
* `interval`: time between probes (defaults to 10s)
* `grace_period`: time since the last reply to consider a instance stopped
(defaults to 30s)
* `probe_timeout`: max time to wait for responses since a probe is sent
(defaults to 1s)

include::../../{beatname_lc}/docs/autodiscover-jolokia-config.asciidoc[]

[[configuration-autodiscover-hints]]
=== Hints based autodiscover

Expand Down
32 changes: 32 additions & 0 deletions metricbeat/docs/autodiscover-jolokia-config.asciidoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
Metricbeat supports templates for modules:

["source","yaml",subs="attributes"]
-------------------------------------------------------------------------------
metricbeat.autodiscover:
providers:
- type: jolokia
interfaces:
- name: br*
interval: 5s
grace_period: 10s
- name: en*
templates:
- condition:
contains:
jolokia.server.product: "tomcat"
config:
- module: jolokia
metricsets: ["jmx"]
hosts: "${data.jolokia.url}"
namespace: test
jmx.mappings:
- mbean: "java.lang:type=Runtime"
attributes:
- attr: Uptime
field: uptime
-------------------------------------------------------------------------------

This configuration starts a jolokia module that collects the uptime of each
`tomcat` instance discovered. Discovery probes are sent using all interfaces
starting with `br` and `en`, for the `br` interfaces the `interval` and
`grace_period` is reduced to 5 and 10 seconds respectively.