监控Postgres数据库
- - 数据库 - ITeye博客官方文档中有关监控的章节:. 这个可以实时监控数据库,但是没有系统cpu和内存图表. 大多数带有系统监控的,都是通过插件实现的,要多安装和配置一些东西. 下面是安装powa的步骤,Centos系统. 在官网下载代码,现在是2.0版,这个版本需要postgresql是9.4以上版本. 我的pg是9.3版,所以下载的1.2.1版本.
官方文档中有关监控的章节:
wget https://github.com/dalibo/powa/archive/REL_1_2_1.zip unzip powa-REL_1_2_1.zip |
cd ./powa-REL_1_2_1 make |
gcc -Wall -Wmissing-prototypes -Wpointer-arith -Wdeclaration-after-statement -Wendif-labels -Wmissing-format-attribute -Wformat-security -fno-strict-aliasing -fwrapv -fexcess-precision=standard -g -fpic -I. -I. -I/home/thomas/postgresql/postgresql-9.3.4/include/server -I/home/thomas/postgresql/postgresql-9.3.4/include/internal -D_GNU_SOURCE -I/usr/include/libxml2 -c -o powa.o powa.c gcc -Wall -Wmissing-prototypes -Wpointer-arith -Wdeclaration-after-statement -Wendif-labels -Wmissing-format-attribute -Wformat-security -fno-strict-aliasing -fwrapv -fexcess-precision=standard -g -fpic -L/home/thomas/postgresql/postgresql-9.3.4/lib -Wl,--as-needed -Wl,-rpath,'/home/thomas/postgresql/postgresql-9.3.4/lib',--enable-new-dtags -shared -o powa.so powa.o |
make install |
$>psql psql (9.3.5) Type "help" for help. postgres=# create database powa; CREATE DATABASE postgres=# \c powa You are now connected to database "powa" as user "postgres". powa=# create extension pg_stat_statements ; CREATE EXTENSION powa=# create extension btree_gist ; CREATE EXTENSION powa=# create extension powa; CREATE EXTENSION powa=# \dt List of relations Schema | Name | Type | Owner --------+---------------------------------+-------+---------- public | powa_functions | table | postgres public | powa_last_aggregation | table | postgres public | powa_last_purge | table | postgres public | powa_statements | table | postgres public | powa_statements_history | table | postgres public | powa_statements_history_current | table | postgres (6 rows) |
shared_preload_libraries = 'powa,pg_stat_statements'# (change requires restart) ....track_io_timing= on |
service postgresql-9.3 restart 或者 pg_ctl restart -m f |
% tar zxf ActivePerl-5.18.4.1804-i686-linux-64int-glibc-2.5-298913.tar.gz % cd ActivePerl-5.18.4.1804-i686-linux-64int-glibc-2.5-298913 % ./install.sh |
Did you read the LICENSE.txt file? [no] yes Do you agree to the ActivePerl is covered by the ActiveState Community License.? [no] yes Enter top level directory for install? [/opt/ActivePerl-5.18] /opt/ActivePerl-5.18 Install HTML documentation [yes] yes Proceed? [yes] yes |
# cd /etc/profile.d # vi perl.sh |
#set perl environment #set perl environment PERL5LIB=/opt/ActivePerl-5.10/lib:/opt/ActivePerl-5.10/site/lib PATH=/opt/ActivePerl-5.10/bin:/opt/ActivePerl-5.10/site/bin:$PATH export PERL5LIB PATH |
# source perl.sh |
cpan cpan>o conf init urllist |
sites for you? (This means connecting to the Internet) [yes] yes |
cpan>o conf commit |
cpan cpan>m DBI |
cpan cpan>install Bundle::DBD::Pg |
tar zxf Mojolicious-4.75 cd Mojolicious-4.75 perl Makefile.PL PREFIX=/path/to/powa/mojo make make install |
cd /path/to/powa/ui/ cp powa.conf-dist powa.conf vi powa.conf |
/path/to/powa/mojo/bin/morbo /path/to/powa/ui/script/powa |
http://ip:3000 |