Install system_stats extenstion postgres 16 rhel 8

The system_stats extension is used in pgadmin to display o/s metrics as below:

This extension needs to be installed which I did as below:

as root (or sudo)

subscription-manager repos --enable codeready-builder-for-rhel-8-x86_64-rpms
yum install perl-IPC-Run

output:
Updating Subscription Management repositories.
Red Hat CodeReady Linux Builder for RHEL 8 x86_64 (RPMs) 6.0 MB/s | 8.8 MB 00:01

Dependencies resolved.

Package Architecture Version Repository Size

Installing:
perl-IPC-Run noarch 0.99-1.el8 codeready-builder-for-rhel-8-x86_64-rpms 129 k
Installing dependencies:
perl-IO-Tty x86_64 1.12-11.el8 codeready-builder-for-rhel-8-x86_64-rpms 48 k

Transaction Summary

Install 2 Packages

Total download size: 178 k
Installed size: 410 k
Is this ok [y/N]: y
Downloading Packages:
(1/2): perl-IO-Tty-1.12-11.el8.x86_64.rpm 39 kB/s | 48 kB 00:01

(2/2): perl-IPC-Run-0.99-1.el8.noarch.rpm 103 kB/s | 129 kB 00:01

Total 140 kB/s | 178 kB 00:01
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
Preparing : 1/1
Installing : perl-IO-Tty-1.12-11.el8.x86_64 1/2
Installing : perl-IPC-Run-0.99-1.el8.noarch 2/2
Running scriptlet: perl-IPC-Run-0.99-1.el8.noarch 2/2
Verifying : perl-IO-Tty-1.12-11.el8.x86_64 1/2
Verifying : perl-IPC-Run-0.99-1.el8.noarch 2/2
Installed products updated.

Installed:
perl-IO-Tty-1.12-11.el8.x86_64 perl-IPC-Run-0.99-1.el8.noarch

Complete!

sudo dnf install -y postgresql16-devel

output:
Updating Subscription Management repositories.
Last metadata expiration check: 0:01:18 ago on Mon 01 Jan 2024 03:27:29 GMT.
All matches were filtered out by modular filtering for argument: postgresql-server-devel
Error: Unable to find a match: postgresql-server-devel
[root@dhome01 system_stats-2.1]# dnf install postgresql16-server-devel
Updating Subscription Management repositories.
Last metadata expiration check: 0:01:47 ago on Mon 01 Jan 2024 03:27:29 GMT.
No match for argument: postgresql16-server-devel
Error: Unable to find a match: postgresql16-server-devel
[root@dhome01 system_stats-2.1]# sudo dnf install -y postgresql16-devel
Updating Subscription Management repositories.
Last metadata expiration check: 0:02:35 ago on Mon 01 Jan 2024 03:27:29 GMT.

Dependencies resolved.

Package Architecture Version Repository Size

Installing:
postgresql16-devel x86_64 16.1-4PGDG.rhel8 pgdg16 2.7 M
Installing dependencies:
clang x86_64 16.0.6-2.module+el8.9.0+19521+190d7aba rhel-8-for-x86_64-appstream-rpms 88 k
clang-devel x86_64 16.0.6-2.module+el8.9.0+19521+190d7aba rhel-8-for-x86_64-appstream-rpms 2.5 M
clang-tools-extra x86_64 16.0.6-2.module+el8.9.0+19521+190d7aba rhel-8-for-x86_64-appstream-rpms 23 M
cmake-filesystem x86_64 3.20.2-5.el8 rhel-8-for-x86_64-appstream-rpms 45 k
libicu-devel x86_64 60.3-2.el8_1 rhel-8-for-x86_64-baseos-rpms 923 k
llvm x86_64 16.0.6-3.module+el8.9.0+19571+4f9fba7b rhel-8-for-x86_64-appstream-rpms 28 M
llvm-devel x86_64 16.0.6-3.module+el8.9.0+19571+4f9fba7b rhel-8-for-x86_64-appstream-rpms 4.0 M
llvm-static x86_64 16.0.6-3.module+el8.9.0+19571+4f9fba7b rhel-8-for-x86_64-appstream-rpms 51 M
llvm-test x86_64 16.0.6-3.module+el8.9.0+19571+4f9fba7b rhel-8-for-x86_64-appstream-rpms 643 k
perl-Test-Simple noarch 1:1.302135-1.el8 rhel-8-for-x86_64-appstream-rpms 516 k

Transaction Summary

Install 11 Packages

Total download size: 113 M
Installed size: 728 M
Downloading Packages:
(1/11): postgresql16-devel-16.1-4PGDG.rhel8.x86_64.rpm 4.9 MB/s | 2.7 MB 00:00
(2/11): cmake-filesystem-3.20.2-5.el8.x86_64.rpm 38 kB/s | 45 kB 00:01
(3/11): perl-Test-Simple-1.302135-1.el8.noarch.rpm 418 kB/s | 516 kB 00:01
(4/11): llvm-devel-16.0.6-3.module+el8.9.0+19571+4f9fba7b.x86_64.rpm 2.8 MB/s | 4.0 MB 00:01
(5/11): clang-16.0.6-2.module+el8.9.0+19521+190d7aba.x86_64.rpm 90 kB/s | 88 kB 00:00
(6/11): clang-devel-16.0.6-2.module+el8.9.0+19521+190d7aba.x86_64.rpm 2.3 MB/s | 2.5 MB 00:01
(7/11): clang-tools-extra-16.0.6-2.module+el8.9.0+19521+190d7aba.x86_64.rpm 5.6 MB/s | 23 MB 00:04
(8/11): llvm-test-16.0.6-3.module+el8.9.0+19571+4f9fba7b.x86_64.rpm 594 kB/s | 643 kB 00:01
(9/11): libicu-devel-60.3-2.el8_1.x86_64.rpm 852 kB/s | 923 kB 00:01
(10/11): llvm-static-16.0.6-3.module+el8.9.0+19571+4f9fba7b.x86_64.rpm 6.5 MB/s | 51 MB 00:07

(11/11): llvm-16.0.6-3.module+el8.9.0+19571+4f9fba7b.x86_64.rpm 2.7 MB/s | 28 MB 00:10

Total 9.0 MB/s | 113 MB 00:12
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
Preparing : 1/1
Installing : llvm-16.0.6-3.module+el8.9.0+19571+4f9fba7b.x86_64 1/11
Installing : cmake-filesystem-3.20.2-5.el8.x86_64 2/11
Installing : llvm-test-16.0.6-3.module+el8.9.0+19571+4f9fba7b.x86_64 3/11
Installing : libicu-devel-60.3-2.el8_1.x86_64 4/11
Installing : llvm-static-16.0.6-3.module+el8.9.0+19571+4f9fba7b.x86_64 5/11
Installing : llvm-devel-16.0.6-3.module+el8.9.0+19571+4f9fba7b.x86_64 6/11
Running scriptlet: llvm-devel-16.0.6-3.module+el8.9.0+19571+4f9fba7b.x86_64 6/11
Installing : clang-tools-extra-16.0.6-2.module+el8.9.0+19521+190d7aba.x86_64 7/11
Installing : clang-16.0.6-2.module+el8.9.0+19521+190d7aba.x86_64 8/11
Installing : clang-devel-16.0.6-2.module+el8.9.0+19521+190d7aba.x86_64 9/11
Installing : perl-Test-Simple-1:1.302135-1.el8.noarch 10/11
Installing : postgresql16-devel-16.1-4PGDG.rhel8.x86_64 11/11
Running scriptlet: postgresql16-devel-16.1-4PGDG.rhel8.x86_64 11/11
Verifying : postgresql16-devel-16.1-4PGDG.rhel8.x86_64 1/11
Verifying : perl-Test-Simple-1:1.302135-1.el8.noarch 2/11
Verifying : cmake-filesystem-3.20.2-5.el8.x86_64 3/11
Verifying : llvm-devel-16.0.6-3.module+el8.9.0+19571+4f9fba7b.x86_64 4/11
Verifying : clang-16.0.6-2.module+el8.9.0+19521+190d7aba.x86_64 5/11
Verifying : clang-devel-16.0.6-2.module+el8.9.0+19521+190d7aba.x86_64 6/11
Verifying : clang-tools-extra-16.0.6-2.module+el8.9.0+19521+190d7aba.x86_64 7/11
Verifying : llvm-16.0.6-3.module+el8.9.0+19571+4f9fba7b.x86_64 8/11
Verifying : llvm-static-16.0.6-3.module+el8.9.0+19571+4f9fba7b.x86_64 9/11
Verifying : llvm-test-16.0.6-3.module+el8.9.0+19571+4f9fba7b.x86_64 10/11
Verifying : libicu-devel-60.3-2.el8_1.x86_64 11/11
Installed products updated.

Installed:
clang-16.0.6-2.module+el8.9.0+19521+190d7aba.x86_64 clang-devel-16.0.6-2.module+el8.9.0+19521+190d7aba.x86_64 clang-tools-extra-16.0.6-2.module+el8.9.0+19521+190d7aba.x86_64
cmake-filesystem-3.20.2-5.el8.x86_64 libicu-devel-60.3-2.el8_1.x86_64 llvm-16.0.6-3.module+el8.9.0+19571+4f9fba7b.x86_64
llvm-devel-16.0.6-3.module+el8.9.0+19571+4f9fba7b.x86_64 llvm-static-16.0.6-3.module+el8.9.0+19571+4f9fba7b.x86_64 llvm-test-16.0.6-3.module+el8.9.0+19571+4f9fba7b.x86_64
perl-Test-Simple-1:1.302135-1.el8.noarch postgresql16-devel-16.1-4PGDG.rhel8.x86_64

Complete!

Download latest version of system_stats source code

https://github.com/EnterpriseDB/system_stats/releases

copy to /var/tmp on target postgres server

cp system_stats-2.1.tar.gz /var/tmp
cd /var/tmp
gunzip system_stats-2.1.tar.gz
tar -xvf system_stats-2.1.tar
cd system_stats-2.1
ls /usr/pgsql-16/bin/pg_config
PATH="/usr/pgsql-16/bin:$PATH" make USE_PGXS=1

output:
“Platform is: linux”
gcc -Wall -Wmissing-prototypes -Wpointer-arith -Wdeclaration-after-statement -Werror=vla -Wendif-labels -Wmissing-format-attribute -Wimplicit-fallthrough=3 -Wcast-function-type -Wshadow=compatible-local -Wformat-security -fno-strict-aliasing -fwrapv -fexcess-precision=standard -Wno-format-truncation -Wno-stringop-truncation -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -fPIC -fvisibility=hidden -I. -I./ -I/usr/pgsql-16/include/server -I/usr/pgsql-16/include/internal -D_GNU_SOURCE -I/usr/include/libxml2 -I/usr/include -c -o system_stats.o system_stats.c
gcc -Wall -Wmissing-prototypes -Wpointer-arith -Wdeclaration-after-statement -Werror=vla -Wendif-labels -Wmissing-format-attribute -Wimplicit-fallthrough=3 -Wcast-function-type -Wshadow=compatible-local -Wformat-security -fno-strict-aliasing -fwrapv -fexcess-precision=standard -Wno-format-truncation -Wno-stringop-truncation -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -fPIC -fvisibility=hidden -I. -I./ -I/usr/pgsql-16/include/server -I/usr/pgsql-16/include/internal -D_GNU_SOURCE -I/usr/include/libxml2 -I/usr/include -c -o linux/system_stats_utils.o linux/system_stats_utils.c
linux/system_stats_utils.c: In function ‘read_process_status’:
linux/system_stats_utils.c:159:2: warning: ‘readdir_r’ is deprecated [-Wdeprecated-declarations]
while (readdir_r(dirp, &dbuf, &ent) == 0)
^~~ In file included from linux/system_stats_utils.c:18: /usr/include/dirent.h:183:12: note: declared here extern int readdir_r (DIR *restrict __dirp, ^~~
gcc -Wall -Wmissing-prototypes -Wpointer-arith -Wdeclaration-after-statement -Werror=vla -Wendif-labels -Wmissing-format-attribute -Wimplicit-fallthrough=3 -Wcast-function-type -Wshadow=compatible-local -Wformat-security -fno-strict-aliasing -fwrapv -fexcess-precision=standard -Wno-format-truncation -Wno-stringop-truncation -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -fPIC -fvisibility=hidden -I. -I./ -I/usr/pgsql-16/include/server -I/usr/pgsql-16/include/internal -D_GNU_SOURCE -I/usr/include/libxml2 -I/usr/include -c -o linux/disk_info.o linux/disk_info.c
gcc -Wall -Wmissing-prototypes -Wpointer-arith -Wdeclaration-after-statement -Werror=vla -Wendif-labels -Wmissing-format-attribute -Wimplicit-fallthrough=3 -Wcast-function-type -Wshadow=compatible-local -Wformat-security -fno-strict-aliasing -fwrapv -fexcess-precision=standard -Wno-format-truncation -Wno-stringop-truncation -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -fPIC -fvisibility=hidden -I. -I./ -I/usr/pgsql-16/include/server -I/usr/pgsql-16/include/internal -D_GNU_SOURCE -I/usr/include/libxml2 -I/usr/include -c -o linux/io_analysis.o linux/io_analysis.c
gcc -Wall -Wmissing-prototypes -Wpointer-arith -Wdeclaration-after-statement -Werror=vla -Wendif-labels -Wmissing-format-attribute -Wimplicit-fallthrough=3 -Wcast-function-type -Wshadow=compatible-local -Wformat-security -fno-strict-aliasing -fwrapv -fexcess-precision=standard -Wno-format-truncation -Wno-stringop-truncation -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -fPIC -fvisibility=hidden -I. -I./ -I/usr/pgsql-16/include/server -I/usr/pgsql-16/include/internal -D_GNU_SOURCE -I/usr/include/libxml2 -I/usr/include -c -o linux/cpu_info.o linux/cpu_info.c
gcc -Wall -Wmissing-prototypes -Wpointer-arith -Wdeclaration-after-statement -Werror=vla -Wendif-labels -Wmissing-format-attribute -Wimplicit-fallthrough=3 -Wcast-function-type -Wshadow=compatible-local -Wformat-security -fno-strict-aliasing -fwrapv -fexcess-precision=standard -Wno-format-truncation -Wno-stringop-truncation -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -fPIC -fvisibility=hidden -I. -I./ -I/usr/pgsql-16/include/server -I/usr/pgsql-16/include/internal -D_GNU_SOURCE -I/usr/include/libxml2 -I/usr/include -c -o linux/cpu_usage_info.o linux/cpu_usage_info.c
gcc -Wall -Wmissing-prototypes -Wpointer-arith -Wdeclaration-after-statement -Werror=vla -Wendif-labels -Wmissing-format-attribute -Wimplicit-fallthrough=3 -Wcast-function-type -Wshadow=compatible-local -Wformat-security -fno-strict-aliasing -fwrapv -fexcess-precision=standard -Wno-format-truncation -Wno-stringop-truncation -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -fPIC -fvisibility=hidden -I. -I./ -I/usr/pgsql-16/include/server -I/usr/pgsql-16/include/internal -D_GNU_SOURCE -I/usr/include/libxml2 -I/usr/include -c -o linux/os_info.o linux/os_info.c
gcc -Wall -Wmissing-prototypes -Wpointer-arith -Wdeclaration-after-statement -Werror=vla -Wendif-labels -Wmissing-format-attribute -Wimplicit-fallthrough=3 -Wcast-function-type -Wshadow=compatible-local -Wformat-security -fno-strict-aliasing -fwrapv -fexcess-precision=standard -Wno-format-truncation -Wno-stringop-truncation -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -fPIC -fvisibility=hidden -I. -I./ -I/usr/pgsql-16/include/server -I/usr/pgsql-16/include/internal -D_GNU_SOURCE -I/usr/include/libxml2 -I/usr/include -c -o linux/memory_info.o linux/memory_info.c
gcc -Wall -Wmissing-prototypes -Wpointer-arith -Wdeclaration-after-statement -Werror=vla -Wendif-labels -Wmissing-format-attribute -Wimplicit-fallthrough=3 -Wcast-function-type -Wshadow=compatible-local -Wformat-security -fno-strict-aliasing -fwrapv -fexcess-precision=standard -Wno-format-truncation -Wno-stringop-truncation -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -fPIC -fvisibility=hidden -I. -I./ -I/usr/pgsql-16/include/server -I/usr/pgsql-16/include/internal -D_GNU_SOURCE -I/usr/include/libxml2 -I/usr/include -c -o linux/load_avg.o linux/load_avg.c
gcc -Wall -Wmissing-prototypes -Wpointer-arith -Wdeclaration-after-statement -Werror=vla -Wendif-labels -Wmissing-format-attribute -Wimplicit-fallthrough=3 -Wcast-function-type -Wshadow=compatible-local -Wformat-security -fno-strict-aliasing -fwrapv -fexcess-precision=standard -Wno-format-truncation -Wno-stringop-truncation -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -fPIC -fvisibility=hidden -I. -I./ -I/usr/pgsql-16/include/server -I/usr/pgsql-16/include/internal -D_GNU_SOURCE -I/usr/include/libxml2 -I/usr/include -c -o linux/process_info.o linux/process_info.c
gcc -Wall -Wmissing-prototypes -Wpointer-arith -Wdeclaration-after-statement -Werror=vla -Wendif-labels -Wmissing-format-attribute -Wimplicit-fallthrough=3 -Wcast-function-type -Wshadow=compatible-local -Wformat-security -fno-strict-aliasing -fwrapv -fexcess-precision=standard -Wno-format-truncation -Wno-stringop-truncation -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -fPIC -fvisibility=hidden -I. -I./ -I/usr/pgsql-16/include/server -I/usr/pgsql-16/include/internal -D_GNU_SOURCE -I/usr/include/libxml2 -I/usr/include -c -o linux/network_info.o linux/network_info.c
gcc -Wall -Wmissing-prototypes -Wpointer-arith -Wdeclaration-after-statement -Werror=vla -Wendif-labels -Wmissing-format-attribute -Wimplicit-fallthrough=3 -Wcast-function-type -Wshadow=compatible-local -Wformat-security -fno-strict-aliasing -fwrapv -fexcess-precision=standard -Wno-format-truncation -Wno-stringop-truncation -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -fPIC -fvisibility=hidden -I. -I./ -I/usr/pgsql-16/include/server -I/usr/pgsql-16/include/internal -D_GNU_SOURCE -I/usr/include/libxml2 -I/usr/include -c -o linux/cpu_memory_by_process.o linux/cpu_memory_by_process.c
linux/cpu_memory_by_process.c: In function ‘ReadCPUMemoryUsage’:
linux/cpu_memory_by_process.c:230:2: warning: ‘readdir_r’ is deprecated [-Wdeprecated-declarations]
while (readdir_r(dirp, &dbuf, &ent) == 0)
^~~ In file included from linux/cpu_memory_by_process.c:16: /usr/include/dirent.h:183:12: note: declared here extern int readdir_r (DIR *__restrict __dirp, ^~~
gcc -Wall -Wmissing-prototypes -Wpointer-arith -Wdeclaration-after-statement -Werror=vla -Wendif-labels -Wmissing-format-attribute -Wimplicit-fallthrough=3 -Wcast-function-type -Wshadow=compatible-local -Wformat-security -fno-strict-aliasing -fwrapv -fexcess-precision=standard -Wno-format-truncation -Wno-stringop-truncation -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -fPIC -fvisibility=hidden -shared -o system_stats.so system_stats.o linux/system_stats_utils.o linux/disk_info.o linux/io_analysis.o linux/cpu_info.o linux/cpu_usage_info.o linux/os_info.o linux/memory_info.o linux/load_avg.o linux/process_info.o linux/network_info.o linux/cpu_memory_by_process.o -L/usr/pgsql-16/lib -Wl,–as-needed -L/usr/lib64 -L/usr/lib -L/usr/lib64 -Wl,–as-needed -Wl,-rpath,’/usr/pgsql-16/lib’,–enable-new-dtags -fvisibility=hidden
/usr/bin/clang -Wno-ignored-attributes -fno-strict-aliasing -fwrapv -fexcess-precision=standard -Xclang -no-opaque-pointers -Wno-unused-command-line-argument -Wno-compound-token-split-by-macro -O2 -I. -I./ -I/usr/pgsql-16/include/server -I/usr/pgsql-16/include/internal -D_GNU_SOURCE -I/usr/include/libxml2 -I/usr/include -flto=thin -emit-llvm -c -o system_stats.bc system_stats.c
/usr/bin/clang -Wno-ignored-attributes -fno-strict-aliasing -fwrapv -fexcess-precision=standard -Xclang -no-opaque-pointers -Wno-unused-command-line-argument -Wno-compound-token-split-by-macro -O2 -I. -I./ -I/usr/pgsql-16/include/server -I/usr/pgsql-16/include/internal -D_GNU_SOURCE -I/usr/include/libxml2 -I/usr/include -flto=thin -emit-llvm -c -o linux/system_stats_utils.bc linux/system_stats_utils.c
linux/system_stats_utils.c:159:9: warning: ‘readdir_r’ is deprecated [-Wdeprecated-declarations]
while (readdir_r(dirp, &dbuf, &ent) == 0)
^
/usr/include/dirent.h:186:28: note: ‘readdir_r’ has been explicitly marked deprecated here
__nonnull ((1, 2, 3)) __attribute_deprecated;
^
/usr/include/sys/cdefs.h:308:51: note: expanded from macro ‘attribute_deprecated’

define attribute_deprecated attribute ((deprecated)) ^

1 warning generated.
/usr/bin/clang -Wno-ignored-attributes -fno-strict-aliasing -fwrapv -fexcess-precision=standard -Xclang -no-opaque-pointers -Wno-unused-command-line-argument -Wno-compound-token-split-by-macro -O2 -I. -I./ -I/usr/pgsql-16/include/server -I/usr/pgsql-16/include/internal -D_GNU_SOURCE -I/usr/include/libxml2 -I/usr/include -flto=thin -emit-llvm -c -o linux/disk_info.bc linux/disk_info.c
/usr/bin/clang -Wno-ignored-attributes -fno-strict-aliasing -fwrapv -fexcess-precision=standard -Xclang -no-opaque-pointers -Wno-unused-command-line-argument -Wno-compound-token-split-by-macro -O2 -I. -I./ -I/usr/pgsql-16/include/server -I/usr/pgsql-16/include/internal -D_GNU_SOURCE -I/usr/include/libxml2 -I/usr/include -flto=thin -emit-llvm -c -o linux/io_analysis.bc linux/io_analysis.c
/usr/bin/clang -Wno-ignored-attributes -fno-strict-aliasing -fwrapv -fexcess-precision=standard -Xclang -no-opaque-pointers -Wno-unused-command-line-argument -Wno-compound-token-split-by-macro -O2 -I. -I./ -I/usr/pgsql-16/include/server -I/usr/pgsql-16/include/internal -D_GNU_SOURCE -I/usr/include/libxml2 -I/usr/include -flto=thin -emit-llvm -c -o linux/cpu_info.bc linux/cpu_info.c
/usr/bin/clang -Wno-ignored-attributes -fno-strict-aliasing -fwrapv -fexcess-precision=standard -Xclang -no-opaque-pointers -Wno-unused-command-line-argument -Wno-compound-token-split-by-macro -O2 -I. -I./ -I/usr/pgsql-16/include/server -I/usr/pgsql-16/include/internal -D_GNU_SOURCE -I/usr/include/libxml2 -I/usr/include -flto=thin -emit-llvm -c -o linux/cpu_usage_info.bc linux/cpu_usage_info.c
/usr/bin/clang -Wno-ignored-attributes -fno-strict-aliasing -fwrapv -fexcess-precision=standard -Xclang -no-opaque-pointers -Wno-unused-command-line-argument -Wno-compound-token-split-by-macro -O2 -I. -I./ -I/usr/pgsql-16/include/server -I/usr/pgsql-16/include/internal -D_GNU_SOURCE -I/usr/include/libxml2 -I/usr/include -flto=thin -emit-llvm -c -o linux/os_info.bc linux/os_info.c
/usr/bin/clang -Wno-ignored-attributes -fno-strict-aliasing -fwrapv -fexcess-precision=standard -Xclang -no-opaque-pointers -Wno-unused-command-line-argument -Wno-compound-token-split-by-macro -O2 -I. -I./ -I/usr/pgsql-16/include/server -I/usr/pgsql-16/include/internal -D_GNU_SOURCE -I/usr/include/libxml2 -I/usr/include -flto=thin -emit-llvm -c -o linux/memory_info.bc linux/memory_info.c
/usr/bin/clang -Wno-ignored-attributes -fno-strict-aliasing -fwrapv -fexcess-precision=standard -Xclang -no-opaque-pointers -Wno-unused-command-line-argument -Wno-compound-token-split-by-macro -O2 -I. -I./ -I/usr/pgsql-16/include/server -I/usr/pgsql-16/include/internal -D_GNU_SOURCE -I/usr/include/libxml2 -I/usr/include -flto=thin -emit-llvm -c -o linux/load_avg.bc linux/load_avg.c
/usr/bin/clang -Wno-ignored-attributes -fno-strict-aliasing -fwrapv -fexcess-precision=standard -Xclang -no-opaque-pointers -Wno-unused-command-line-argument -Wno-compound-token-split-by-macro -O2 -I. -I./ -I/usr/pgsql-16/include/server -I/usr/pgsql-16/include/internal -D_GNU_SOURCE -I/usr/include/libxml2 -I/usr/include -flto=thin -emit-llvm -c -o linux/process_info.bc linux/process_info.c
/usr/bin/clang -Wno-ignored-attributes -fno-strict-aliasing -fwrapv -fexcess-precision=standard -Xclang -no-opaque-pointers -Wno-unused-command-line-argument -Wno-compound-token-split-by-macro -O2 -I. -I./ -I/usr/pgsql-16/include/server -I/usr/pgsql-16/include/internal -D_GNU_SOURCE -I/usr/include/libxml2 -I/usr/include -flto=thin -emit-llvm -c -o linux/network_info.bc linux/network_info.c
/usr/bin/clang -Wno-ignored-attributes -fno-strict-aliasing -fwrapv -fexcess-precision=standard -Xclang -no-opaque-pointers -Wno-unused-command-line-argument -Wno-compound-token-split-by-macro -O2 -I. -I./ -I/usr/pgsql-16/include/server -I/usr/pgsql-16/include/internal -D_GNU_SOURCE -I/usr/include/libxml2 -I/usr/include -flto=thin -emit-llvm -c -o linux/cpu_memory_by_process.bc linux/cpu_memory_by_process.c
linux/cpu_memory_by_process.c:230:9: warning: ‘readdir_r’ is deprecated [-Wdeprecated-declarations]
while (readdir_r(dirp, &dbuf, &ent) == 0)
^
/usr/include/dirent.h:186:28: note: ‘readdir_r’ has been explicitly marked deprecated here
nonnull ((1, 2, 3)) __attribute_deprecated;
^
/usr/include/sys/cdefs.h:308:51: note: expanded from macro ‘attribute_deprecated’

define attribute_deprecated attribute ((deprecated))

^

1 warning generated.

PATH="/usr/pgsql-16/bin:$PATH" make install USE_PGXS=1

output:
“Platform is: linux”
/usr/bin/mkdir -p ‘/usr/pgsql-16/lib’
/usr/bin/mkdir -p ‘/usr/pgsql-16/share/extension’
/usr/bin/mkdir -p ‘/usr/pgsql-16/share/extension’
/usr/bin/install -c -m 755 system_stats.so ‘/usr/pgsql-16/lib/system_stats.so’
/usr/bin/install -c -m 644 .//system_stats.control ‘/usr/pgsql-16/share/extension/’
/usr/bin/install -c -m 644 .//system_stats–1.0–2.0.sql .//system_stats–1.0.sql .//system_stats–2.0.sql .//uninstall_system_stats.sql ‘/usr/pgsql-16/share/extension/’
/usr/bin/mkdir -p ‘/usr/pgsql-16/include/server/extension/system_stats/’
/usr/bin/install -c -m 644 .//system_stats.h ‘/usr/pgsql-16/include/server/extension/system_stats/’
/usr/bin/mkdir -p ‘/usr/pgsql-16/lib/bitcode/system_stats’
/usr/bin/mkdir -p ‘/usr/pgsql-16/lib/bitcode’/system_stats/ ‘/usr/pgsql-16/lib/bitcode’/system_stats/linux/
/usr/bin/install -c -m 644 system_stats.bc ‘/usr/pgsql-16/lib/bitcode’/system_stats/./
/usr/bin/install -c -m 644 linux/system_stats_utils.bc ‘/usr/pgsql-16/lib/bitcode’/system_stats/linux/
/usr/bin/install -c -m 644 linux/disk_info.bc ‘/usr/pgsql-16/lib/bitcode’/system_stats/linux/
/usr/bin/install -c -m 644 linux/io_analysis.bc ‘/usr/pgsql-16/lib/bitcode’/system_stats/linux/
/usr/bin/install -c -m 644 linux/cpu_info.bc ‘/usr/pgsql-16/lib/bitcode’/system_stats/linux/
/usr/bin/install -c -m 644 linux/cpu_usage_info.bc ‘/usr/pgsql-16/lib/bitcode’/system_stats/linux/
/usr/bin/install -c -m 644 linux/os_info.bc ‘/usr/pgsql-16/lib/bitcode’/system_stats/linux/
/usr/bin/install -c -m 644 linux/memory_info.bc ‘/usr/pgsql-16/lib/bitcode’/system_stats/linux/
/usr/bin/install -c -m 644 linux/load_avg.bc ‘/usr/pgsql-16/lib/bitcode’/system_stats/linux/
/usr/bin/install -c -m 644 linux/process_info.bc ‘/usr/pgsql-16/lib/bitcode’/system_stats/linux/
/usr/bin/install -c -m 644 linux/network_info.bc ‘/usr/pgsql-16/lib/bitcode’/system_stats/linux/
/usr/bin/install -c -m 644 linux/cpu_memory_by_process.bc ‘/usr/pgsql-16/lib/bitcode’/system_stats/linux/
cd ‘/usr/pgsql-16/lib/bitcode’ && /usr/bin/llvm-lto -thinlto -thinlto-action=thinlink -o system_stats.index.bc system_stats/system_stats.bc system_stats/linux/system_stats_utils.bc system_stats/linux/disk_info.bc system_stats/linux/io_analysis.bc system_stats/linux/cpu_info.bc system_stats/linux/cpu_usage_info.bc system_stats/linux/os_info.bc system_stats/linux/memory_info.bc system_stats/linux/load_avg.bc system_stats/linux/process_info.bc system_stats/linux/network_info.bc system_stats/linux/cpu_memory_by_process.bc

sudo su - postgres
psql
create extension system_stats;