OmniPITR - omnipitr-monitor


/some/path/omnipitr/bin/omnipitr-monitor --log=... --check=... [--state-dir=...] [options]


  • --log (-l) Points to logfile created by OmniPITR tool that should be monitored.

    It can contain strftime-type marks - just like --log argument to other OmniPITR programs.. Unfortunately due to the %x usage by PostgreSQL, We cannot use %% macros directly. Instead - any occurence of ^ character in log dir will be first changed to %, and later on passed to strftime.

  • --check (-c) contains name of check that should be performed.

    For list of check, please read CHECKS section.

  • --state-dir (-s) is a name of directory that can be used to store state between calls to checks

    This is primarily used to report rates or errors - to avoid checking full logs, and just check from last known position.

  • options depend on which check being performed.

    Most checks don't have any options. List of options for check is supplied in CHECKS section.


This script simply reads log files from other OmniPITR tools, and reports values useful for monitoring in Nagios, Cacti or other tools.



When was the last WAL segment archived. Returns value in seconds being interval between "now" and the moment when last archive happened.

Requires path to log from omnipitr-archive


When was the last WAL segment restored. Returns value in seconds being interval between "now" and the moment when last restore happened.

Requires path to log from omnipitr-restore


Lists all errors that happened from last call to errors check in given logfile.

Can have option:


Where value of from is treated as:

  • Date time in format: ^Y-^m-^d ^H:^M:^S (for example: 2009-12-24 15:45:32)

  • interval, in seconds (for example: 300 - means check last 5 minutes)

Works with logfiles of all types.


Returns when last backup was finished, in seconds that passed since.

Requires path to log from omnipitr-master-backup or omnipitr-slave-backup


Getting age of last archive:

.../omnipitr-monitor -l /var/log/omnipitr/archive-^Y-^m-^d.log -c last-archive-age -s /var/lib/omnipitr

Getting age of last wal restore:

.../omnipitr-monitor -l /var/log/omnipitr/restore-^Y-^m-^d.log -c last-restore-age -s /var/lib/omnipitr

Getting errors for raporting:

.../omnipitr-monitor -l /var/log/omnipitr/archive-^Y-^m-^d.log -c errors -s /var/lib/omnipitr

Getting errors for raporting, but checking always only last 10 minutes of logs:

.../omnipitr-monitor -l /var/log/omnipitr/archive-^Y-^m-^d.log -c errors -s /var/lib/omnipitr --from=600

The OmniPITR project is Copyright (c) 2009-2010 OmniTI. All rights reserved.