- OmniPITR - omnipitr-monitor
OmniPITR - omnipitr-monitor
--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.
Please note that on some systems (Solaris for example) default shell treats ^ as special character, which requires you to quote the log filename (if it contains ^ character). So you'd better write it as:
You can provide multiple --log options, in case your system is configured in such a way that every tool logs to its own logs.
--check (-c) contains name of check that should be performed.
For list of checks, please read CHECKS section.
--state-dir (-s) is a name of directory that will be used to store state between calls to checks
--verbose (-v) shows information about reading lines from log files.
--psql-path (-pp) path to psql - used when getting data from database
--temp-dir (-t) - Where to create temporary files (defaults to /tmp or $TMPDIR environment variable location)
options depend on which check being performed.
Most checks don't have any options. List of options for check is supplied in CHECKS section.
Any check can have it's own set of options, but there are four reserved options for database connection settings:
- --database (-d)
Which database to connect to to issue required SQL queries. Defaults to template1.
- --host (-h)
Which host to connect to when connecting to database to backup. Shouldn't really be changed in 99% of cases. Defaults to empty string - i.e. use UNIX sockets.
- --port (-p)
Which port to connect to when connecting to database. Defaults to 5432.
- --username (-U)
What username to use when connecting to database. Defaults to postgres.
That is - if any check requires connection to database - details of connections will be expected to be passed using these options.
And if the check doesn't need database access - it is guaranteed that these options (neither long nor short forms) will not be reused for other purposes.
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
This check returns 0 if there is currently no archive happening. If there is one, it will return number of seconds that passed since start of archiving.
This might be used, for example, to raise alert if single archive takes more than x seconds.
Requires path to log from omnipitr-archive
Shows number of xlog files that are waiting to be archived. This, in normal circumstances, shouldn't be larger than 1, and usually should be 0.
This check will need to connect to master database, so you might need to provide database connection parameters and/or psql path.
Information about these options is in USAGE section at the beginning of this manual.
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 reporting:
.../omnipitr-monitor -l /var/log/omnipitr/archive-^Y-^m-^d.log -c errors -s /var/lib/omnipitr
Getting errors for reporting, 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-2012 OmniTI. All rights reserved.