bin/metric-postgres-connections.rb in sensu-plugins-postgres-3.0.0 vs bin/metric-postgres-connections.rb in sensu-plugins-postgres-4.0.0
- old
+ new
@@ -1,6 +1,8 @@
#! /usr/bin/env ruby
+# frozen_string_literal: true
+
#
# metric-postgres-connections
#
# DESCRIPTION:
#
@@ -79,15 +81,15 @@
include Pgpass
def run
timestamp = Time.now.to_i
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 case when count(*) = 1 then 'waiting' else",
"'case when wait_event_type is null then false else true end' end as wait_col",
'from information_schema.columns',
"where table_name = 'pg_stat_activity' and table_schema = 'pg_catalog'",