Skip to content

pgexporter_ext functions

pgexporter_get_functions

Description: Prints out all the functions available in pgexporter_ext.

Output Format:

  • fname text: Name of the function.
  • has_input boolean: True (t) if the function takes in arguments. False (f) otherwise.
  • description text: Description of the function.
  • ftype text (values: "gauge" | ""): Mentions the type of Prometheus metric its output is of.
sql
SELECT * FROM pgexporter_get_functions();
SELECT * FROM pgexporter_get_functions();
txt
|        fname             | has_input |             description              | ftype |
+--------------------------+-----------+--------------------------------------+-------+
| pgexporter_version_ext   | f         | pgexporter extension version         | gauge |
| pgexporter_is_supported  | t         | Is the pgexporter function supported |       |
| pgexporter_get_functions | f         | Get the pgexporter functions         |       |
| pgexporter_used_space    | t         | Get the used disk space              | gauge |
| pgexporter_free_space    | t         | Get the free disk space              | gauge |
| pgexporter_total_space   | t         | Get the total disk space             | gauge |
| pgexporter_os_info       | f         | The OS information                   | gauge |
| pgexporter_cpu_info      | f         | The CPU information                  | gauge |
| pgexporter_memory_info   | f         | The memory information               | gauge |
| pgexporter_network_info  | f         | The network information              | gauge |
| pgexporter_load_avg      | f         | The load averages                    | gauge |
(11 rows)
|        fname             | has_input |             description              | ftype |
+--------------------------+-----------+--------------------------------------+-------+
| pgexporter_version_ext   | f         | pgexporter extension version         | gauge |
| pgexporter_is_supported  | t         | Is the pgexporter function supported |       |
| pgexporter_get_functions | f         | Get the pgexporter functions         |       |
| pgexporter_used_space    | t         | Get the used disk space              | gauge |
| pgexporter_free_space    | t         | Get the free disk space              | gauge |
| pgexporter_total_space   | t         | Get the total disk space             | gauge |
| pgexporter_os_info       | f         | The OS information                   | gauge |
| pgexporter_cpu_info      | f         | The CPU information                  | gauge |
| pgexporter_memory_info   | f         | The memory information               | gauge |
| pgexporter_network_info  | f         | The network information              | gauge |
| pgexporter_load_avg      | f         | The load averages                    | gauge |
(11 rows)

pgexporter_version_ext

Description: Provides the enabled version of pgexporter_ext:

Output Format:

  • pgexporter_version_ext text: Enabled version of pgexporter_ext.
sql
SELECT * FROM pgexporter_version_ext();
SELECT * FROM pgexporter_version_ext();
txt
pgexporter_version_ext
------------------------
 0.3.0
(1 row)
pgexporter_version_ext
------------------------
 0.3.0
(1 row)

pgexporter_is_supported

Description: Checks if provided function name is one of the pgexporter_ext's functions.

Input Arguments:

  • fname text: Name of the function.

Output Format:

  • pgexporter_is_supported boolean: True (t) if the function is one of the supported functions of pgexporter_ext. False (f) otherwise.
sql
SELECT * FROM pgexporter_is_supported('hello_world');
SELECT * FROM pgexporter_is_supported('hello_world');
txt
pgexporter_is_supported
-------------------------
 f
(1 row)
pgexporter_is_supported
-------------------------
 f
(1 row)
sql
SELECT * FROM pgexporter_is_supported('pgexporter_version_ext');
SELECT * FROM pgexporter_is_supported('pgexporter_version_ext');
txt
pgexporter_is_supported
-------------------------
 t
(1 row)
pgexporter_is_supported
-------------------------
 t
(1 row)

pgexporter_used_space

Description: Get the used disk space of a directory.

sql
SELECT * FROM pgexporter_used_space('/dev');
SELECT * FROM pgexporter_used_space('/dev');
txt
pgexporter_used_space
-----------------------
               1127424
(1 row)
pgexporter_used_space
-----------------------
               1127424
(1 row)

pgexporter_free_space

Description: Get the free disk space of a directory.

sql
SELECT * FROM pgexporter_free_space('/dev');
SELECT * FROM pgexporter_free_space('/dev');
txt
pgexporter_free_space
-----------------------
               4194304
(1 row)
pgexporter_free_space
-----------------------
               4194304
(1 row)

Input Arguments:

  • dir_path text: Directory path.
sql
SELECT * from pgexporter_free_space('/home');
SELECT * from pgexporter_free_space('/home');
txt
pgexporter_free_space
-----------------------
          285776547840
(1 row)
pgexporter_free_space
-----------------------
          285776547840
(1 row)

pgexporter_total_space

Description: Get the free disk space of a directory.

Input Arguments:

  • dir_path text: Directory path.
sql
SELECT * from pgexporter_total_space('/home');
SELECT * from pgexporter_total_space('/home');
txt
pgexporter_free_space
-----------------------
          285776547840
(1 row)
pgexporter_free_space
-----------------------
          285776547840
(1 row)

pgexporter_os_info

Description: Gives information about the current operating system.

Output Format:

  • name text: Name of the Operating System.
  • version text: Version of the kernel.
  • architecture text: CPU architecture of the machine.
  • host_name text: Host name of the machine.
  • domain_name text: Domain name of the machine.
  • process_count integer: Number of active process running on the machine.
  • uptime_seconds integer: Uptime of the OS in seconds.
sql
SELECT * FROM pgexporter_os_info();
SELECT * FROM pgexporter_os_info();
txt
|               name               |           version           | architecture | host_name | domain_name | process_count | uptime_seconds |
+----------------------------------+-----------------------------+--------------+-----------+-------------+---------------+----------------+
| Fedora release 38 (Thirty Eight) | Linux 6.4.4-200.fc38.x86_64 | x86_64       | fedora    | (none)      |           357 |           2417 |
(1 row)
|               name               |           version           | architecture | host_name | domain_name | process_count | uptime_seconds |
+----------------------------------+-----------------------------+--------------+-----------+-------------+---------------+----------------+
| Fedora release 38 (Thirty Eight) | Linux 6.4.4-200.fc38.x86_64 | x86_64       | fedora    | (none)      |           357 |           2417 |
(1 row)

pgexporter_cpu_info

Description: Gives information about the CPU of the system.

Output Format:

  • vendor text: CPU Vendor name.
  • model_name text: CPU Model name.
  • number_of_cores integer: Number of cores the CPU has.
  • clock_speed_hz bigint: Clock speed of the CPU in Hertz.
  • l1dcache_size integer: Size of L1 D-Cache (Data Cache) of the CPU.
  • l1icache_size integer: Size of L1 I-Cache (Instruction Cache) of the CPU.
  • l2cache_size integer: Size of L2 Cache of the CPU.
  • l3cache_size integer: Size of L3 Cache of the CPU.
sql
SELECT * FROM pgexporter_cpu_info();
SELECT * FROM pgexporter_cpu_info();
txt
|    vendor    |                   model_name                   | number_of_cores | clock_speed_hz | l1dcache_size | l1icache_size | l2cache_size | l3cache_size |
+--------------+------------------------------------------------+-----------------+----------------+---------------+---------------+--------------+--------------+
| GenuineIntel | 11th Gen Intel(R) Core(TM) i5-1135G7 @ 2.40GHz |               4 |      752459008 |            48 |            32 |         1280 |         8192 |
(1 row)
|    vendor    |                   model_name                   | number_of_cores | clock_speed_hz | l1dcache_size | l1icache_size | l2cache_size | l3cache_size |
+--------------+------------------------------------------------+-----------------+----------------+---------------+---------------+--------------+--------------+
| GenuineIntel | 11th Gen Intel(R) Core(TM) i5-1135G7 @ 2.40GHz |               4 |      752459008 |            48 |            32 |         1280 |         8192 |
(1 row)

pgexporter_memory_info

Description: Gives information about the primary memory, swap space and cache of the system.

Output Format:

  • total_memory bigint: Total size of the memory.
  • used_memory bigint: Memory in use currently.
  • free_memory bigint: Free memory left to use.
  • swap_total bigint: Total swap space memory.
  • swap_used bigint: Swap space memory in use currently.
  • swap_free bigint: Free swap space memory left to use.
  • cache_total bigint: Total cache memory.
sql
SELECT * FROM pgexporter_memory_info();
SELECT * FROM pgexporter_memory_info();
txt
| total_memory | used_memory | free_memory | swap_total | swap_used | swap_free | cache_total|
--------------+-------------+-------------+------------+-----------+-----------+-------------+
|      7834600 |     5267188 |      399432 |   12027896 |         0 |  12008184 |     3807456|
(1 row)
| total_memory | used_memory | free_memory | swap_total | swap_used | swap_free | cache_total|
--------------+-------------+-------------+------------+-----------+-----------+-------------+
|      7834600 |     5267188 |      399432 |   12027896 |         0 |  12008184 |     3807456|
(1 row)

pgexporter_network_info

Description: Network statistics.

Output Format:

  • interface_name text: Name of the network interface. (eg. lo, docker0, enp2s0, etc.).
  • ip_address text: Private IP of the network interface.
  • tx_bytes bigint: Number of bytes transmitted.
  • tx_packets bigint: Number of packets transmitted.
  • tx_errors bigint: Number of errors during transmission.
  • tx_dropped bigint: Number of packets dropped during transmission.
  • rx_bytes bigint: Number of bytes received.
  • rx_packets bigint: Number of packets received.
  • rx_errors bigint: Number of errors during receiving.
  • rx_dropped bigint: Number of packets dropped during receiving.
  • link_speed_mbps integer: Speed of the link in Mbps

pgexporter_load_avg

Description: Load averages.

sql
SELECT * FROM pgexporter_load_avg();
SELECT * FROM pgexporter_load_avg();
txt
load_avg_one_minute | load_avg_five_minutes | load_avg_ten_minutes
---------------------+-----------------------+----------------------
                0.23 |                  0.21 |                 0.15
(1 row)
load_avg_one_minute | load_avg_five_minutes | load_avg_ten_minutes
---------------------+-----------------------+----------------------
                0.23 |                  0.21 |                 0.15
(1 row)