1、下载并解压
下载地址:http://sourceforge.net/projects/pgcluu/files/latest/download
[root@gflinux4 pgsql]# tar -zxvf pgcluu-2.1.tar.gz
[root@gflinux4 pgsql]# cd pgcluu-2.1
[root@gflinux4 pgcluu-2.1]# ll
total 848
-rw-rw-r-- 1 1000 1000 19016 Sep 26 06:55 ChangeLog
drwxrwxr-x 2 1000 1000 4096 Sep 26 06:55 doc
-rw-rw-r-- 1 1000 1000 924 Sep 26 06:55 LICENSE
-rw-rw-r-- 1 1000 1000 1387 Sep 26 06:55 Makefile.PL
-rw-rw-r-- 1 1000 1000 250 Sep 26 06:55 MANIFEST
-rw-rw-r-- 1 1000 1000 633 Sep 26 06:55 META.yml
-rwxrwxr-x 1 1000 1000 737708 Sep 26 06:55 pgcluu
-rwxrwxr-x 1 1000 1000 57125 Sep 26 06:55 pgcluu_collectd
-rw-rw-r-- 1 1000 1000 16029 Sep 26 06:55 README
drwxrwxr-x 2 1000 1000 4096 Sep 26 06:55 resources
2、编译并安装
[root@gflinux4 pgcluu-2.1]# perl Makefile.PL
Checking if your kit is complete...
Looks good
Writing Makefile for pgCluu
[root@gflinux4 pgcluu-2.1]# make && make install
cp pgcluu_collectd blib/script/pgcluu_collectd
/usr/bin/perl "-MExtUtils::MY" -e "MY->fixin(shift)" blib/script/pgcluu_collectd
cp pgcluu blib/script/pgcluu
/usr/bin/perl "-MExtUtils::MY" -e "MY->fixin(shift)" blib/script/pgcluu
Manifying blib/man1/pgcluu.1
Installing /usr/share/man/man1/pgcluu.1
Installing /usr/bin/pgcluu_collectd
Installing /usr/bin/pgcluu
Writing /usr/lib/perl5/site_perl/5.8.8/i386-linux-thread-multi/auto/pgCluu/.packlist
Appending installation info to /usr/lib/perl5/5.8.8/i386-linux-thread-multi/perllocal.pod
3、测试
[root@gflinux4 pgcluu-2.1]# pgcluu --help
usage: /usr/bin/pgcluu [options] [-i sar_file | -I sadc_file] [input_dir]
input_dir: directory where pgcluu_collectd or pgstats and sar data
files are stored.
options:
-b, --begin datetime start date/time for the data to be parsed.
-d, --db-only dbname Only report for the whole cluster and the given
database name. You can use it multiple time or
give a comma separated list of database name.
-D, --device-only dev only report I/O stats for a particular device
You can use it multiple time or give a comma
separated list of device name, ex: sda,sdc.
-e, --end datetime end date/time for the data to be parsed.
-i, --sar-file=FILE path to the sar text data file to read to generate
system reports. Default to input_dir/sar_stats.dat.
-I, --sadc-file=FILE sadc binary data file to read to generate system
reports. Default to input_dir/sadc_stats.dat.
-n, --top-number Top number of tables or indexes I/O stats to show.
Default is set to top 10. Set it to 0 to show all.
-N, --network-only iface only report stats for a particular network interface.
You can use it multiple times or give a comma separated
list of network interfaces, ex: eth0,eth1.
-o, --output=DIR output directory
-r, --reverse-date By default pgcluu look at mm/dd/yy format in sar file.
When enabled pgcluu will look at dd/mm/yy format.
-s, --sadf=BIN path to the sadf sysstat command used to read the
sadc binary data file. Default: /usr/bin/sadf.
-S, --disable-sar disable collect of system statistics with sar.
-t, --with-table table Only report for the whole tables and the given
table name. You can use it multiple time or
give a comma separated list of database name.
-T, --no-table Do not report statistics related to tables.
-v, --verbose Print out debug informations.
-V, --version Show pgcluu version and exit.
-z, --timezone +/-XX Set the number of hour(s) from GMT of the timezone.
Use this to adjust date/time from the sar output,
pgcluu use GMT time to draw charts.
--help print usage
For example, you can generate all HTML reports from data files stored into
/tmp/stat_db1/ with the following commands:
mkdir /tmp/report_db1/
pgcluu -o /tmp/report_db1/ /tmp/stat_db1/
If you just want reports of some databases, use the following:
pgcluu -o /tmp/report_db1/ /tmp/stat_db1/ --db-only "db1,db2,db3"
If you just want to create a report from a sar output file:
sar -p -A 10 60 > /root/my_sar_file.txt
pgcluu -o /tmp/report_sar/ -i /root/my_sar_file.txt
[root@gflinux4 pgsql]# sar -p -A 10 60 > /root/my_sar_file.txt
[root@gflinux4 pgsql]# mkdir /tmp/report_sar
[root@gflinux4 pgsql]# pgcluu -o /tmp/report_sar/ -i /root/my_sar_file.txt
4、生成报表
下载文件目录report_sar,双击index.html,根据cpu、memory、process等查看生成的报表。
转载于:https://blog.51cto.com/gfsunny/1585815