postgres plugin bgwriter stats

Add pg_stat_bg_writer stats
This commit is contained in:
Thomas Menard 2016-02-10 10:40:48 +01:00
parent c09884c686
commit 76dd728c97
1 changed files with 22 additions and 0 deletions

View File

@ -95,6 +95,28 @@ func (p *Postgresql) Gather(acc telegraf.Accumulator) error {
}
}
query = `SELECT * FROM pg_stat_bgwriter`
rows, err := db.Query(query)
if err != nil {
return err
}
defer rows.Close()
// grab the column information from the result
p.OrderedColumns, err = rows.Columns()
if err != nil {
return err
}
for rows.Next() {
err = p.accRow(rows, acc)
if err != nil {
return err
}
}
return rows.Err()
}