diff --git a/receiver/jmxreceiver/config.go b/receiver/jmxreceiver/config.go index 1be4b1e7de5f..222bb980390e 100644 --- a/receiver/jmxreceiver/config.go +++ b/receiver/jmxreceiver/config.go @@ -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. diff --git a/receiver/jmxreceiver/factory.go b/receiver/jmxreceiver/factory.go index c741363f1ebc..b767c8ee2000 100644 --- a/receiver/jmxreceiver/factory.go +++ b/receiver/jmxreceiver/factory.go @@ -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{ diff --git a/receiver/jmxreceiver/receiver.go b/receiver/jmxreceiver/receiver.go index a9861840e144..648e4626dcd2 100644 --- a/receiver/jmxreceiver/receiver.go +++ b/receiver/jmxreceiver/receiver.go @@ -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 != "" { diff --git a/receiver/jmxreceiver/receiver_test.go b/receiver/jmxreceiver/receiver_test.go index 9cfd04b6f49e..241af8a27353 100644 --- a/receiver/jmxreceiver/receiver_test.go +++ b/receiver/jmxreceiver/receiver_test.go @@ -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 @@ -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