bin/check-postgres-alive.rb in sensu-plugins-postgres-0.1.1 vs bin/check-postgres-alive.rb in sensu-plugins-postgres-1.0.0

- old
+ new

@@ -56,11 +56,21 @@ description: 'Database port', short: '-P PORT', long: '--port PORT', default: 5432 + option :timeout, + description: 'Connection timeout (seconds)', + short: '-T TIMEOUT', + long: '--timeout TIMEOUT', + default: nil + def run - con = PG::Connection.new(config[:hostname], config[:port], nil, nil, config[:database], config[:user], config[:password]) + con = PG.connect(host: config[:hostname], + dbname: config[:database], + user: config[:user], + password: config[:password], + connect_timeout: config[:timeout]) res = con.exec('select version();') info = res.first ok "Server version: #{info}" rescue PG::Error => e