=head1 OmniPITR - omnipitr-monitor =head2 USAGE /some/path/omnipitr/bin/omnipitr-monitor [options] Where: =over =item --log (-l) Points to logfile created by I tool that should be monitored. It can contain strftime-type marks - just like --log argument to other I 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: --log '/var/log/omnipitr-^Y-^m-^d.log' You can provide multiple --log options, in case your system is configured in such a way that every tool logs to its own logs. =item --check (-c) contains name of check that should be performed. For list of checks, please read L section. =item --state-dir (-s) is a name of directory that will be used to store state between calls to checks =item --verbose (-v) shows information about reading lines from log files. =item --psql-path (-pp) path to psql - used when getting data from database =item --temp-dir (-t) - Where to create temporary files (defaults to /tmp or I<$TMPDIR> environment variable location) =item options depend on which check being performed. Most checks don't have any options. List of options for check is supplied in L section. Any check can have it's own set of options, but there are four reserved options for database connection settings: =over =item --database (-d) Which database to connect to to issue required SQL queries. Defaults to template1. =item --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. =item --port (-p) Which port to connect to when connecting to database. Defaults to 5432. =item --username (-U) What username to use when connecting to database. Defaults to postgres. =item --version (-V) Prints version of I, and exists. =item --help (-?) Prints this manual, and exists. =back 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. =back =head2 DESCRIPTION This script simply reads log files from other I tools, and reports values useful for monitoring in Nagios, Cacti or other tools. =head2 CHECKS =head3 last-archive-age 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 I =head3 current-archive-time 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 I =head3 archive-queue 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. =head3 last-restore-age 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 I =head3 errors Lists all errors that happened from last call to errors check in given logfile. Can have option: --from Where value of from is treated as: =over =item * Date time in format: %Y-%m-%d %H:%M:%S (for example: 2009-12-24 15:45:32) =item * interval, in seconds (for example: 300 - means check last 5 minutes) =back Works with logfiles of all types. =head3 last-backup-age Returns when last backup was finished, in seconds that passed since. Requires path to log from I or I =head2 EXAMPLES =head3 Getting age of last archive: .../omnipitr-monitor -l /var/log/omnipitr/archive-^Y-^m-^d.log -c last-archive-age -s /var/lib/omnipitr =head3 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 =head3 Getting errors for reporting: .../omnipitr-monitor -l /var/log/omnipitr/archive-^Y-^m-^d.log -c errors -s /var/lib/omnipitr =head3 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 =head2 COPYRIGHT The OmniPITR project is Copyright (c) 2009-2013 OmniTI. All rights reserved.