From bbee3fe02a27de23e36cea81f19fe85f26b879b5 Mon Sep 17 00:00:00 2001 From: Shota Ito Date: Tue, 3 Jan 2017 17:25:37 +0900 Subject: [PATCH] Add query count to metricbeat's mysql plugin output (#3251) * Add query count to metricbeat's mysql plugin output * Add semicolon before newline * Add event information to MySQL's fields.yml * Update docs & metricbeat.templates * Change field name from "com" to "command" --- CHANGELOG.asciidoc | 1 + metricbeat/docs/fields.asciidoc | 34 +++++++++++++++++++ metricbeat/metricbeat.template-es2x.json | 16 +++++++++ metricbeat/metricbeat.template.json | 16 +++++++++ .../module/mysql/status/_meta/data.json | 6 ++++ .../module/mysql/status/_meta/fields.yml | 20 +++++++++++ metricbeat/module/mysql/status/data.go | 6 ++++ 7 files changed, 99 insertions(+) diff --git a/CHANGELOG.asciidoc b/CHANGELOG.asciidoc index 6df18192794..b324c599e86 100644 --- a/CHANGELOG.asciidoc +++ b/CHANGELOG.asciidoc @@ -128,6 +128,7 @@ https://github.com/elastic/beats/compare/v5.0.2...v5.1.1[View commits] - Add support for MongoDB 3.4 and WiredTiger metrics. {pull}2999[2999] - Add experimental kafka module with partition metricset. {pull}2969[2969] - Add raw config option for mysql/status metricset. {pull}3001[3001] +- Add command fileds for mysql/status metricset. {pull}3251[3251] *Filebeat* diff --git a/metricbeat/docs/fields.asciidoc b/metricbeat/docs/fields.asciidoc index 3acaa18025b..829c5220807 100644 --- a/metricbeat/docs/fields.asciidoc +++ b/metricbeat/docs/fields.asciidoc @@ -3463,6 +3463,40 @@ type: long +[float] +== command Fields + + + + +[float] +=== mysql.status.command.delete + +type: long + + + +[float] +=== mysql.status.command.insert + +type: long + + + +[float] +=== mysql.status.command.select + +type: long + + + +[float] +=== mysql.status.command.update + +type: long + + + [[exported-fields-nginx]] == Nginx Fields diff --git a/metricbeat/metricbeat.template-es2x.json b/metricbeat/metricbeat.template-es2x.json index a4c29263e8b..8deb3bd08b9 100644 --- a/metricbeat/metricbeat.template-es2x.json +++ b/metricbeat/metricbeat.template-es2x.json @@ -1885,6 +1885,22 @@ } } }, + "command": { + "properties": { + "delete": { + "type": "long" + }, + "insert": { + "type": "long" + }, + "select": { + "type": "long" + }, + "update": { + "type": "long" + } + } + }, "connections": { "type": "long" }, diff --git a/metricbeat/metricbeat.template.json b/metricbeat/metricbeat.template.json index af07b287ac5..067adddb2ca 100644 --- a/metricbeat/metricbeat.template.json +++ b/metricbeat/metricbeat.template.json @@ -1878,6 +1878,22 @@ } } }, + "command": { + "properties": { + "delete": { + "type": "long" + }, + "insert": { + "type": "long" + }, + "select": { + "type": "long" + }, + "update": { + "type": "long" + } + } + }, "connections": { "type": "long" }, diff --git a/metricbeat/module/mysql/status/_meta/data.json b/metricbeat/module/mysql/status/_meta/data.json index 2bf5175ae11..c5b2ca25b07 100644 --- a/metricbeat/module/mysql/status/_meta/data.json +++ b/metricbeat/module/mysql/status/_meta/data.json @@ -26,6 +26,12 @@ "received": 992, "sent": 40657 }, + "command": { + "delete": 0, + "insert": 0, + "select": 9, + "update": 0 + }, "connections": 11, "created": { "tmp": { diff --git a/metricbeat/module/mysql/status/_meta/fields.yml b/metricbeat/module/mysql/status/_meta/fields.yml index 57f233929e3..bc9c5535cbc 100644 --- a/metricbeat/module/mysql/status/_meta/fields.yml +++ b/metricbeat/module/mysql/status/_meta/fields.yml @@ -135,3 +135,23 @@ - name: opened_tables type: long description: > + + - name: command + type: group + description: > + fields: + - name: delete + type: long + description: > + + - name: insert + type: long + description: > + + - name: select + type: long + description: > + + - name: update + type: long + description: > \ No newline at end of file diff --git a/metricbeat/module/mysql/status/data.go b/metricbeat/module/mysql/status/data.go index 274c2aa9ab4..c3430ada99b 100644 --- a/metricbeat/module/mysql/status/data.go +++ b/metricbeat/module/mysql/status/data.go @@ -49,6 +49,12 @@ var ( "tables": c.Int("Open_tables"), }, "opened_tables": c.Int("Opened_tables"), + "command": s.Object{ + "delete": c.Int("Com_delete"), + "insert": c.Int("Com_insert"), + "select": c.Int("Com_select"), + "update": c.Int("Com_update"), + }, } )