Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

align metric naming scheme output #46

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion bin/metric-postgres-graphite.rb
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ def lag_compute(res1, res, m_segbytes) # rubocop:disable NestedMethodDefinition

# Compute lag
lag = lag_compute(res1, res, m_segbytes)
output config[:scheme].to_s, lag
output "#{config[:scheme]}.replication.#{config[:database]}.to_s", lag
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a breaking change as it completely changes the metric output and people may have queries that have alerts on them, this needs to be a major version bump which I will do post acceptance.


ok
end
Expand Down
19 changes: 12 additions & 7 deletions bin/metric-postgres-statsbgwriter.rb
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,11 @@ class PostgresStatsDBMetrics < Sensu::Plugin::Metric::CLI::Graphite
short: '-P PORT',
long: '--port PORT'

option :database,
description: 'Database name',
short: '-d DB',
long: '--db DB'

option :scheme,
description: 'Metric naming scheme, text to prepend to $queue_name.$metric',
long: '--scheme SCHEME',
Expand Down Expand Up @@ -91,13 +96,13 @@ def run
]
con.exec(request.join(' ')) do |result|
result.each do |row|
output "#{config[:scheme]}.bgwriter.checkpoints_timed", row['checkpoints_timed'], timestamp
output "#{config[:scheme]}.bgwriter.checkpoints_req", row['checkpoints_req'], timestamp
output "#{config[:scheme]}.bgwriter.buffers_checkpoint", row['buffers_checkpoint'], timestamp
output "#{config[:scheme]}.bgwriter.buffers_clean", row['buffers_clean'], timestamp
output "#{config[:scheme]}.bgwriter.maxwritten_clean", row['maxwritten_clean'], timestamp
output "#{config[:scheme]}.bgwriter.buffers_backend", row['buffers_backend'], timestamp
output "#{config[:scheme]}.bgwriter.buffers_alloc", row['buffers_alloc'], timestamp
output "#{config[:scheme]}.bgwriter.#{config[:database]}.checkpoints_timed", row['checkpoints_timed'], timestamp
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what if they don't specify a database name? I think we need to check if it is set and then change the output on it.

output "#{config[:scheme]}.bgwriter.#{config[:database]}.checkpoints_req", row['checkpoints_req'], timestamp
output "#{config[:scheme]}.bgwriter.#{config[:database]}.buffers_checkpoint", row['buffers_checkpoint'], timestamp
output "#{config[:scheme]}.bgwriter.#{config[:database]}.buffers_clean", row['buffers_clean'], timestamp
output "#{config[:scheme]}.bgwriter.#{config[:database]}.maxwritten_clean", row['maxwritten_clean'], timestamp
output "#{config[:scheme]}.bgwriter.#{config[:database]}.buffers_backend", row['buffers_backend'], timestamp
output "#{config[:scheme]}.bgwriter.#{config[:database]}.buffers_alloc", row['buffers_alloc'], timestamp
end
end

Expand Down