作者:阎书利
check_postgres.pl是一个 Perl 脚本,它针对一个或多个 Postgres 数据库运行许多不同的测试检查。使用 psql 程序收集信息。
check_postgres涉及方面比较广泛,不仅有常规方面检查,同时也涉及一些主流工具的检查,如:pgbouncer、pgAgent、slony、bucardo等。
可以去如下网站下载脚本
https://bucardo.org/check_postgres/
[postgres@t1ysl ~]$ ll
total 208
-rw-r--r-- 1 postgres dba 209715 Aug 10 2021 check_postgres.tar.gz
[postgres@t1ysl ~]$ tar -xf check_postgres.tar.gz
[postgres@t1ysl ~]$ ll
total 208
drwxr-xr-x 3 postgres dba 289 Feb 4 2020 check_postgres-2.25.0
-rw-r--r-- 1 postgres dba 209715 Aug 10 2021 check_postgres.tar.gz
安装所需环境
[root@t1ysl ~]# yum install perl-DBI perl-DBD-Pg perl-DBD-Pg-tests perl-Time-HiRes -y
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
* base: mirrors.tuna.tsinghua.edu.cn
* extras: mirrors.tuna.tsinghua.edu.cn
* updates: mirrors.tuna.tsinghua.edu.cn
安装
[root@t1ysl check_postgres-2.25.0]# perl Makefile.PL
Configuring check_postgres 2.25.0
Checking if your kit is complete...
Warning: the following files are missing in your kit:
MYMETA.json
MYMETA.yml
Please inform the author.
Writing Makefile for check_postgres
[root@t1ysl check_postgres-2.25.0]# make
cp check_postgres.pl blib/script/check_postgres.pl
/usr/bin/perl -MExtUtils::MY -e 'MY->fixin(shift)' -- blib/script/check_postgres.pl
Manifying blib/man1/check_postgres.1p
[root@t1ysl check_postgres-2.25.0]# make install
Appending installation info to /usr/lib64/perl5/perllocal.pod
[root@t1ysl check_postgres-2.25.0]# mkdir -p /opt/check_postgres/bin
[root@t1ysl check_postgres-2.25.0]# chown postgres:postgres /opt/check_postgres/ -R
[root@t1ysl check_postgres-2.25.0]# su - postgres
Last login: Mon Jul 26 06:16:02 CST 2021 on pts/1
[postgres@t1ysl ~]$ cd