diff --git a/CHANGELOG.md b/CHANGELOG.md index 6cadea61b4..c540b8fb55 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,7 @@ ### 💡 Enhancements 💡 - (Splunk) Update bundled OpenJDK to [11.0.24_8](https://github.com/adoptium/temurin11-binaries/releases/tag/jdk-11.0.24%2B8) ([#5113](https://github.com/signalfx/splunk-otel-collector/pull/5113)) +- (Splunk) Rabbitmq receiver was added discovery feature([#5113](https://github.com/signalfx/splunk-otel-collector/pull/5051)) ## v0.104.0 diff --git a/cmd/otelcol/config/collector/config.d.linux/receivers/rabbitmq.discovery.yaml b/cmd/otelcol/config/collector/config.d.linux/receivers/rabbitmq.discovery.yaml new file mode 100644 index 0000000000..cdb40d2bf7 --- /dev/null +++ b/cmd/otelcol/config/collector/config.d.linux/receivers/rabbitmq.discovery.yaml @@ -0,0 +1,32 @@ +##################################################################################### +# This file is generated by the Splunk Distribution of the OpenTelemetry Collector. # +# # +# It reflects the default configuration bundled in the Collector executable for use # +# in discovery mode (--discovery) and is provided for reference or customization. # +# Please note that any changes made to this file will need to be reconciled during # +# upgrades of the Collector. # +##################################################################################### +# rabbitmq: +# enabled: true +# rule: +# docker_observer: type == "container" and any([name, image, command], {# matches "(?i)rabbitmq.*"}) and not (command matches "splunk.discovery") +# host_observer: type == "hostport" and command matches "(?i)rabbitmq.*" and not (command matches "splunk.discovery") +# k8s_observer: type == "port" and pod.name matches "(?i)rabbitmq.*" +# config: +# default: +# endpoint: '`endpoint`' +# username: splunk.discovery.default +# password: splunk.discovery.default +# collection_interval: 10s +# status: +# metrics: +# - status: successful +# strict: rabbitmq.consumer.count +# message: rabbitmq receiver is working! +# statements: +# - status: failed +# regexp: 'connect: network is unreachable' +# message: The container cannot be reached by the Collector. Make sure they're in the same network. +# - status: failed +# regexp: 'connect: connection refused' +# message: The container is refusing kafka server connections. diff --git a/internal/confmapprovider/discovery/bundle/bundle.d/receivers/rabbitmq.discovery.yaml b/internal/confmapprovider/discovery/bundle/bundle.d/receivers/rabbitmq.discovery.yaml new file mode 100644 index 0000000000..c5bac66510 --- /dev/null +++ b/internal/confmapprovider/discovery/bundle/bundle.d/receivers/rabbitmq.discovery.yaml @@ -0,0 +1,28 @@ +##################################################################################### +# Do not edit manually! # +# All changes must be made to associated .tmpl file before running 'make bundle.d'. # +##################################################################################### +rabbitmq: + enabled: true + rule: + docker_observer: type == "container" and any([name, image, command], {# matches "(?i)rabbitmq.*"}) and not (command matches "splunk.discovery") + host_observer: type == "hostport" and command matches "(?i)rabbitmq.*" and not (command matches "splunk.discovery") + k8s_observer: type == "port" and pod.name matches "(?i)rabbitmq.*" + config: + default: + endpoint: '`endpoint`' + username: splunk.discovery.default + password: splunk.discovery.default + collection_interval: 10s + status: + metrics: + - status: successful + strict: rabbitmq.consumer.count + message: rabbitmq receiver is working! + statements: + - status: failed + regexp: 'connect: network is unreachable' + message: The container cannot be reached by the Collector. Make sure they're in the same network. + - status: failed + regexp: 'connect: connection refused' + message: The container is refusing kafka server connections. diff --git a/internal/confmapprovider/discovery/bundle/bundle.d/receivers/rabbitmq.discovery.yaml.tmpl b/internal/confmapprovider/discovery/bundle/bundle.d/receivers/rabbitmq.discovery.yaml.tmpl new file mode 100644 index 0000000000..e440ebeeb4 --- /dev/null +++ b/internal/confmapprovider/discovery/bundle/bundle.d/receivers/rabbitmq.discovery.yaml.tmpl @@ -0,0 +1,24 @@ +{{ receiver "rabbitmq" }}: + enabled: true + rule: + docker_observer: type == "container" and any([name, image, command], {# matches "(?i)rabbitmq.*"}) and not (command matches "splunk.discovery") + host_observer: type == "hostport" and command matches "(?i)rabbitmq.*" and not (command matches "splunk.discovery") + k8s_observer: type == "port" and pod.name matches "(?i)rabbitmq.*" + config: + default: + endpoint: '`endpoint`' + username: {{ defaultValue }} + password: {{ defaultValue }} + collection_interval: 10s + status: + metrics: + - status: successful + strict: rabbitmq.consumer.count + message: rabbitmq receiver is working! + statements: + - status: failed + regexp: 'connect: network is unreachable' + message: The container cannot be reached by the Collector. Make sure they're in the same network. + - status: failed + regexp: 'connect: connection refused' + message: The container is refusing kafka server connections. diff --git a/internal/confmapprovider/discovery/bundle/bundle_gen.go b/internal/confmapprovider/discovery/bundle/bundle_gen.go index b379bc2d6d..927baa4902 100644 --- a/internal/confmapprovider/discovery/bundle/bundle_gen.go +++ b/internal/confmapprovider/discovery/bundle/bundle_gen.go @@ -35,6 +35,8 @@ //go:generate discoverybundler -r -c -d ../../../../cmd/otelcol/config/collector/config.d.linux/receivers -t bundle.d/receivers/oracledb.discovery.yaml.tmpl //go:generate discoverybundler -r -t bundle.d/receivers/postgresql.discovery.yaml.tmpl //go:generate discoverybundler -r -c -d ../../../../cmd/otelcol/config/collector/config.d.linux/receivers -t bundle.d/receivers/postgresql.discovery.yaml.tmpl +//go:generate discoverybundler -r -t bundle.d/receivers/rabbitmq.discovery.yaml.tmpl +//go:generate discoverybundler -r -c -d ../../../../cmd/otelcol/config/collector/config.d.linux/receivers -t bundle.d/receivers/rabbitmq.discovery.yaml.tmpl //go:generate discoverybundler -r -t bundle.d/receivers/redis.discovery.yaml.tmpl //go:generate discoverybundler -r -c -d ../../../../cmd/otelcol/config/collector/config.d.linux/receivers -t bundle.d/receivers/redis.discovery.yaml.tmpl //go:generate discoverybundler -r -t bundle.d/receivers/smartagent-collectd-mysql.discovery.yaml.tmpl diff --git a/internal/confmapprovider/discovery/bundle/bundledfs_other_test.go b/internal/confmapprovider/discovery/bundle/bundledfs_other_test.go index 796f80c12a..bd9f7ca000 100644 --- a/internal/confmapprovider/discovery/bundle/bundledfs_other_test.go +++ b/internal/confmapprovider/discovery/bundle/bundledfs_other_test.go @@ -33,6 +33,7 @@ func TestBundleDir(t *testing.T) { "bundle.d/receivers/mysql.discovery.yaml", "bundle.d/receivers/oracledb.discovery.yaml", "bundle.d/receivers/postgresql.discovery.yaml", + "bundle.d/receivers/rabbitmq.discovery.yaml", "bundle.d/receivers/redis.discovery.yaml", "bundle.d/receivers/smartagent-collectd-mysql.discovery.yaml", "bundle.d/receivers/smartagent-collectd-nginx.discovery.yaml", diff --git a/internal/confmapprovider/discovery/bundle/bundledfs_others.go b/internal/confmapprovider/discovery/bundle/bundledfs_others.go index dd7a23a0da..4aa7efaeb0 100644 --- a/internal/confmapprovider/discovery/bundle/bundledfs_others.go +++ b/internal/confmapprovider/discovery/bundle/bundledfs_others.go @@ -31,6 +31,7 @@ import ( //go:embed bundle.d/receivers/mysql.discovery.yaml //go:embed bundle.d/receivers/oracledb.discovery.yaml //go:embed bundle.d/receivers/postgresql.discovery.yaml +//go:embed bundle.d/receivers/rabbitmq.discovery.yaml //go:embed bundle.d/receivers/redis.discovery.yaml //go:embed bundle.d/receivers/smartagent-collectd-mysql.discovery.yaml //go:embed bundle.d/receivers/smartagent-collectd-nginx.discovery.yaml diff --git a/internal/confmapprovider/discovery/bundle/bundledfs_windows.go b/internal/confmapprovider/discovery/bundle/bundledfs_windows.go index 236bd38f93..a32f8c56cb 100644 --- a/internal/confmapprovider/discovery/bundle/bundledfs_windows.go +++ b/internal/confmapprovider/discovery/bundle/bundledfs_windows.go @@ -31,6 +31,7 @@ import ( //go:embed bundle.d/receivers/mysql.discovery.yaml //go:embed bundle.d/receivers/oracledb.discovery.yaml //go:embed bundle.d/receivers/postgresql.discovery.yaml +//go:embed bundle.d/receivers/rabbitmq.discovery.yaml //go:embed bundle.d/receivers/redis.discovery.yaml //go:embed bundle.d/receivers/smartagent-postgresql.discovery.yaml var BundledFS embed.FS diff --git a/internal/confmapprovider/discovery/bundle/bundledfs_windows_test.go b/internal/confmapprovider/discovery/bundle/bundledfs_windows_test.go index 1b6b2d2ee5..b8ace5237c 100644 --- a/internal/confmapprovider/discovery/bundle/bundledfs_windows_test.go +++ b/internal/confmapprovider/discovery/bundle/bundledfs_windows_test.go @@ -33,6 +33,7 @@ func TestBundleDir(t *testing.T) { "bundle.d/receivers/mysql.discovery.yaml", "bundle.d/receivers/oracledb.discovery.yaml", "bundle.d/receivers/postgresql.discovery.yaml", + "bundle.d/receivers/rabbitmq.discovery.yaml", "bundle.d/receivers/redis.discovery.yaml", "bundle.d/receivers/smartagent-postgresql.discovery.yaml", }, receivers) diff --git a/internal/confmapprovider/discovery/bundle/components.go b/internal/confmapprovider/discovery/bundle/components.go index e0bf039982..ce368be767 100644 --- a/internal/confmapprovider/discovery/bundle/components.go +++ b/internal/confmapprovider/discovery/bundle/components.go @@ -37,6 +37,7 @@ var ( "mysql", "oracledb", "postgresql", + "rabbitmq", "redis", "smartagent-collectd-mysql", "smartagent-collectd-nginx", @@ -70,6 +71,7 @@ var ( "mysql": {}, "oracledb": {}, "postgresql": {}, + "rabbitmq": {}, "redis": {}, "smartagent-postgresql": {}, }