forked from elastic/beats
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
The SQL module can collect metrics and other data with custom queries, using the database drivers included in Metricbeat.
- Loading branch information
Showing
31 changed files
with
3,328 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
//// | ||
This file is generated! See scripts/mage/docs_collector.go | ||
//// | ||
|
||
[[metricbeat-module-sql]] | ||
[role="xpack"] | ||
== sql module | ||
|
||
beta[] | ||
|
||
This is the sql module that fetches metrics from a SQL database. You can define driver, datasource and SQL query. | ||
|
||
|
||
|
||
|
||
[float] | ||
=== Example configuration | ||
|
||
The sql module supports the standard configuration options that are described | ||
in <<configuration-metricbeat>>. Here is an example configuration: | ||
|
||
[source,yaml] | ||
---- | ||
metricbeat.modules: | ||
- module: sql | ||
metricsets: | ||
- query | ||
period: 10s | ||
hosts: ["localhost"] | ||
driver: "postgres" | ||
datasource: "user=myuser password=mypassword dbname=mydb sslmode=disable" | ||
sql_query: "select now()" | ||
---- | ||
|
||
[float] | ||
=== Metricsets | ||
|
||
The following metricsets are available: | ||
|
||
* <<metricbeat-metricset-sql-query,query>> | ||
|
||
include::sql/query.asciidoc[] | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
//// | ||
This file is generated! See scripts/mage/docs_collector.go | ||
//// | ||
|
||
[[metricbeat-metricset-sql-query]] | ||
=== sql query metricset | ||
|
||
beta[] | ||
|
||
include::../../../../x-pack/metricbeat/module/sql/query/_meta/docs.asciidoc[] | ||
|
||
|
||
==== Fields | ||
|
||
For a description of each field in the metricset, see the | ||
<<exported-fields-sql,exported fields>> section. | ||
|
||
Here is an example document generated by this metricset: | ||
|
||
[source,json] | ||
---- | ||
include::../../../../x-pack/metricbeat/module/sql/query/_meta/data.json[] | ||
---- |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
- module: sql | ||
metricsets: | ||
- query | ||
period: 10s | ||
hosts: ["localhost"] | ||
|
||
driver: "postgres" | ||
datasource: "user=myuser password=mypassword dbname=mydb sslmode=disable" | ||
sql_query: "select now()" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
This is the sql module that fetches metrics from a SQL database. You can define driver, datasource and SQL query. | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
- key: sql | ||
title: "sql" | ||
release: beta | ||
description: > | ||
sql module | ||
fields: | ||
- name: sql | ||
type: group | ||
description: > | ||
`sql` fetches metrics from a SQL database | ||
fields: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
// Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
// or more contributor license agreements. Licensed under the Elastic License; | ||
// you may not use this file except in compliance with the Elastic License. | ||
|
||
// Package sql is a Metricbeat module that collects information from databases using SQL queries. | ||
package sql |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
{ | ||
"@timestamp":"2016-05-23T08:05:34.853Z", | ||
"beat":{ | ||
"hostname":"beathost", | ||
"name":"beathost" | ||
}, | ||
"metricset":{ | ||
"host":"localhost", | ||
"module":"sql", | ||
"name":"query", | ||
"rtt":44269 | ||
}, | ||
"sql":{ | ||
"metrics":{ | ||
"numeric":{ | ||
"mynumericfield":1 | ||
}, | ||
"string":{ | ||
"mystringfield":"abc" | ||
} | ||
}, | ||
"driver":"postgres", | ||
"query":"select * from mytable" | ||
}, | ||
"type":"metricsets" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
The sql `query` metricset collect rows returned by a query. | ||
|
||
Fields names (columns) will be returned as lowercase. | ||
Values will be returned as numeric or string. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
- name: query | ||
type: group | ||
release: beta | ||
description: > | ||
query | ||
fields: | ||
- name: driver | ||
type: keyword | ||
description: > | ||
Driver used to execute the query. | ||
- name: query | ||
type: keyword | ||
description: > | ||
Query executed to collect metrics. | ||
- name: metrics.numeric.* | ||
type: object | ||
object_type: double | ||
description: > | ||
Numeric metrics collected. | ||
- name: metrics.string.* | ||
type: object | ||
object_type: keyword | ||
description: > | ||
Non-numeric values collected. |
Oops, something went wrong.