Skip to content

Commit

Permalink
[Metricbeat] Use MySQL Host Parser in Query metricset (elastic#20191)
Browse files Browse the repository at this point in the history
  • Loading branch information
sayden authored Jul 23, 2020
1 parent e9ff950 commit 9dc4877
Show file tree
Hide file tree
Showing 11 changed files with 29 additions and 16 deletions.
6 changes: 4 additions & 2 deletions metricbeat/docs/modules/mysql.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,10 @@ in <<configuration-metricbeat>>. Here is an example configuration:
metricbeat.modules:
- module: mysql
metricsets:
- "status"
# - "galera_status"
- status
# - galera_status
# - performance
# - query
period: 10s
# Host DSN should be defined as "user:pass@tcp(127.0.0.1:3306)/"
Expand Down
1 change: 0 additions & 1 deletion metricbeat/docs/modules/mysql/performance.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ beta[]

include::../../../module/mysql/performance/_meta/docs.asciidoc[]

This is a default metricset. If the host module is unconfigured, this metricset is enabled by default.

==== Fields

Expand Down
1 change: 0 additions & 1 deletion metricbeat/docs/modules/mysql/query.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ beta[]

include::../../../module/mysql/query/_meta/docs.asciidoc[]

This is a default metricset. If the host module is unconfigured, this metricset is enabled by default.

==== Fields

Expand Down
6 changes: 4 additions & 2 deletions metricbeat/metricbeat.reference.yml
Original file line number Diff line number Diff line change
Expand Up @@ -647,8 +647,10 @@ metricbeat.modules:
#-------------------------------- MySQL Module --------------------------------
- module: mysql
metricsets:
- "status"
# - "galera_status"
- status
# - galera_status
# - performance
# - query
period: 10s

# Host DSN should be defined as "user:pass@tcp(127.0.0.1:3306)/"
Expand Down
6 changes: 4 additions & 2 deletions metricbeat/module/mysql/_meta/config.epr.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
- module: mysql
metricsets:
- "status"
- "galera_status"
- status
# - galera_status
# - performance
# - query
period: 10s

# Host DSN should be defined as "user:pass@tcp(127.0.0.1:3306)/"
Expand Down
6 changes: 4 additions & 2 deletions metricbeat/module/mysql/_meta/config.reference.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
- module: mysql
metricsets:
- "status"
# - "galera_status"
- status
# - galera_status
# - performance
# - query
period: 10s

# Host DSN should be defined as "user:pass@tcp(127.0.0.1:3306)/"
Expand Down
4 changes: 3 additions & 1 deletion metricbeat/module/mysql/_meta/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
#metricsets:
# - status
# - galera_status
# - performance
# - query
period: 10s

# Host DSN should be defined as "user:pass@tcp(127.0.0.1:3306)/"
Expand All @@ -15,4 +17,4 @@
#username: root

# Password of hosts. Empty by default.
#password: secret
#password: secret
2 changes: 1 addition & 1 deletion metricbeat/module/mysql/performance/manifest.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
default: true
default: false
input:
module: mysql
metricset: query
Expand Down
3 changes: 2 additions & 1 deletion metricbeat/module/mysql/query/query.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,12 @@ import (
"github.com/elastic/beats/v7/libbeat/common/cfgwarn"
"github.com/elastic/beats/v7/metricbeat/helper/sql"
"github.com/elastic/beats/v7/metricbeat/mb"
"github.com/elastic/beats/v7/metricbeat/module/mysql"
)

func init() {
mb.Registry.MustAddMetricSet("mysql", "query", New,
mb.DefaultMetricSet(),
mb.WithHostParser(mysql.ParseDSN),
)
}

Expand Down
4 changes: 3 additions & 1 deletion metricbeat/modules.d/mysql.yml.disabled
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
#metricsets:
# - status
# - galera_status
# - performance
# - query
period: 10s

# Host DSN should be defined as "user:pass@tcp(127.0.0.1:3306)/"
Expand All @@ -18,4 +20,4 @@
#username: root

# Password of hosts. Empty by default.
#password: secret
#password: secret
6 changes: 4 additions & 2 deletions x-pack/metricbeat/metricbeat.reference.yml
Original file line number Diff line number Diff line change
Expand Up @@ -969,8 +969,10 @@ metricbeat.modules:
#-------------------------------- MySQL Module --------------------------------
- module: mysql
metricsets:
- "status"
# - "galera_status"
- status
# - galera_status
# - performance
# - query
period: 10s

# Host DSN should be defined as "user:pass@tcp(127.0.0.1:3306)/"
Expand Down

0 comments on commit 9dc4877

Please sign in to comment.