Sha256: b8d69f0c1c5c3c0fb11abc83e715f12d878c7d9ae029677657ec4f1ab0dd6824

Contents?: true

Size: 547 Bytes

Versions: 6

Compression:

Stored size: 547 Bytes

Contents

# frozen_string_literal: true

module PgUtil
  def check_vsn_newer_than_postgres9(conn)
    pg_vsn = conn.exec("SELECT current_setting('server_version')").getvalue(0, 0)
    pg_vsn = pg_vsn.split(' ')[0]
    Gem::Version.new(pg_vsn) < Gem::Version.new('10.0') && Gem::Version.new(pg_vsn) >= Gem::Version.new('9.0')
  end

  def compute_lag(master, slave, m_segbytes)
    m_segment, m_offset = master.split('/')
    s_segment, s_offset = slave.split('/')
    ((m_segment.hex - s_segment.hex) * m_segbytes) + (m_offset.hex - s_offset.hex)
  end
end

Version data entries

6 entries across 6 versions & 2 rubygems

Version Path
sensu-plugins-postgres-mrtrotl-4.3.1 lib/sensu-plugins-postgres/pgutil.rb
sensu-plugins-postgres-4.2.0 lib/sensu-plugins-postgres/pgutil.rb
sensu-plugins-postgres-4.1.0 lib/sensu-plugins-postgres/pgutil.rb
sensu-plugins-postgres-4.0.2 lib/sensu-plugins-postgres/pgutil.rb
sensu-plugins-postgres-4.0.1 lib/sensu-plugins-postgres/pgutil.rb
sensu-plugins-postgres-4.0.0 lib/sensu-plugins-postgres/pgutil.rb