bin/metric-postgres-locks.rb in sensu-plugins-postgres-3.0.0 vs bin/metric-postgres-locks.rb in sensu-plugins-postgres-4.0.0
- old
+ new
@@ -1,6 +1,8 @@
#! /usr/bin/env ruby
+# frozen_string_literal: true
+
#
# metric-postgres-locks
#
# DESCRIPTION:
#
@@ -81,15 +83,15 @@
def run
timestamp = Time.now.to_i
locks_per_type = Hash.new(0)
pgpass
- con = PG.connect(host: config[:hostname],
- dbname: config[:database],
- user: config[:user],
- password: config[:password],
- port: config[:port],
- connect_timeout: config[:timeout])
+ con = PG.connect(host: config[:hostname],
+ dbname: config[:database],
+ user: config[:user],
+ password: config[:password],
+ port: config[:port],
+ connect_timeout: config[:timeout])
request = [
'SELECT mode, count(mode) AS count FROM pg_locks',
"WHERE database = (SELECT oid FROM pg_database WHERE datname = '#{config[:database]}')",
'GROUP BY mode'
]