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

[discovery] Enable discovery mode for SQL Server receiver #5109

Merged
merged 8 commits into from
Jul 29, 2024
Merged
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

## Unreleased

### 💡 Enhancements 💡

- (Splunk) `discovery`: Enable discovery mode for SQL Server receiver ([#5109](https://github.com/signalfx/splunk-otel-collector/pull/5109))

## v0.104.0

This Splunk OpenTelemetry Collector release includes changes from the [opentelemetry-collector v0.104.0](https://github.com/open-telemetry/opentelemetry-collector/releases/tag/v0.104.0) and the [opentelemetry-collector-contrib v0.104.0](https://github.com/open-telemetry/opentelemetry-collector-contrib/releases/tag/v0.104.0) releases where appropriate.
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@
#####################################################################################
# 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. #
#####################################################################################
# sqlserver:
# enabled: true
# rule:
# docker_observer: type == "container" and any([name, image, command], {# matches "(?i)mssql"}) and not (command matches "splunk.discovery")
# host_observer: type == "hostport" and command matches "(?i)mssql" and not (command matches "splunk.discovery")
# k8s_observer: type == "port" and pod.name matches "(?i)mssql"
# config:
# default:
# username: splunk.discovery.default
# password: splunk.discovery.default
# server: '`host`'
# port: '`port`'
# resource_attributes:
# sqlserver.instance.name:
# enabled: true
# metrics:
# # Enable all OOTB dashboard default metrics
# sqlserver.batch.request.rate:
# enabled: true
# sqlserver.batch.sql_compilation.rate:
# enabled: true
# sqlserver.batch.sql_recompilation.rate:
# enabled: true
# sqlserver.database.count:
# enabled: true
# sqlserver.database.io:
# enabled: true
# sqlserver.database.latency:
# enabled: true
# sqlserver.database.operations:
# enabled: true
# sqlserver.lock.wait.rate:
# enabled: true
# sqlserver.page.buffer_cache.hit_ratio:
# enabled: true
# sqlserver.processes.blocked:
# enabled: true
# sqlserver.resource_pool.disk.throttled.read.rate:
# enabled: true
# sqlserver.resource_pool.disk.throttled.write.rate:
# enabled: true
# sqlserver.user.connection.count:
# enabled: true
# # Disable upstream default metrics that OOTB dashboards don't use
# sqlserver.lock.wait_time.avg:
# enabled: false
# sqlserver.page.checkpoint.flush.rate:
# enabled: false
# sqlserver.page.lazy_write.rate:
# enabled: false
# sqlserver.page.life_expectancy:
# enabled: false
# sqlserver.page.operation.rate:
# enabled: false
# sqlserver.page.split.rate:
# enabled: false
# sqlserver.transaction.rate:
# enabled: false
# sqlserver.transaction.write.rate:
# enabled: false
# sqlserver.transaction_log.flush.data.rate:
# enabled: false
# sqlserver.transaction_log.flush.rate:
# enabled: false
# sqlserver.transaction_log.flush.wait.rate:
# enabled: false
# sqlserver.transaction_log.growth.count:
# enabled: false
# sqlserver.transaction_log.shrink.count:
# enabled: false
# sqlserver.transaction_log.usage:
# enabled: false
#
# status:
# metrics:
# - status: successful
# strict: sqlserver.database.io
# message: sqlserver receiver is working!
# statements:
# - status: failed
# regexp: "connection refused"
# message: The container is not serving http connections.
# - status: failed
# regexp: "unable to open tcp connection"
# message: Unable to resolve sql server tcp endpoint
# - status: partial
# regexp: "Login failed for user"
# message: >-
# Make sure your user credentials are correctly specified using the
# `--set splunk.discovery.receivers.sqlserver.config.username="<username>"` and
# `--set splunk.discovery.receivers.sqlserver.config.password="<password>"` command or the
crobert-1 marked this conversation as resolved.
Show resolved Hide resolved
# `SPLUNK_DISCOVERY_RECEIVERS_sqlserver_CONFIG_username="<username>"` and
# `SPLUNK_DISCOVERY_RECEIVERS_sqlserver_CONFIG_password="<password>"` environment variables.
# - status: partial
# regexp: "The user does not have permission"
# message: >-
# Specified user does not have proper permissions. User must have view `SERVER STATE` permissions.
# This can be accomplished by: `GRANT VIEW SERVER STATE TO [username]`
1 change: 1 addition & 0 deletions internal/confmapprovider/discovery/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,7 @@ I. Receivers
* `smartagent` with `collectd/mysql` monitor type ([Linux](./bundle/bundle.d/receivers/smartagent-collectd-mysql.discovery.yaml))
* `smartagent` with `collectd/nginx` monitor type ([Linux](./bundle/bundle.d/receivers/smartagent-collectd-nginx.discovery.yaml))
* `smartagent` with `postgresql` monitor type ([Linux and Windows](./bundle/bundle.d/receivers/smartagent-postgresql.discovery.yaml))
* `sqlserver` ([Linux And Windows](./bundle/bundle.d/receivers/sqlserver.discovery.yaml))

II. Extensions
* `docker_observer` ([Linux and Windows](./bundle/bundle.d/extensions/docker-observer.discovery.yaml))
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
#####################################################################################
# Do not edit manually! #
# All changes must be made to associated .tmpl file before running 'make bundle.d'. #
#####################################################################################
sqlserver:
enabled: true
rule:
docker_observer: type == "container" and any([name, image, command], {# matches "(?i)mssql"}) and not (command matches "splunk.discovery")
host_observer: type == "hostport" and command matches "(?i)mssql" and not (command matches "splunk.discovery")
k8s_observer: type == "port" and pod.name matches "(?i)mssql"
config:
default:
username: splunk.discovery.default
password: splunk.discovery.default
server: '`host`'
port: '`port`'
resource_attributes:
sqlserver.instance.name:
enabled: true
metrics:
# Enable all OOTB dashboard default metrics
sqlserver.batch.request.rate:
enabled: true
sqlserver.batch.sql_compilation.rate:
enabled: true
sqlserver.batch.sql_recompilation.rate:
enabled: true
sqlserver.database.count:
enabled: true
sqlserver.database.io:
enabled: true
sqlserver.database.latency:
enabled: true
sqlserver.database.operations:
enabled: true
sqlserver.lock.wait.rate:
enabled: true
sqlserver.page.buffer_cache.hit_ratio:
enabled: true
sqlserver.processes.blocked:
enabled: true
sqlserver.resource_pool.disk.throttled.read.rate:
enabled: true
sqlserver.resource_pool.disk.throttled.write.rate:
enabled: true
sqlserver.user.connection.count:
enabled: true
# Disable upstream default metrics that OOTB dashboards don't use
sqlserver.lock.wait_time.avg:
enabled: false
sqlserver.page.checkpoint.flush.rate:
enabled: false
sqlserver.page.lazy_write.rate:
enabled: false
sqlserver.page.life_expectancy:
enabled: false
sqlserver.page.operation.rate:
enabled: false
sqlserver.page.split.rate:
enabled: false
sqlserver.transaction.rate:
enabled: false
sqlserver.transaction.write.rate:
enabled: false
sqlserver.transaction_log.flush.data.rate:
enabled: false
sqlserver.transaction_log.flush.rate:
enabled: false
sqlserver.transaction_log.flush.wait.rate:
enabled: false
sqlserver.transaction_log.growth.count:
enabled: false
sqlserver.transaction_log.shrink.count:
enabled: false
sqlserver.transaction_log.usage:
enabled: false

status:
metrics:
- status: successful
strict: sqlserver.database.io
message: sqlserver receiver is working!
statements:
- status: failed
regexp: "connection refused"
message: The container is not serving http connections.
- status: failed
regexp: "unable to open tcp connection"
message: Unable to resolve sql server tcp endpoint
- status: partial
regexp: "Login failed for user"
message: >-
Make sure your user credentials are correctly specified using the
`--set splunk.discovery.receivers.sqlserver.config.username="<username>"` and
`--set splunk.discovery.receivers.sqlserver.config.password="<password>"` command or the
`SPLUNK_DISCOVERY_RECEIVERS_sqlserver_CONFIG_username="<username>"` and
`SPLUNK_DISCOVERY_RECEIVERS_sqlserver_CONFIG_password="<password>"` environment variables.
- status: partial
regexp: "The user does not have permission"
message: >-
Specified user does not have proper permissions. User must have view `SERVER STATE` permissions.
This can be accomplished by: `GRANT VIEW SERVER STATE TO [username]`
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
{{ receiver "sqlserver" }}:
enabled: true
rule:
docker_observer: type == "container" and any([name, image, command], {# matches "(?i)mssql"}) and not (command matches "splunk.discovery")
host_observer: type == "hostport" and command matches "(?i)mssql" and not (command matches "splunk.discovery")
k8s_observer: type == "port" and pod.name matches "(?i)mssql"
config:
default:
username: {{ defaultValue }}
password: {{ defaultValue }}
server: '`host`'
port: '`port`'
resource_attributes:
sqlserver.instance.name:
enabled: true
metrics:
# Enable all OOTB dashboard default metrics
sqlserver.batch.request.rate:
enabled: true
sqlserver.batch.sql_compilation.rate:
enabled: true
sqlserver.batch.sql_recompilation.rate:
enabled: true
sqlserver.database.count:
enabled: true
sqlserver.database.io:
enabled: true
sqlserver.database.latency:
enabled: true
sqlserver.database.operations:
enabled: true
sqlserver.lock.wait.rate:
enabled: true
sqlserver.page.buffer_cache.hit_ratio:
enabled: true
sqlserver.processes.blocked:
enabled: true
sqlserver.resource_pool.disk.throttled.read.rate:
enabled: true
sqlserver.resource_pool.disk.throttled.write.rate:
enabled: true
sqlserver.user.connection.count:
enabled: true
# Disable upstream default metrics that OOTB dashboards don't use
sqlserver.lock.wait_time.avg:
enabled: false
sqlserver.page.checkpoint.flush.rate:
enabled: false
sqlserver.page.lazy_write.rate:
enabled: false
sqlserver.page.life_expectancy:
enabled: false
sqlserver.page.operation.rate:
enabled: false
sqlserver.page.split.rate:
enabled: false
sqlserver.transaction.rate:
enabled: false
sqlserver.transaction.write.rate:
enabled: false
sqlserver.transaction_log.flush.data.rate:
enabled: false
sqlserver.transaction_log.flush.rate:
enabled: false
sqlserver.transaction_log.flush.wait.rate:
enabled: false
sqlserver.transaction_log.growth.count:
enabled: false
sqlserver.transaction_log.shrink.count:
enabled: false
sqlserver.transaction_log.usage:
enabled: false

status:
metrics:
- status: successful
strict: sqlserver.database.io
message: sqlserver receiver is working!
statements:
- status: failed
regexp: "connection refused"
message: The container is not serving http connections.
- status: failed
regexp: "unable to open tcp connection"
message: Unable to resolve sql server tcp endpoint
- status: partial
regexp: "Login failed for user"
message: >-
Make sure your user credentials are correctly specified using the
`--set {{ configProperty "username" "<username>" }}` and
`--set {{ configProperty "password" "<password>" }}` command or the
`{{ configPropertyEnvVar "username" "<username>" }}` and
`{{ configPropertyEnvVar "password" "<password>" }}` environment variables.
- status: partial
regexp: "The user does not have permission"
message: >-
Specified user does not have proper permissions. User must have view `SERVER STATE` permissions.
This can be accomplished by: `GRANT VIEW SERVER STATE TO [username]`
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 @@ -41,5 +41,7 @@
//go:generate discoverybundler -r -c -d ../../../../cmd/otelcol/config/collector/config.d.linux/receivers -t bundle.d/receivers/smartagent-collectd-nginx.discovery.yaml.tmpl
//go:generate discoverybundler -r -t bundle.d/receivers/smartagent-postgresql.discovery.yaml.tmpl
//go:generate discoverybundler -r -c -d ../../../../cmd/otelcol/config/collector/config.d.linux/receivers -t bundle.d/receivers/smartagent-postgresql.discovery.yaml.tmpl
//go:generate discoverybundler -r -t bundle.d/receivers/sqlserver.discovery.yaml.tmpl
//go:generate discoverybundler -r -c -d ../../../../cmd/otelcol/config/collector/config.d.linux/receivers -t bundle.d/receivers/sqlserver.discovery.yaml.tmpl

package bundle
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ func TestBundleDir(t *testing.T) {
"bundle.d/receivers/smartagent-collectd-mysql.discovery.yaml",
"bundle.d/receivers/smartagent-collectd-nginx.discovery.yaml",
"bundle.d/receivers/smartagent-postgresql.discovery.yaml",
"bundle.d/receivers/sqlserver.discovery.yaml",
}, receivers)

extensions, err := fs.Glob(BundledFS, "bundle.d/extensions/*.discovery.yaml")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,4 +34,5 @@ import (
//go:embed bundle.d/receivers/smartagent-collectd-mysql.discovery.yaml
//go:embed bundle.d/receivers/smartagent-collectd-nginx.discovery.yaml
//go:embed bundle.d/receivers/smartagent-postgresql.discovery.yaml
//go:embed bundle.d/receivers/sqlserver.discovery.yaml
var BundledFS embed.FS
Original file line number Diff line number Diff line change
Expand Up @@ -32,4 +32,5 @@ import (
//go:embed bundle.d/receivers/postgresql.discovery.yaml
//go:embed bundle.d/receivers/redis.discovery.yaml
//go:embed bundle.d/receivers/smartagent-postgresql.discovery.yaml
//go:embed bundle.d/receivers/sqlserver.discovery.yaml
var BundledFS embed.FS
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ func TestBundleDir(t *testing.T) {
"bundle.d/receivers/postgresql.discovery.yaml",
"bundle.d/receivers/redis.discovery.yaml",
"bundle.d/receivers/smartagent-postgresql.discovery.yaml",
"bundle.d/receivers/sqlserver.discovery.yaml",
}, receivers)

extensions, err := fs.Glob(BundledFS, "bundle.d/extensions/*.discovery.yaml")
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 @@ -40,6 +40,7 @@ var (
"smartagent-collectd-mysql",
"smartagent-collectd-nginx",
"smartagent-postgresql",
"sqlserver",
}

Components = DiscoComponents{
Expand Down Expand Up @@ -70,6 +71,7 @@ var (
"postgresql": {},
"redis": {},
"smartagent-postgresql": {},
"sqlserver": {},
}
for _, extension := range extensions {
windows[extension] = struct{}{}
Expand Down
Loading