开发者社区> pg小助手> 正文
阿里云
为了无法计算的价值
打开APP
阿里云APP内打开

PostgreSQL pg_top pgcenter - 实时top类工具

简介: postgresql pg_top
+关注继续查看

背景
PostgreSQL 的统计信息、实时会话信息、操作系统状态信息等汇总,统计,展示。

https://www.postgresql.org/docs/devel/static/monitoring-stats.html

1 pgcenter
https://github.com/lesovsky/pgcenter

Command-line admin tool for observing and troubleshooting Postgres.

wget https://github.com/lesovsky/pgcenter/releases/download/v0.5.0/pgcenter.linux-amd64.tar.gz
pgCenter is a command line admin tool for PostgreSQL.

Usage:
pgcenter [flags]
pgcenter [command] [command-flags] [args]

Available commands:
config configures Postgres to work with pgcenter
record record stats to file
report make report based on previously saved statistics
top top-like stats viewer

Flags:
-?, --help show this help and exit

  --version         show version information and exit  

Use "pgcenter [command] --help" for more information about a command.

Report bugs to https://github.com/lesovsky/pgcenter/issues
./pgcenter -p 1921 top
2 pg_top
https://git.postgresql.org/gitweb/?p=pg_top.git;a=shortlog;h=refs/heads/master

                                                              pg_top  
                                                     Version 3.7.0  

                                                       Mark Wong  
                                            and a cast of ... a few  

pg_top is 'top' for PostgreSQL. It is derived from Unix Top. Similar to top,
pg_top allows you to monitor PostgreSQL processes. It also allows you to:

* View currently running SQL statement of a process.  
* View query plan of a currently running SELECT statement.  
* View locks held by a process.  
* View user table statistics.  
* View user index statistics.  

CAVEAT: version 3 of pg_top has internal commands that kill and renice

  1. Although I have taken steps to insure that pg_top makes
  2. checks with these commands, I cannot guarantee that these

internal commands are totally secure. IF YOU INSTALL pg_top SET-USER-ID
TO ROOT, YOU DO SO AT YOUR OWN RISK! I realize that some operating
systems will require pg_top to run setuid root, and I will do everything
I can to make sure that pg_top is a secure setuid program.

To compile and install "pg_top", read the file "INSTALL" and follow the
directions and advice contained therein.

If you make any kind of change to "pg_top" that you feel would be
beneficial to others who use this program, or if you find and fix a bug,
please send the change to the pg_top mailing list.

In order to monitor a remote database, the pg_proctab extension needs to be
created on the database to be monitored. Any operating system that pg_proctab
supports can be monitored remotely on any operating system. See details for
pg_protab here:

http://pgxn.org/dist/pg_proctab/

Be sure to read the FAQ enclosed with the distrubution. It contains
answers to the most commonly asked questions about the configuration,
installation, and operation of pg_top.

AVAILABILITY

Project home page:

http://ptop.projects.postgresql.org/

If you have git, you can download the source code:

git clone git://git.postgresql.org/git/pg_top.git

GRATITUDE

Selena Deckelmann & Gabrielle Roth, and the beer & free wi-fi at County Cork
pub in Portland, OR, USA.

LICENSE

pg_top is distributed free of charge under the same terms as the BSD

  1. For an official statement, please refer to the file "LICENSE"
  2. should be included with the source distribution.

AUTHOR

Mark Wong
yum install -y cmake3

su - postgres

https://git.postgresql.org/gitweb/?p=pg_top.git;a=shortlog;h=refs/heads/master

tar -zxvf pg_top-72088ce.tar.gz

cd pg_top-72088ce

alias cmake=cmake3

cmake -DDESTDIR=/var/lib/pgsql/pg_top

make install
pg_top monitors a PostgreSQL database cluster.

Usage:
pg_top [OPTION]... [NUMBER]

Options:
-b, --batch use batch mode
-c, --show-command display command name of each process
-C, --color-mode turn off color mode
-i, --interactive use interactive mode
-I, --hide-idle hide idle processes
-n, --non-interactive use non-interactive mode
-o, --order-field=FIELD select sort order
-q, --quick-mode modify schedule priority

                        usable only by root  

-r, --remote-mode activate remote mode
-s, --set-delay=SECOND set delay between screen updates
-T, --show-tags show color tags
-u, --show-uid show UID instead of username
-V, --version output version information, then exit
-x, --set-display=COUNT set maximum number of displays

                        exit once this number is reached  

-z, --show-username=NAME display only processes owned by given

                        username  

-?, --help show this help, then exit

Connection options:
-d, --dbname=DBNAME database to connect to
-h, --host=HOSTNAME database server host or socket directory
-p, --port=PORT database server port
-U, --username=USERNAME user name to connect as
-W, --password force password prompt
参考
https://git.postgresql.org/gitweb/?p=pg_top.git;a=shortlog;h=refs/heads/master

https://github.com/lesovsky/pgcenter

man pg_top/share/man/man1/pg_top.1

https://www.postgresql.org/docs/devel/static/monitoring-stats.html
转自阿里云德哥

版权声明:本文内容由阿里云实名注册用户自发贡献,版权归原作者所有,阿里云开发者社区不拥有其著作权,亦不承担相应法律责任。具体规则请查看《阿里云开发者社区用户服务协议》和《阿里云开发者社区知识产权保护指引》。如果您发现本社区中有涉嫌抄袭的内容,填写侵权投诉表单进行举报,一经查实,本社区将立刻删除涉嫌侵权内容。

相关文章
7 款常用的 PostgreSQL GUI 工具测评
PostgreSQL 本身附带一个名为 psql 的内置 CLI,但有些人不喜欢通过命令行编写查询。本篇文章,码匠列举和介绍了可用于查询、可视化与分析 PostgreSQL 数据的 GUI 工具。
115 0
新书推荐 |《PostgreSQL实战》出版
很高兴《PostgreSQL实战》一书终于出版,本书大体上系统总结了笔者 PostgreSQL DBA 职业生涯的经验总结,本书的另一位作者张文升拥有丰富的PostgreSQL运维经验,目前就职于探探科技任首席PostgreSQL DBA,他的加入极大地丰富了此书的内容。
3916 0
优秀而又实用的PHP工具集锦
优秀而又实用的PHP工具集锦   浏览:1141 发布日期:2013/09/04 分类:技术分享 PHP是目前实用最为广泛的服务器端开源脚本语言之一,很多优秀的开源程序都是基于PHP构建的,比如大名鼎鼎的WordPress、Pligg等数不胜数。
1802 0
x3d
FreeBSD的新一代包管理工具Pkg 1.3.0 发布
Pkg 是 FreeBSD 下一代的打包管理工具,用来替代原来的 pkg_info/pkg_create/pkg_add 工具,可以本地打包,也提供远程打包,主要是为了方便远程二进制包升级。 Pkg 1.3.0 发布,此版本是 29 个贡献者 9 个月辛苦开发的成果,包括 373 个文件修改。
766 0
+关注
21
文章
0
问答
文章排行榜
最热
最新
相关电子书
更多
低代码开发师(初级)实战教程
立即下载
阿里巴巴DevOps 最佳实践手册
立即下载
冬季实战营第三期:MySQL数据库进阶实战
立即下载