Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Set default metricsets for postgresql module #6761

Merged
merged 1 commit into from
Apr 4, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 2 additions & 22 deletions metricbeat/docs/modules/postgresql.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ This file is generated! See scripts/docs_collector.py
This module periodically fetches metrics from
https://www.postgresql.org/[PostgreSQL] servers.

Default metricsets are `activity`, `bgwriter` and `database`.

[float]
=== Module-specific configuration notes

Expand Down Expand Up @@ -64,29 +66,7 @@ in <<configuration-metricbeat>>. Here is an example configuration:
----
metricbeat.modules:
- module: postgresql
metricsets:
# Stats about every PostgreSQL database
- database

# Stats about the background writer process's activity
- bgwriter

# Stats about every PostgreSQL process
- activity

period: 10s

# The host must be passed as PostgreSQL URL. Example:
# postgres://localhost:5432?sslmode=disable
# The available parameters are documented here:
# https://godoc.org/github.com/lib/pq#hdr-Connection_String_Parameters
hosts: ["postgres://localhost:5432"]

# Username to use when connecting to PostgreSQL. Empty by default.
#username: user

# Password to use when connecting to PostgreSQL. Empty by default.
#password: pass
----

[float]
Expand Down
1 change: 1 addition & 0 deletions metricbeat/metricbeat.reference.yml
Original file line number Diff line number Diff line change
Expand Up @@ -424,6 +424,7 @@ metricbeat.modules:

#----------------------------- PostgreSQL Module -----------------------------
- module: postgresql
enabled: true
metricsets:
# Stats about every PostgreSQL database
- database
Expand Down
25 changes: 25 additions & 0 deletions metricbeat/module/postgresql/_meta/config.reference.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
- module: postgresql
enabled: true
metricsets:
# Stats about every PostgreSQL database
- database

# Stats about the background writer process's activity
- bgwriter

# Stats about every PostgreSQL process
- activity

period: 10s

# The host must be passed as PostgreSQL URL. Example:
# postgres://localhost:5432?sslmode=disable
# The available parameters are documented here:
# https://godoc.org/github.com/lib/pq#hdr-Connection_String_Parameters
hosts: ["postgres://localhost:5432"]

# Username to use when connecting to PostgreSQL. Empty by default.
#username: user

# Password to use when connecting to PostgreSQL. Empty by default.
#password: pass
22 changes: 0 additions & 22 deletions metricbeat/module/postgresql/_meta/config.yml
Original file line number Diff line number Diff line change
@@ -1,24 +1,2 @@
- module: postgresql
metricsets:
# Stats about every PostgreSQL database
- database

# Stats about the background writer process's activity
- bgwriter

# Stats about every PostgreSQL process
- activity

period: 10s

# The host must be passed as PostgreSQL URL. Example:
# postgres://localhost:5432?sslmode=disable
# The available parameters are documented here:
# https://godoc.org/github.com/lib/pq#hdr-Connection_String_Parameters
hosts: ["postgres://localhost:5432"]

# Username to use when connecting to PostgreSQL. Empty by default.
#username: user

# Password to use when connecting to PostgreSQL. Empty by default.
#password: pass
2 changes: 2 additions & 0 deletions metricbeat/module/postgresql/_meta/docs.asciidoc
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
This module periodically fetches metrics from
https://www.postgresql.org/[PostgreSQL] servers.

Default metricsets are `activity`, `bgwriter` and `database`.

[float]
=== Module-specific configuration notes

Expand Down
7 changes: 4 additions & 3 deletions metricbeat/module/postgresql/activity/activity.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,10 @@ import (
// init registers the MetricSet with the central registry.
// The New method will be called after the setup of the module and before starting to fetch data
func init() {
if err := mb.Registry.AddMetricSet("postgresql", "activity", New, postgresql.ParseURL); err != nil {
panic(err)
}
mb.Registry.MustAddMetricSet("postgresql", "activity", New,
mb.WithHostParser(postgresql.ParseURL),
mb.DefaultMetricSet(),
)
}

// MetricSet type defines all fields of the Postgresql MetricSet
Expand Down
7 changes: 4 additions & 3 deletions metricbeat/module/postgresql/bgwriter/bgwriter.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,10 @@ import (
// init registers the MetricSet with the central registry.
// The New method will be called after the setup of the module and before starting to fetch data
func init() {
if err := mb.Registry.AddMetricSet("postgresql", "bgwriter", New, postgresql.ParseURL); err != nil {
panic(err)
}
mb.Registry.MustAddMetricSet("postgresql", "bgwriter", New,
mb.WithHostParser(postgresql.ParseURL),
mb.DefaultMetricSet(),
)
}

// MetricSet type defines all fields of the MetricSet
Expand Down
7 changes: 4 additions & 3 deletions metricbeat/module/postgresql/database/database.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,10 @@ import (
// init registers the MetricSet with the central registry.
// The New method will be called after the setup of the module and before starting to fetch data
func init() {
if err := mb.Registry.AddMetricSet("postgresql", "database", New, postgresql.ParseURL); err != nil {
panic(err)
}
mb.Registry.MustAddMetricSet("postgresql", "database", New,
mb.WithHostParser(postgresql.ParseURL),
mb.DefaultMetricSet(),
)
}

// MetricSet type defines all fields of the MetricSet
Expand Down
22 changes: 0 additions & 22 deletions metricbeat/modules.d/postgresql.yml.disabled
Original file line number Diff line number Diff line change
@@ -1,24 +1,2 @@
- module: postgresql
metricsets:
# Stats about every PostgreSQL database
- database

# Stats about the background writer process's activity
- bgwriter

# Stats about every PostgreSQL process
- activity

period: 10s

# The host must be passed as PostgreSQL URL. Example:
# postgres://localhost:5432?sslmode=disable
# The available parameters are documented here:
# https://godoc.org/github.com/lib/pq#hdr-Connection_String_Parameters
hosts: ["postgres://localhost:5432"]

# Username to use when connecting to PostgreSQL. Empty by default.
#username: user

# Password to use when connecting to PostgreSQL. Empty by default.
#password: pass