Skip to content

Commit

Permalink
Metricbeat metricset for postgresql/bgwriter (#2319)
Browse files Browse the repository at this point in the history
Part of #2255.
  • Loading branch information
tsg authored and ruflin committed Aug 22, 2016
1 parent f4aaefa commit a0a1d5b
Show file tree
Hide file tree
Showing 19 changed files with 600 additions and 27 deletions.
98 changes: 97 additions & 1 deletion metricbeat/docs/fields.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -1512,6 +1512,101 @@ Current overall state of this backend. Possible values are:
Text of this backend's most recent query. If state is active this field shows the currently executing query. In all other states, it shows the last query that was executed.


[float]
== bgwriter Fields

Statistics about the background writer process's activity. Collected using the pg_stat_bgwriter query.



[float]
=== postgresql.bgwriter.checkpoints.scheduled

type: long

Number of scheduled checkpoints that have been performed.


[float]
=== postgresql.bgwriter.checkpoints.requested

type: long

Number of requested checkpoints that have been performed.


[float]
=== postgresql.bgwriter.checkpoints.times.write.ms

type: float

Total amount of time that has been spent in the portion of checkpoint processing where files are written to disk, in milliseconds.


[float]
=== postgresql.bgwriter.checkpoints.times.sync.ms

type: float

Total amount of time that has been spent in the portion of checkpoint processing where files are synchronized to disk, in milliseconds.


[float]
=== postgresql.bgwriter.buffers.checkpoints

type: long

Number of buffers written during checkpoints.


[float]
=== postgresql.bgwriter.buffers.clean

type: long

Number of buffers written by the background writer.


[float]
=== postgresql.bgwriter.buffers.clean_full

type: long

Number of times the background writer stopped a cleaning scan because it had written too many buffers.


[float]
=== postgresql.bgwriter.buffers.backend

type: long

Number of buffers written directly by a backend.


[float]
=== postgresql.bgwriter.buffers.backend_fsync

type: long

Number of times a backend had to execute its own fsync call (normally the background writer handles those even when the backend does its own write)


[float]
=== postgresql.bgwriter.buffers.allocated

type: long

Number of buffers allocated.


[float]
=== postgresql.bgwriter.stats_reset

type: date

Time at which these statistics were last reset.


[float]
== database Fields

Expand Down Expand Up @@ -3299,7 +3394,8 @@ The hard limit on the number of file descriptors opened by the process. The hard
[float]
== cgroup Fields

experimental[] Metrics and limits from the cgroup of which the task is a member. cgroup metrics are reported when the process has membership in a non-root cgroup. These metrics are only available on Linux.
experimental[]
Metrics and limits from the cgroup of which the task is a member. cgroup metrics are reported when the process has membership in a non-root cgroup. These metrics are only available on Linux.



Expand Down
10 changes: 9 additions & 1 deletion metricbeat/docs/modules/postgresql.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,12 @@ metricbeat.modules:
# Stats about every PostgreSQL database
#- database
# Stats about the background writer process's activity
#- bgwriter
# Stats about every PostgreSQL process
#-activity
#- activity
#enabled: true
#period: 10s
Expand All @@ -43,9 +47,13 @@ The following metricsets are available:

* <<metricbeat-metricset-postgresql-activity,activity>>

* <<metricbeat-metricset-postgresql-bgwriter,bgwriter>>

* <<metricbeat-metricset-postgresql-database,database>>

include::postgresql/activity.asciidoc[]

include::postgresql/bgwriter.asciidoc[]

include::postgresql/database.asciidoc[]

19 changes: 19 additions & 0 deletions metricbeat/docs/modules/postgresql/bgwriter.asciidoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
////
This file is generated! See scripts/docs_collector.py
////

[[metricbeat-metricset-postgresql-bgwriter]]
include::../../../module/postgresql/bgwriter/_meta/docs.asciidoc[]


==== Fields

For a description of each field in the metricset, see the
<<exported-fields-postgresql,exported fields>> section.

Here is an example document generated by this metricset:

[source,json]
----
include::../../../module/postgresql/bgwriter/_meta/data.json[]
----
6 changes: 5 additions & 1 deletion metricbeat/etc/beat.full.yml
Original file line number Diff line number Diff line change
Expand Up @@ -123,8 +123,12 @@ metricbeat.modules:
# Stats about every PostgreSQL database
#- database

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

# Stats about every PostgreSQL process
#-activity
#- activity

#enabled: true
#period: 10s

Expand Down
59 changes: 58 additions & 1 deletion metricbeat/etc/fields.yml
Original file line number Diff line number Diff line change
Expand Up @@ -885,6 +885,61 @@
shows the currently executing query. In all other states, it shows the
last query that was executed.
- name: bgwriter
type: group
description: >
Statistics about the background writer process's activity. Collected using the
pg_stat_bgwriter query.
fields:
- name: checkpoints.scheduled
type: long
description: >
Number of scheduled checkpoints that have been performed.
- name: checkpoints.requested
type: long
description: >
Number of requested checkpoints that have been performed.
- name: checkpoints.times.write.ms
type: float
description: >
Total amount of time that has been spent in the portion of checkpoint
processing where files are written to disk, in milliseconds.
- name: checkpoints.times.sync.ms
type: float
description: >
Total amount of time that has been spent in the portion of checkpoint
processing where files are synchronized to disk, in milliseconds.
- name: buffers.checkpoints
type: long
description: >
Number of buffers written during checkpoints.
- name: buffers.clean
type: long
description: >
Number of buffers written by the background writer.
- name: buffers.clean_full
type: long
description: >
Number of times the background writer stopped a cleaning scan because it
had written too many buffers.
- name: buffers.backend
type: long
description: >
Number of buffers written directly by a backend.
- name: buffers.backend_fsync
type: long
description: >
Number of times a backend had to execute its own fsync call (normally
the background writer handles those even when the backend does its own
write)
- name: buffers.allocated
type: long
description: >
Number of buffers allocated.
- name: stats_reset
type: date
description: >
Time at which these statistics were last reset.
- name: database
type: group
description: >
Expand Down Expand Up @@ -1984,7 +2039,9 @@
- name: cgroup
type: group
description: >
experimental[] Metrics and limits from the cgroup of which the task is a member.
experimental[]
Metrics and limits from the cgroup of which the task is a member.
cgroup metrics are reported when the process has membership in a
non-root cgroup. These metrics are only available on Linux.
fields:
Expand Down
4 changes: 2 additions & 2 deletions metricbeat/etc/kibana/index-pattern/metricbeat.json

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions metricbeat/include/list.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import (
_ "github.com/elastic/beats/metricbeat/module/nginx/stubstatus"
_ "github.com/elastic/beats/metricbeat/module/postgresql"
_ "github.com/elastic/beats/metricbeat/module/postgresql/activity"
_ "github.com/elastic/beats/metricbeat/module/postgresql/bgwriter"
_ "github.com/elastic/beats/metricbeat/module/postgresql/database"
_ "github.com/elastic/beats/metricbeat/module/redis"
_ "github.com/elastic/beats/metricbeat/module/redis/info"
Expand Down
6 changes: 5 additions & 1 deletion metricbeat/metricbeat.full.yml
Original file line number Diff line number Diff line change
Expand Up @@ -123,8 +123,12 @@ metricbeat.modules:
# Stats about every PostgreSQL database
#- database

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

# Stats about every PostgreSQL process
#-activity
#- activity

#enabled: true
#period: 10s

Expand Down
57 changes: 57 additions & 0 deletions metricbeat/metricbeat.template-es2x.json
Original file line number Diff line number Diff line change
Expand Up @@ -756,6 +756,63 @@
}
}
},
"bgwriter": {
"properties": {
"buffers": {
"properties": {
"allocated": {
"type": "long"
},
"backend": {
"type": "long"
},
"backend_fsync": {
"type": "long"
},
"checkpoints": {
"type": "long"
},
"clean": {
"type": "long"
},
"clean_full": {
"type": "long"
}
}
},
"checkpoints": {
"properties": {
"requested": {
"type": "long"
},
"scheduled": {
"type": "long"
},
"times": {
"properties": {
"sync": {
"properties": {
"ms": {
"type": "float"
}
}
},
"write": {
"properties": {
"ms": {
"type": "float"
}
}
}
}
}
}
},
"stats_reset": {
"type": "date"
}
}
},
"database": {
"properties": {
"blocks": {
Expand Down
57 changes: 57 additions & 0 deletions metricbeat/metricbeat.template.json
Original file line number Diff line number Diff line change
Expand Up @@ -742,6 +742,63 @@
}
}
},
"bgwriter": {
"properties": {
"buffers": {
"properties": {
"allocated": {
"type": "long"
},
"backend": {
"type": "long"
},
"backend_fsync": {
"type": "long"
},
"checkpoints": {
"type": "long"
},
"clean": {
"type": "long"
},
"clean_full": {
"type": "long"
}
}
},
"checkpoints": {
"properties": {
"requested": {
"type": "long"
},
"scheduled": {
"type": "long"
},
"times": {
"properties": {
"sync": {
"properties": {
"ms": {
"type": "float"
}
}
},
"write": {
"properties": {
"ms": {
"type": "float"
}
}
}
}
}
}
},
"stats_reset": {
"type": "date"
}
}
},
"database": {
"properties": {
"blocks": {
Expand Down
Loading

0 comments on commit a0a1d5b

Please sign in to comment.