This chapter presents the available scripts. All our scripts have a detailed synopsis please, check the option “-h” or “—help”.
Operating system Start/Stop integration
DMK provides a tiny script which integrated to the boot procedure serves to start & stop all the PostgreSQL services smoothly for either SYSV or systemd based Linux dsitributions:
This script is parsing the PostgreSQL log file and alerts whenever an issue is found:
$DMK_HOME/bin/dmk-check-pg-logfile.sh --helpUSAGEof dmk-check-pg-logfile.sh -s [-m]SYNOPSIS dmk-check-pg-logfile.sh-h print this help message-s the PostgreSQL pgtab alias-m Send an email incaseof any issues detectedDESCRIPTION This script is used to check the PostgreSQL log file for FATAL and ERROR messages
This script is used to perform basic health check against a PostgreSQL instance and is ending alerts in case of any issues:
$DMK_HOME/bin/dmk-check-postgres.sh --helpUSAGEof dmk-check-postgres.sh -s [-m]SYNOPSIS dmk-check-postgres.sh-v print version ofthis script-h print this help message-s the PostgreSQL pgtab alias-m Send an email incaseof any issues detectedDESCRIPTION This script is used to perform various healthchecks against a PostgreSQL instance
This script is a wrapper around pgBadger and periodically generates pgBadger reports:
$DMK_HOME/bin/dmk-pg-badger-reports.sh --helpUSAGEof dmk-pg-badger-reports.sh -s [-f -d -r -c -t -m -e]SYNOPSIS dmk-pg-badger-reports.sh-v print version ofthis script-h print this help message-s the PostgreSQL pgtab aliasDESCRIPTION This script is used to generate pgbader reports out of the PostgreSQL instance logfilesDEFAULTS We assume that the PostgreSQL logfile is rotated each day
In case BARMAN is used to create PostgreSQL backups this script is a wrapper for automating backups with BARMAN:
$DMK_HOME/bin/dmk-pg-barman-backup.sh --helpUSAGEof dmk-pg-barman-backup.sh -s [-m]SYNOPSIS dmk-pg-barman-backup.sh-v print version ofthis script-h print this help message-s the PostgreSQL pgtab alias-m send mail notification not only on failure but also on successDESCRIPTION This script is a wrapper around barman which does the backup with barman either manually or scheduled via cron
This script is used to automatically create PostgreSQL instances:
$DMK_HOME/bin/dmk-pg-dbcreate.pl --helpUSAGEof dmk-pg-dbcreate.plSYNOPSIS dmk-pg-dbcreate.pl -f <configuration_file>DESCRIPTION Initializes a PostgreSQL database cluster based on the configuration file There is a template configuration file in $DMK_HOME/templates/postgres/create_database.cfgDEPENDENCIES Basic DMK environment must be installed previously For the creation of the systemd service sudo must be setup for the postgres user.LIMITATIONSn.aPARAMETERS-h|help Display help-v|version Display version-f|file Path to the configuration fileDISCLAIMERn.a.
This script helps with doing logical dumps of PostgreSQL instances:
$DMK_HOME/bin/dmk-pg-dump.sh --helpUSAGEof dmk-pg-dump.sh -s [-f -d -r -c -t -m -e -l]SYNOPSIS dmk-pg-dump.sh-v print version ofthis script-h print this help message-s the PostgreSQL pgtab alias-f shall we do a full dump ? (pg_dumpall)-d the database which shall be dumped, if not a full dump-r the retention in days to keep the dumps-c compress the dump (ignored for full dumps)-t the target directory for the dumps-m send mail notification not only on failure but also on success-e send an email which lists all dumps that have been deleted according to the retention policy-l the host the database instance is running on when not localhost this is used for dumping over the network-u the user to be used for connecting to the database. The default is postgres. we do not accept a password so it must be either in .pgpass or the environmentDESCRIPTION This script is used to either dump a single database from a PostgreSQL instance or to do a full dump of the whole PostgreSQL cluster. For adatabase dump we use standard pg_dump and for a full dump we use standardpg_dumpall.DEFAULTS- The default is to do a full dump,this means if you do not providea database name to dump a full dump will be done- The default target directory is:/u90/pgdata/[PGALIAS]/dumps/ You can overwrite this by usingthe -t switch- The default retention to keep the dumps is 7 days You can overwrite this by usingthe -r switch
dmk-pgpool-*.sh
The dmk-pgpool scripts provide integration with pgpgool when it comes to automated failover and can be used as templates for custom setups.