Skip to content
Merged
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: 24 additions & 0 deletions cmd/postgres_exporter/postgres_exporter.go
Original file line number Diff line number Diff line change
Expand Up @@ -278,6 +278,19 @@ var builtinMetricMaps = map[string]intermediateMetricMap{
},
0,
},
"pg_stat_archiver": {
map[string]ColumnMapping{
"archived_count": {COUNTER, "Number of WAL files that have been successfully archived", nil, nil},
"last_archived_wal": {DISCARD, "Name of the last WAL file successfully archived", nil, nil},
"last_archived_time": {DISCARD, "Time of the last successful archive operation", nil, nil},
"failed_count": {COUNTER, "Number of failed attempts for archiving WAL files", nil, nil},
"last_failed_wal": {DISCARD, "Name of the WAL file of the last failed archival operation", nil, nil},
"last_failed_time": {DISCARD, "Time of the last failed archival operation", nil, nil},
"stats_reset": {DISCARD, "Time at which these statistics were last reset", nil, nil},
"last_archive_age": {GAUGE, "Time in seconds since last WAL segment was successfully archived", nil, nil},
},
0,
},
"pg_stat_activity": {
map[string]ColumnMapping{
"datname": {LABEL, "Name of this database", nil, nil},
Expand Down Expand Up @@ -355,6 +368,17 @@ var queryOverrides = map[string][]OverrideQuery{
},
},

"pg_stat_archiver": {
{
semver.MustParseRange(">=0.0.0"),
`
SELECT *,
extract(epoch from now() - last_archived_time) AS last_archive_age
FROM pg_stat_archiver
`,
},
},

"pg_stat_activity": {
// This query only works
{
Expand Down