lib/riemann/babbler/plugins/pgsql.rb in riemann-babbler-2.0.0pre6 vs lib/riemann/babbler/plugins/pgsql.rb in riemann-babbler-2.0.0pre7
- old
+ new
@@ -35,10 +35,10 @@
cur_conn = run_sql('select count(1) from pg_stat_activity;').to_i
[cur_conn, (max_conn - res_conn - cur_conn)]
end
def rep_lag_state
- rep_lag = abs(run_sql(plugin.rep_lag_sql).to_i)
+ rep_lag = run_sql(plugin.rep_lag_sql).to_i.abs
if rep_lag >= plugin.rep_lag_crit
{ :service => plugin.service + ' rep_lag', :description => 'Postgresql replication lag state', :state => 'critical', :metric => rep_lag }
elsif rep_lag >= plugin.rep_lag_warn
{ :service => plugin.service + ' rep_lag', :description => 'Postgresql replication lag state', :state => 'warning', :metric => rep_lag }
else