check_name: host => 'localhost', port => 5432, user => 'someuser', pass => 'somepass', params => ['10 seconds']
}
=head1 DESCRIPTION
This module checks Postgres.
=head1 CONFIGURATION
=over
=item check_name
The check to run.
=item host
The host to connect to
=item port
The port that the service listens on. This defaults to 5432.
=item user
The username to connect as.
=item pass
The password to connect with.
=item params
An array ref of params to pass to the query.
=back
=head1 METRICS
This check returns the metrics from the selected check.
=cut
=head1 NOTES
None.
=cut
my%checks=(
slave_lag=>{
query=>q[select
extract(epoch from lag) as slave_lag,
extract(epoch from max_lag) as max_slave_lag,
coalesce(lag <= max_lag + coalesce($1::interval,'0 seconds'::interval),true) as ok
from
(select
now() - pg_last_xact_replay_timestamp() as lag,
greatest((nullif(current_setting('max_standby_streaming_delay'),'-1'))::interval,(nullif(current_setting('max_standby_archive_delay'),'-1'))::interval) as max_lag)],