Skip to content

Commit

Permalink
Add support for SQL responses in key/value format (#15845)
Browse files Browse the repository at this point in the history
There are some queries like mysql `SHOW STATUS` that display the
results in a key/value format so they need to be scanned in a different
way, being the key the first column of the response and the value the
second one.
  • Loading branch information
rvillablanca authored and jsoriano committed Jan 27, 2020
1 parent 89822fe commit d8517c6
Show file tree
Hide file tree
Showing 13 changed files with 1,479 additions and 47 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.next.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ https://github.com/elastic/beats/compare/v7.0.0-alpha2...master[Check the HEAD d
- Add mesh metricset for Istio Metricbeat module {pull}15535[15535]
- Add mixer metricset for Istio Metricbeat module {pull}15696[15696]
- Make the `system/cpu` metricset collect normalized CPU metrics by default. {issue}15618[15618] {pull}15729[15729]
- Add `key/value` mode for SQL module. {issue}15770[15770] {pull]15845[15845]
- Add STAN dashboard {pull}15654[15654]
- Add support for Unix socket in Memcached metricbeat module. {issue}13685[13685] {pull}15822[15822]

Expand Down
2 changes: 1 addition & 1 deletion metricbeat/docs/modules/sql.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ metricbeat.modules:
driver: "postgres"
sql_query: "select now()"
sql_response_format: table
----

[float]
Expand Down
2 changes: 1 addition & 1 deletion x-pack/metricbeat/metricbeat.reference.yml
Original file line number Diff line number Diff line change
Expand Up @@ -988,7 +988,7 @@ metricbeat.modules:

driver: "postgres"
sql_query: "select now()"

sql_response_format: table

#--------------------------------- Stan Module ---------------------------------
- module: stan
Expand Down
2 changes: 1 addition & 1 deletion x-pack/metricbeat/module/sql/_meta/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@

driver: "postgres"
sql_query: "select now()"

sql_response_format: table
364 changes: 358 additions & 6 deletions x-pack/metricbeat/module/sql/query/_meta/data.json

Large diffs are not rendered by default.

30 changes: 30 additions & 0 deletions x-pack/metricbeat/module/sql/query/_meta/data_mysql_tables.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
{
"@timestamp": "2017-10-12T08:05:34.853Z",
"event": {
"dataset": "sql.query",
"duration": 115000,
"module": "sql"
},
"metricset": {
"name": "query",
"period": 10000
},
"service": {
"address": "172.21.0.2:3306",
"type": "sql"
},
"sql": {
"driver": "mysql",
"metrics": {
"numeric": {
"table_rows": 1
},
"string": {
"engine": "MyISAM",
"table_name": "db",
"table_schema": "mysql"
}
},
"query": "select table_schema, table_name, engine, table_rows from information_schema.tables where table_rows \u003e 0;"
}
}
Loading

0 comments on commit d8517c6

Please sign in to comment.