Skip to content

Commit 4940c3f

Browse files
phumpalmajormoses
authored andcommitted
Adds numbackends to metric-postgres-statsdb
1 parent 7b5e18c commit 4940c3f

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ This project adheres to [Semantic Versioning](http://semver.org/).
44
This CHANGELOG follows the format listed at [Keep A Changelog](http://keepachangelog.com/)
55

66
## [Unreleased]
7+
### Added
8+
- metric-postgres-statsdb.rb: Adds new metric `numbackends`.
79

810
## [1.1.2] - 2017-06-02
911
### Fixed

bin/metric-postgres-statsdb.rb

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,13 +83,14 @@ def run
8383
port: config[:port],
8484
connect_timeout: config[:timeout])
8585
request = [
86-
'select xact_commit, xact_rollback,',
86+
'select numbackends, xact_commit, xact_rollback,',
8787
'blks_read, blks_hit,',
8888
'tup_returned, tup_fetched, tup_inserted, tup_updated, tup_deleted',
8989
"from pg_stat_database where datname='#{config[:database]}'"
9090
]
9191
con.exec(request.join(' ')) do |result|
9292
result.each do |row|
93+
output "#{config[:scheme]}.statsdb.#{config[:database]}.numbackends", row['numbackends'], timestamp
9394
output "#{config[:scheme]}.statsdb.#{config[:database]}.xact_commit", row['xact_commit'], timestamp
9495
output "#{config[:scheme]}.statsdb.#{config[:database]}.xact_rollback", row['xact_rollback'], timestamp
9596
output "#{config[:scheme]}.statsdb.#{config[:database]}.blks_read", row['blks_read'], timestamp

0 commit comments

Comments
 (0)