Skip to content

Commit

Permalink
making mysql discovery rules more stringent and addressed previous mi…
Browse files Browse the repository at this point in the history
…scellaneous PR comments
  • Loading branch information
Samiur Arif committed Jan 18, 2024
1 parent 7e0ecbe commit b9d0459
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 29 deletions.
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
{{ receiver "mysql" }}:
enabled: true
rule:
docker_observer: type == "container" and any([name, image, command], {# matches "(?i)mysql"}) and not (command matches "splunk.discovery")
host_observer: type == "hostport" and command matches "(?i)mysqld"
k8s_observer: type == "port" and pod.name matches "(?i)mysql"
docker_observer: type == "container" and port != 33060 and any([name, image, command], {# matches "(?i)mysql"}) and not (command matches "splunk.discovery")
host_observer: type == "hostport" and port != 33060 and command matches "(?i)mysqld"
k8s_observer: type == "port" and port != 33060 and pod.name matches "(?i)mysql"
config:
default:
username: {{ defaultValue }}
Expand Down Expand Up @@ -35,26 +35,4 @@
`--set {{ configProperty "username" "<username>" }}` and
`--set {{ configProperty "password" "<password>" }}` command or the
`{{ configPropertyEnvVar "username" "<username>" }}` and
`{{ configPropertyEnvVar "password" "<password>" }}` environment variables.
- regexp: '.* Unknown database .*'
first_only: true
log_record:
severity_text: info
append_pattern: true
body: >-
Make sure your MySQL database is correctly specified using the
`--set {{ configProperty "database" "<db-name>" }}` command or the
`{{ configPropertyEnvVar "database" "<db-name>" }}` environment variable.
- regexp: 'mysql: Failed to connect to database .* at server .* Access denied for user .* to database'
first_only: true
log_record:
severity_text: info
append_pattern: true
body: >-
Make sure your MySQL database and auth information are correctly specified using the
`--set {{ configProperty "database" "<db-name>" }}` command or the
`{{ configPropertyEnvVar "database" "<db-name>" }}` environment variable.
`--set {{ configProperty "username" "<username>" }}` and
`--set {{ configProperty "password" "<password>" }}` command or the
`{{ configPropertyEnvVar "username" "<username>" }}` and
`{{ configPropertyEnvVar "password" "<password>" }}` environment variables.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{{ receiver "smartagent/collectd/mysql" }}:
enabled: false
enabled: true
rule:
docker_observer: type == "container" and any([name, image, command], {# matches "(?i)mysql"}) and not (command matches "splunk.discovery")
host_observer: type == "hostport" and command matches "(?i)mysqld"
Expand Down
2 changes: 0 additions & 2 deletions tests/receivers/mysql/bundled_test.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
// Copyright Splunk, Inc.
// Copyright The OpenTelemetry Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -55,7 +54,6 @@ func TestMysqlDockerObserver(t *testing.T) {
"--set", `splunk.discovery.extensions.host_observer.enabled=false`,
"--set", `splunk.discovery.receivers.mysql.config.username=root`,
"--set", `splunk.discovery.receivers.mysql.config.password=testuser`,
"--set", "splunk.discovery.receivers.postgresql.config.tls::insecure=true",
)
},
},
Expand Down
1 change: 0 additions & 1 deletion tests/receivers/smartagent/collectd-mysql/bundled_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -277,7 +277,6 @@ func (cluster testCluster) daemonSet(namespace, serviceAccount, configMap string
"--set", "splunk.discovery.receivers.smartagent/collectd/mysql.config.databases=[{name: 'testdb'}]",
"--set", "splunk.discovery.receivers.smartagent/collectd/mysql.config.innodbStats=true",
"--set", `splunk.discovery.receivers.smartagent/collectd/mysql.config.extraMetrics=["*"]`,
"--set", `splunk.discovery.receivers.smartagent/collectd/mysql.enabled=true`,
},
Env: []corev1.EnvVar{
{Name: "OTLP_ENDPOINT", Value: otlpEndpoint},
Expand Down

0 comments on commit b9d0459

Please sign in to comment.