@@ -285,6 +285,19 @@ var builtinMetricMaps = map[string]intermediateMetricMap{
285285true ,
2862860 ,
287287},
288+ "pg_stat_archiver" : {
289+ map [string ]ColumnMapping {
290+ "archived_count" : {COUNTER , "Number of WAL files that have been successfully archived" , nil , nil },
291+ "last_archived_wal" : {DISCARD , "Name of the last WAL file successfully archived" , nil , nil },
292+ "last_archived_time" : {DISCARD , "Time of the last successful archive operation" , nil , nil },
293+ "failed_count" : {COUNTER , "Number of failed attempts for archiving WAL files" , nil , nil },
294+ "last_failed_wal" : {DISCARD , "Name of the WAL file of the last failed archival operation" , nil , nil },
295+ "last_failed_time" : {DISCARD , "Time of the last failed archival operation" , nil , nil },
296+ "stats_reset" : {DISCARD , "Time at which these statistics were last reset" , nil , nil },
297+ "last_archive_age" : {GAUGE , "Time in seconds since last WAL segment was successfully archived" , nil , nil },
298+ },
299+ 0 ,
300+ },
288301"pg_stat_activity" : {
289302map [string ]ColumnMapping {
290303"datname" : {LABEL , "Name of this database" , nil , nil },
@@ -363,6 +376,17 @@ var queryOverrides = map[string][]OverrideQuery{
363376},
364377},
365378
379+ "pg_stat_archiver" : {
380+ {
381+ semver .MustParseRange (">=0.0.0" ),
382+ `
383+ SELECT *,
384+ extract(epoch from now() - last_archived_time) AS last_archive_age
385+ FROM pg_stat_archiver
386+ ` ,
387+ },
388+ },
389+
366390"pg_stat_activity" : {
367391// This query only works
368392{
0 commit comments