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

JMX Registry SSL Enabled #190

Merged
merged 1 commit into from
Apr 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions receiver/jmxreceiver/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,8 @@ type Config struct {
TruststorePassword configopaque.String `mapstructure:"truststore_password,omitempty"`
// The truststore type for SSL
TruststoreType string `mapstructure:"truststore_type,omitempty"`
// Enable when jar with jmx registry is enabled with ssl configuration
JMXRegistrySSLEnabled bool `mapstructure:"jmx_registry_ssl_enabled,omitempty"`
// The JMX remote profile. Should be one of:
// `"SASL/PLAIN"`, `"SASL/DIGEST-MD5"`, `"SASL/CRAM-MD5"`, `"TLS SASL/PLAIN"`, `"TLS SASL/DIGEST-MD5"`, or
// `"TLS SASL/CRAM-MD5"`, though no enforcement is applied.
Expand Down
5 changes: 3 additions & 2 deletions receiver/jmxreceiver/factory.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,9 @@ func NewFactory() receiver.Factory {

func createDefaultConfig() component.Config {
return &Config{
JARPath: "/opt/opentelemetry-java-contrib-jmx-metrics.jar",
CollectionInterval: 10 * time.Second,
JARPath: "/opt/opentelemetry-java-contrib-jmx-metrics.jar",
CollectionInterval: 10 * time.Second,
JMXRegistrySSLEnabled: false,
OTLPExporterConfig: otlpExporterConfig{
Endpoint: otlpEndpoint,
TimeoutSettings: exporterhelper.TimeoutSettings{
Expand Down
1 change: 1 addition & 0 deletions receiver/jmxreceiver/receiver.go
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,7 @@ func (jmx *jmxMetricReceiver) buildJMXMetricGathererConfig() (string, error) {
if len(jmx.config.OTLPExporterConfig.Headers) > 0 {
config["otel.exporter.otlp.headers"] = jmx.config.OTLPExporterConfig.headersToString()
}
config["otel.jmx.remote.registry.ssl"] = strconv.FormatBool(jmx.config.JMXRegistrySSLEnabled)

var passwordMap map[string]string
if jmx.config.PasswordFile != "" {
Expand Down
2 changes: 2 additions & 0 deletions receiver/jmxreceiver/receiver_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ otel.jmx.interval.milliseconds = 123000
otel.jmx.password = mypass \nword
otel.jmx.realm = myrealm
otel.jmx.remote.profile = myprofile
otel.jmx.remote.registry.ssl = false
otel.jmx.service.url = service:jmx:rmi:///jndi/rmi://myhost:12345/jmxrmi
otel.jmx.target.system = mytargetsystem
otel.jmx.username = myuser\nname
Expand All @@ -123,6 +124,7 @@ otel.exporter.otlp.endpoint = https://myotlpendpoint
otel.exporter.otlp.timeout = 0
otel.jmx.interval.milliseconds = 0
otel.jmx.password = mypassword
otel.jmx.remote.registry.ssl = false
otel.jmx.service.url = service:jmx:rmi:///jndi/rmi://myhost:12345/jmxrmi
otel.jmx.target.system = mytargetsystem
otel.jmx.username = myusername
Expand Down
Loading