Skip to content

Commit

Permalink
added rabbitmq to the auto discovery mechanism
Browse files Browse the repository at this point in the history
  • Loading branch information
samiura committed Jul 2, 2024
1 parent 5107850 commit 74425b8
Show file tree
Hide file tree
Showing 9 changed files with 92 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -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: http://localhost:15672
# 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.
Original file line number Diff line number Diff line change
@@ -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: http://localhost:15672
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.
Original file line number Diff line number Diff line change
@@ -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: http://localhost:15672
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.
2 changes: 2 additions & 0 deletions internal/confmapprovider/discovery/bundle/bundle_gen.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,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",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,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
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,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)
Expand Down
2 changes: 2 additions & 0 deletions internal/confmapprovider/discovery/bundle/components.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ var (
"mysql",
"oracledb",
"postgresql",
"rabbitmq",
"redis",
"smartagent-collectd-mysql",
"smartagent-collectd-nginx",
Expand Down Expand Up @@ -68,6 +69,7 @@ var (
"mysql": {},
"oracledb": {},
"postgresql": {},
"rabbitmq": {},
"redis": {},
"smartagent-postgresql": {},
}
Expand Down

0 comments on commit 74425b8

Please sign in to comment.