pg_top

一个类似于 Unix top 的监控工具

pg_top 是一个 PostgreSQL 的交互式监控工具,类似于 Unix top 工具,提供 PostgreSQL 数据库内部活动动态更新的视图。

请注意,有一个名为 pgtop 的类似工具。

安装

来自源代码

pg_top 需要 cmake,并且如果在 Linux 上安装,还需要 libbsd 兼容库(在 CentOS 等系统上是 libbsd-devel;在 Debian 等系统上是 libbsd-dev)。

$ cmake CMakeLists.txt
-- The C compiler identification is GNU 4.8.5
...
-- Configuring done
-- Generating done
-- Build files have been written to: /home/pgpedia/devel/postgres/pg_top

$ make
Scanning dependencies of target pg_top
[  7%] Building C object CMakeFiles/pg_top.dir/color.c.o
...
[ 46%] Building C object CMakeFiles/pg_top.dir/pg_top.c.o
...
[ 69%] Building C object CMakeFiles/pg_top.dir/machine/m_linux.c.o
Linking C executable pg_top
Install the project...
-- Install configuration: ""
-- Installing: /home/pgpedia/bin/pg_top
-- Installing: /home/pgpedia/share/man/man1/pg_top.1

发布历史

这是主要版本发布的摘要;有关完整详细的发布列表,请参阅 pg_top 发布页面发布说明

注意:源代码似乎从 3.6.1 版本开始,最早的提交(bc66647b)暗示它是从 Subversion 仓库导入的(尽管没有保留任何提交历史)。

示例

执行示例如:pg_top -d 'host=localhost dbname=postgres user=postgres'

last pid: 14011;  load avg:  1.68,  2.01,  2.05;       up 27+20:39:01                                   10:11:52
5 processes: 4 other background task(s), 1 active
CPU states: 45.7% user,  0.0% nice,  4.1% system, 49.5% idle,  0.6% iowait
Memory: 14G used, 237M free, 0K shared, 37M buffers, 1862M cached
Swap: 8284M used, 8100M free, 551M cached, 0K in, 0K out

  PID USERNAME  SIZE   RES STATE   XTIME  QTIME  %CPU LOCKS COMMAND
14012 postgres 2278M 7868K active   0:00   0:00   0.0     8 postgres: postgres postgres 127.0.0.1(21161) idle
14356          2276M  220K          0:00   0:00   0.0     0 postgres: background writer        
14355          2276M   30M          0:00   0:00   0.0     0 postgres: checkpointer             
14353          2276M   32M          0:00   0:00   0.0     0 postgres: startup   recovering 0000000100000003000000B0
 5676          2285M 2112K          0:00   0:00   0.0     0 postgres: walreceiver   streaming 3/B014B4F8

分类

监控实用程序

另请参阅

pg_stat_activity,pg_activity,pgtop

反馈

请在此处提交任何关于“pg_top”的评论、建议或更正 此处