markwkm / pg_top Goto Github PK
View Code? Open in Web Editor NEWMirror of https://gitlab.com/pg_top/pg_top
Home Page: https://pg_top.gitlab.io/
License: BSD 3-Clause "New" or "Revised" License
Mirror of https://gitlab.com/pg_top/pg_top
Home Page: https://pg_top.gitlab.io/
License: BSD 3-Clause "New" or "Revised" License
I would like to use pg_top without providing a password on the commandline or being prompted for one. Is there a way to get it from .pgpass file?
On my Ubuntu 20.04 installation, /proc/sys/kernel/pid_max is set to 4194304. This is two characters longer than pg_top expects, and the columns are out of alignment.
After typing "q" on keybord I put processID with SELECT but it show nothing
Debian 12 and postgresql 15
Ever since upgrading our database from 9.5 to 11, pg_top has stopped connecting. It is apparently looking for the socket file in /tmp instead of /var/run/postgresql/.
I know this is not a pg_top problem. I ran a custom built pg_top binary on my build machine (postgres is not installed there) and it errored out looking for the socket file in /var/run/postgresql/. That gave me hope, but when I copied that binary to my db machine it still is looking for /tmp/.
That is how I determined this is environmental. However, I have no idea what controls this behavior. Is it a config file somewhere? Environment variable? I tried looking through the source, but the only thing I see is a call to PQsocket(). Maybe this is question for libpq people?
Just noticed that the code has been updated to 3.7.0 alpha3 but there are no tags yet.
No data for any processes, Just zeroes. Please advise.
$ cmake CMakeLists.txt
-- The C compiler identification is GNU 4.8.4
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- machine - linux
-- arch - x86_64
-- pg_config --includedir - /usr/include/postgresql
-- pg_config --libdir - /usr/lib/x86_64-linux-gnu
-- Looking for 4 include files stdlib.h, ..., float.h
-- Looking for 4 include files stdlib.h, ..., float.h - found
-- Looking for include file string.h
-- Looking for include file string.h - found
-- Looking for include file strings.h
-- Looking for include file strings.h - found
-- Looking for include files sys/time.h, time.h
-- Looking for include files sys/time.h, time.h - found
-- Looking for include file sys/time.h
-- Looking for include file sys/time.h - found
-- Looking for include file sys/resource.h
-- Looking for include file sys/resource.h - found
-- Looking for include file unistd.h
-- Looking for include file unistd.h - found
-- Looking for getopt
-- Looking for getopt - found
-- Looking for memcpy
-- Looking for memcpy - found
-- Looking for setpriority
-- Looking for setpriority - found
-- Looking for sigaction
-- Looking for sigaction - found
-- Looking for sighold
-- Looking for sighold - found
-- Looking for sigprocmask
-- Looking for sigprocmask - found
-- Looking for sigrelse
-- Looking for sigrelse - found
-- Looking for snprintf
-- Looking for snprintf - found
-- Looking for strchr
-- Looking for strchr - found
-- Looking for strerror
-- Looking for strerror - found
-- Performing Test SIGNAL_RETURN
-- Performing Test SIGNAL_RETURN - Failed
-- Performing Test TIME_T_DEFINED
-- Performing Test TIME_T_DEFINED - Success
-- Configuring done
-- Generating done
-- Build files have been written to: /home/derekv/projs/pg_top
$ sudo make install
Scanning dependencies of target pg_top
[ 7%] Building C object CMakeFiles/pg_top.dir/color.c.o
[ 15%] Building C object CMakeFiles/pg_top.dir/commands.c.o
[ 23%] Building C object CMakeFiles/pg_top.dir/display.c.o
[ 30%] Building C object CMakeFiles/pg_top.dir/getopt.c.o
[ 38%] Building C object CMakeFiles/pg_top.dir/screen.c.o
[ 46%] Building C object CMakeFiles/pg_top.dir/sprompt.c.o
[ 53%] Building C object CMakeFiles/pg_top.dir/pg.c.o
[ 61%] Building C object CMakeFiles/pg_top.dir/pg_top.c.o
[ 69%] Building C object CMakeFiles/pg_top.dir/utils.c.o
[ 76%] Building C object CMakeFiles/pg_top.dir/version.c.o
[ 84%] Building C object CMakeFiles/pg_top.dir/machine/m_remote.c.o
/home/derekv/projs/pg_top/machine/m_remote.c: In function ‘get_process_info_r’:
/home/derekv/projs/pg_top/machine/m_remote.c:912:3: warning: implicit declaration of function ‘reallocarray’ [-Wimplicit-function-declaration]
p = reallocarray(pgrtable, rows, sizeof(struct top_proc_r));
^
/home/derekv/projs/pg_top/machine/m_remote.c:912:5: warning: assignment makes pointer from integer without a cast [enabled by default]
p = reallocarray(pgrtable, rows, sizeof(struct top_proc_r));
^
[ 92%] Building C object CMakeFiles/pg_top.dir/machine/m_common.c.o
[100%] Building C object CMakeFiles/pg_top.dir/machine/m_linux.c.o
/home/derekv/projs/pg_top/machine/m_linux.c: In function ‘get_process_info’:
/home/derekv/projs/pg_top/machine/m_linux.c:839:4: warning: implicit declaration of function ‘reallocarray’ [-Wimplicit-function-declaration]
p = reallocarray(pgtable, rows, sizeof(struct top_proc));
^
/home/derekv/projs/pg_top/machine/m_linux.c:839:6: warning: assignment makes pointer from integer without a cast [enabled by default]
p = reallocarray(pgtable, rows, sizeof(struct top_proc));
^
Linking C executable pg_top
CMakeFiles/pg_top.dir/display.c.o: In function `display_move':
display.c:(.text+0x336): undefined reference to `tgoto'
display.c:(.text+0x348): undefined reference to `tputs'
CMakeFiles/pg_top.dir/display.c.o: In function `display_write':
display.c:(.text+0x621): undefined reference to `tgoto'
display.c:(.text+0x633): undefined reference to `tputs'
CMakeFiles/pg_top.dir/display.c.o: In function `display_cte':
display.c:(.text+0x849): undefined reference to `tputs'
CMakeFiles/pg_top.dir/display.c.o: In function `u_endscreen':
display.c:(.text+0x1f2a): undefined reference to `tgoto'
display.c:(.text+0x1f3c): undefined reference to `tputs'
CMakeFiles/pg_top.dir/screen.c.o: In function `get_screensize':
screen.c:(.text+0x9a): undefined reference to `tgoto'
CMakeFiles/pg_top.dir/screen.c.o: In function `init_termcap':
screen.c:(.text+0x136): undefined reference to `tgetent'
screen.c:(.text+0x1a1): undefined reference to `tgetflag'
screen.c:(.text+0x1bb): undefined reference to `tgetnum'
screen.c:(.text+0x1eb): undefined reference to `tgetnum'
screen.c:(.text+0x221): undefined reference to `tgetflag'
screen.c:(.text+0x24a): undefined reference to `tgetstr'
screen.c:(.text+0x262): undefined reference to `tgetstr'
screen.c:(.text+0x286): undefined reference to `tgetstr'
screen.c:(.text+0x2b6): undefined reference to `tgetstr'
screen.c:(.text+0x2ce): undefined reference to `tgetstr'
CMakeFiles/pg_top.dir/screen.c.o:screen.c:(.text+0x2e6): more undefined references to `tgetstr' follow
CMakeFiles/pg_top.dir/screen.c.o: In function `init_termcap':
screen.c:(.text+0x366): undefined reference to `tgoto'
CMakeFiles/pg_top.dir/screen.c.o: In function `init_screen':
screen.c:(.text+0x4a6): undefined reference to `tputs'
CMakeFiles/pg_top.dir/screen.c.o: In function `end_screen':
screen.c:(.text+0x4dd): undefined reference to `tputs'
screen.c:(.text+0x502): undefined reference to `tputs'
screen.c:(.text+0x536): undefined reference to `tputs'
CMakeFiles/pg_top.dir/screen.c.o: In function `reinit_screen':
screen.c:(.text+0x5b4): undefined reference to `tputs'
CMakeFiles/pg_top.dir/screen.c.o:screen.c:(.text+0x5f2): more undefined references to `tputs' follow
CMakeFiles/pg_top.dir/machine/m_remote.c.o: In function `get_process_info_r':
m_remote.c:(.text+0x2dd5): undefined reference to `reallocarray'
CMakeFiles/pg_top.dir/machine/m_linux.c.o: In function `get_process_info':
m_linux.c:(.text+0x2f62): undefined reference to `reallocarray'
collect2: error: ld returned 1 exit status
make[2]: *** [pg_top] Error 1
make[1]: *** [CMakeFiles/pg_top.dir/all] Error 2
make: *** [all] Error 2
Could it be that pg_top.appdata.xml
is broken? Getting
./appstreamcli-x86_64.AppImage convert database/pg_top/pg_top.appdata.xml database/pg_top/appdata.yaml
Could not parse XML data.
Reference:
AppImage/appimage.github.io#2142
Is there any life here? Will new version of PG be supported?
pg_top cannot use long options. It would improve the user experience if they are added to the normal short options and normalized similarly to the other Postgres core binaries.
Here is a list of the first things coming to my mind:
pg_top segfaults on a standard ub18.04 with postgres11, the application doesn''t even start.
GDB:
GNU gdb (Ubuntu 8.1-0ubuntu3.2) 8.1.0.20180409-git
Copyright (C) 2018 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later http://gnu.org/licenses/gpl.html
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law. Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
http://www.gnu.org/software/gdb/bugs/.
Find the GDB manual and other documentation resources online at:
http://www.gnu.org/software/gdb/documentation/.
For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from pg_top...(no debugging symbols found)...done.
(gdb) run
Starting program: /usr/bin/pg_top
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
Program received signal SIGSEGV, Segmentation fault.
0x0000555555565e80 in get_process_info ()
(gdb) bt
#0 0x0000555555565e80 in get_process_info ()
#1 0x000055555555a1f3 in main ()
(gdb) quit
dmesg:
[ 23.929368] pg_top[1908]: segfault at 56c97510 ip 000055a3562a1e80 sp 00007ffc54d2a6c0 error 6 in pg_top[55a356290000+18000]
[ 70.147790] pg_top[2006]: segfault at 30a88510 ip 000055de2eef7e80 sp 00007ffcef621310 error 6 in pg_top[55de2eee6000+18000]
[ 240.596241] pg_top[2491]: segfault at 3b950310 ip 000055b63a92ee80 sp 00007ffed5925ce0 error 6 in pg_top[55b63a91d000+18000]
[ 319.391081] pg_top[3037]: segfault at 32954310 ip 000055ea3223ce80 sp 00007ffc2d2a5a50 error 6 in pg_top[55ea3222b000+18000]
[ 324.512122] pg_top[3040]: segfault at fffffffff4e38310 ip 00005569f4654e80 sp 00007ffe87a40500 error 7 in pg_top[5569f4643000+18000]
[ 327.651475] pg_top[3044]: segfault at 78b32310 ip 000055eb77008e80 sp 00007ffe465f7480 error 6 in pg_top[55eb76ff7000+18000]
[ 333.550656] pg_top[3049]: segfault at 660724f0 ip 00005615649d5e80 sp 00007ffe8836b870 error 6 in pg_top[5615649c4000+18000]
[ 576.234168] pg_top[4322]: segfault at ffffffff8e84eb20 ip 000055738dfdbe80 sp 00007fffc4a3b720 error 7 in pg_top[55738dfca000+18000]
[ 583.480255] pg_top[4327]: segfault at 324ace80 ip 000055f6317b1e80 sp 00007ffdc8e8e8f0 error 6 in pg_top[55f6317a0000+18000]
[ 890.785259] pg_top[6050]: segfault at fffffffff9350b00 ip 00005609f84d3e80 sp 00007fffbea733c0 error 7 in pg_top[5609f84c2000+18000]
strace:
sendto(3, "Q\0\0\0"SET statement_timeout = '2s"..., 35, MSG_NOSIGNAL, NULL, 0) = 35
poll([{fd=3, events=POLLIN|POLLERR}], 1, -1) = 1 ([{fd=3, revents=POLLIN}])
recvfrom(3, "C\0\0\0\10SET\0Z\0\0\0\5T", 16384, 0, NULL, NULL) = 15
sendto(3, "Q\0\0\1\364WITH lock_activity AS\n(\n "..., 501, MSG_NOSIGNAL, NULL, 0) = 501
poll([{fd=3, events=POLLIN|POLLERR}], 1, -1) = 1 ([{fd=3, revents=POLLIN}])
recvfrom(3, "T\0\0\0\273\0\7pid\0\0\0-\346\0\3\0\0\0\27\0\4\377\377\377\377\0\0que"..., 16384, 0, NULL, NULL) = 967
sendto(3, "Q\0\0\0\17ROLLBACK;;\0", 16, MSG_NOSIGNAL, NULL, 0) = 16
poll([{fd=3, events=POLLIN|POLLERR}], 1, -1) = 1 ([{fd=3, revents=POLLIN}])
recvfrom(3, "C\0\0\0\rROLLBACK\0Z\0\0\0\5I", 16384, 0, NULL, NULL) = 20
openat(AT_FDCWD, "6294/cmdline", O_RDONLY) = 4
read(4, "postgres: postgres postgres [loc"..., 255) = 183
close(4) = 0
openat(AT_FDCWD, "6294/stat", O_RDONLY) = 4
read(4, "6294 (postgres) S 3978 6294 6294"..., 4095) = 317
close(4) = 0
openat(AT_FDCWD, "6294/io", O_RDONLY) = 4
read(4, "rchar: 166935\nwchar: 1\nsyscr: 47"..., 4095) = 96
close(4) = 0
--- SIGSEGV {si_signo=SIGSEGV, si_code=SEGV_MAPERR, si_addr=0x2a556b00} ---
+++ killed by SIGSEGV (core dumped) +++
Hi,
I'm seeing these with automake 1.14.1 on Fedora 21:
Cheers ,Devrim
The current help message returned to user is that:
pg_top version 3.7.0-alpha3
Usage: pg_top [-ITWbcinqru] [-x x] [-s x] [-o field] [-z username]
[-p PORT] [-U USER] [-d DBNAME] [-h HOSTNAME] [number]
Why not changing it to that:
pg_top monitors a PostgreSQL database.
Usage:
pg_top [OPTION]
Options:
[...]
Many options...
[...]
-V, --version output version information, then exit
-?, --help show this help, then exit
Connection options:
-h, --host=HOSTNAME database server host or socket directory
-p, --port=PORT database server port
-U, --username=USERNAME user name to connect as
I don't see a pg_top package for the linux CentOS distro. I remember in the past I was able to install it on ubuntu using "apt-get install pgtop". Is the only way to get it for CentOS by downloading and compiling it from here?
Hi,
I have downloaded pg_top and ran the configure and then tried to run the "make", but it is failing with the below errors.
$ make
make all-am
make[1]: Entering directory /opt/postgres/pg_top-3.7.0' gcc -DHAVE_CONFIG_H -I. -I/usr/pgsql-9.6/include -Wall -g -MT color.o -MD -MP -MF .deps/color.Tpo -c -o color.o color.c In file included from machine.h:16, from display.h:7, from color.c:33: pg.h:6:22: error: libpq-fe.h: No such file or directory In file included from machine.h:16, from display.h:7, from color.c:33: pg.h:34: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token pg.h:39: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token pg.h:40: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token pg.h:41: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token make[1]: *** [color.o] Error 1 make[1]: Leaving directory
/opt/postgres/pg_top-3.7.0'
make: *** [all] Error 2
I am running postgres on Red-hat linux with postgres 9.6
I appreciate your help.
Thanks!
The error is a segmentation fault, looking at strace and ltrace we see the permission and array check error:
open("5401/io", O_RDONLY) = 4
read(4, 0x7ffd4c67c360, 4095) = -1 EACCES (Permission denied)
close(4) = 0
--- SIGSEGV {si_signo=SIGSEGV, si_code=SEGV_MAPERR, si_addr=0x2} ---
+++ killed by SIGSEGV +++
Segmentation fault
[pid 25433] open("5401/io", 0, 07332762347) = 4
[pid 25433] read(4 <no return ...>
error: maximum array length seems negative
, "5401/io", 4095) = -1
[pid 25433] close(4) = 0
[pid 25433] strchr("5401/io", ':') = nil
[pid 25433] strchr("\002\003\004\005\006\a\b\t\n\v\f\r\016\017\020\021\022\023\024\025\026\027\030\031\032\033\034\035\036\037 !"..., '\n' <no return ...>
[pid 25433] --- SIGSEGV (Segmentation fault) ---
[pid 25433] +++ killed by SIGSEGV +++
I'm trying to connect to a PostgreSQL located in a docker container using remote mode
$ pg_top -r -h localhost -p 5432 -U postgres -W
Password:
Stored function 'pg_cputime' is missing.
$ pg_top --version
pg_top 3.7.0
$ select version();
PostgreSQL 9.6.14 on x86_64-pc-linux-gnu (Debian 9.6.14-1.pgdg90+1), compiled by gcc (Debian 6.3.0-18+deb9u1) 6.3.0 2
0170516, 64-bit
Is there support for a configuration file as it can be used with mytop? If so can you please add a example of the configuration parameters and default values to the README
. If not take this issue as a feature request :-)
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.