I am just starting to tackle this question myself.  We employ sensu for 
internal monitoring, and my current strategy is to use slightly modified 
versions of this community check for monitoring lag

https://github.com/sensu/sensu-community-plugins/blob/master/plugins/postgres/postgres-replication.rb

The math is incorrect though, I modified line 58 to be: (0xFF000000 * 
m_segment.hex + m_offset.hex) - (0xFF000000 * s_segment.hex + s_offset.hex)

I also monitor for WAL archival errors in the postgres logs, which at this 
point amount to a grep for 'archive command failed' of the check 
interval... I plan on making it more sophisticated as soon as time permits 
and would be interested on hearing what your approach to that might be.

Finally we have a daily check for successful nightly backups being made. 
 The version of WAL-e we are currently running has a bug in 'backup-list 
LATEST', which I'm pretty sure was fixed in a later release, so the 
approach that I'm taking for those check until we can update is:

last_backup=$(/usr/bin/envdir /etc/wal-e /usr/local/bin/wal-e backup-list | 
tail -1)
last_backup_date=$(echo $last_backup | sed -n 's/.*\([A-Z][a-z]*, 
[0-9][0-9]* [A-Z][a-z]* [0-9][0-9]* [0-9]*:[0-9]*:[0-9][0-9] 
[A-Z][A-Z]*\).*/\1/p')

if [[ $(date -d"$last_backup_date" +'%Y-%m-%dT%H:%M:%S') < $(date 
+'%Y-%m-%dT00:00:00') ]]
then
  echo "CRITICAL: Current backup not found! Last backup taken: 
${last_backup_date}!"
  exit 2
else
  echo "OK: Current backup found."
  exit 0
fi

Those are our WAL-e specific checks at this point.  A little more than you 
asked for, but I hope it helps.

~Brian Oldfield


On Tuesday, May 6, 2014 7:35:51 AM UTC-7, Kevin Harriss wrote:
>
> What are some recommend tools or methods people use for monitoring 
> replication state and WAL lag while using wal-e and streaming replication?
>
> Thanks,
>
> Kevin
>

-- 
You received this message because you are subscribed to the Google Groups 
"wal-e" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to