-
Notifications
You must be signed in to change notification settings - Fork 36
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[com.influxdata.telegraf] Add Jolokia2 input plugin (#89)
- Loading branch information
Showing
5 changed files
with
168 additions
and
10 deletions.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -22,5 +22,5 @@ dependencies { | |
} | ||
|
||
package { | ||
version = "1.3.0" | ||
version = "1.4.0" | ||
} |
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
46 changes: 46 additions & 0 deletions
46
packages/com.influxdata.telegraf/examples/InputJolokiaAgent.pkl
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,46 @@ | ||
//===----------------------------------------------------------------------===// | ||
// Copyright © 2024 Apple Inc. and the Pkl project authors. All rights reserved. | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// https://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
//===----------------------------------------------------------------------===// | ||
amends "../Telegraf.pkl" | ||
|
||
agent { | ||
collection_jitter = 0.s | ||
debug = true | ||
flush_interval = 30.s | ||
flush_jitter = 0.s | ||
interval = 30.s | ||
} | ||
|
||
inputs { | ||
jolokia2_agent { | ||
new { | ||
urls { | ||
"http://localhost:7883" | ||
} | ||
response_timeout = 3.s | ||
tls_cert = "/var/private/client.pem" | ||
tls_key = "/var/private/client-key.pem" | ||
metric { | ||
new { | ||
name = "java_runtime" | ||
mbean = "java.lang:type=Runtime" | ||
paths { | ||
"Uptime" | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} |
86 changes: 86 additions & 0 deletions
86
packages/com.influxdata.telegraf/plugins/inputs/Jolokia2AgentInput.pkl
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,86 @@ | ||
//===----------------------------------------------------------------------===// | ||
// Copyright © 2024 Apple Inc. and the Pkl project authors. All rights reserved. | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// https://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
//===----------------------------------------------------------------------===// | ||
/// [Jolokia Agent Input Plugin](https://github.com/influxdata/telegraf/tree/master/plugins/inputs/jolokia2_agent) | ||
/// | ||
/// Reads JMX metrics from one or more Jolokia agent REST endpoints. | ||
/// See [docs](https://github.com/influxdata/telegraf/blob/master/plugins/inputs/jolokia2_agent/README.md) for examples. | ||
module com.influxdata.telegraf.plugins.inputs.Jolokia2AgentInput | ||
|
||
extends "Input.pkl" | ||
|
||
/// List of endpoints to read JMX metrics from a Jolokia REST agent. | ||
urls: Listing<String>(length > 0) | ||
|
||
username: String? | ||
password: String? | ||
|
||
/// Origin URL to include as a header in the request. | ||
origin: String? | ||
|
||
response_timeout: Duration? | ||
|
||
tls_ca: String? | ||
tls_cert: String? | ||
tls_key: String? | ||
insecure_skip_verify: Boolean? | ||
|
||
/// String to prepend to the field names produced by all metric declarations. | ||
default_field_prefix: String? | ||
|
||
/// Character to use to join Mbean attributes when creating fields. | ||
default_field_separator: String? | ||
|
||
/// String to prepend to the tag names produced by all metric declarations | ||
default_tag_prefix: String? | ||
|
||
/// Metrics to collect from the Jolokia agent. | ||
/// | ||
/// Each metric declaration generates a Jolokia request to fetch telemetry from a JMX MBean. | ||
metric: Listing<MetricConfig> | ||
|
||
class MetricConfig { | ||
/// Metric name. | ||
name: String | ||
|
||
/// The object name of a JMX MBean. | ||
/// | ||
/// MBean property-key values can contain a wildcard `*`, allowing to fetch multiple MBeans with one declaration. | ||
mbean: String | ||
|
||
/// List of MBean attributes to read. | ||
paths: Listing<String> | ||
|
||
/// String to set as the name of the field produced by this metric. | ||
/// | ||
/// This can contain substitutions. | ||
field_name: String? | ||
|
||
/// String to prepend to the field names produced by this metric declaration. | ||
/// | ||
/// This can contain substitutions. | ||
field_prefix: String? | ||
|
||
/// Character to use to join Mbean attributes when creating fields. | ||
field_separator: String? | ||
|
||
/// String to prepend to the tag names produced by this metric declaration. | ||
tag_prefix: String? | ||
|
||
/// List of MBean property-key names to convert into tags. | ||
/// | ||
/// The property-key name becomes the tag name, while the property-key value becomes the tag value. | ||
tag_keys: Listing<String> | ||
} |
21 changes: 21 additions & 0 deletions
21
packages/com.influxdata.telegraf/tests/Telegraf.pkl-expected.pcf
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