Skip to content

pgexporter-cli

pgexporter-cli exists to control pgexporter, especially when pgexporter is running as a daemon.

Usage:

pgexporter-cli -c <config-file> [options] [command]
pgexporter-cli -h <host> -p <port> [options] [command]
pgexporter-cli -?
pgexporter-cli -V
pgexporter-cli -c <config-file> [options] [command]
pgexporter-cli -h <host> -p <port> [options] [command]
pgexporter-cli -?
pgexporter-cli -V

Commands:

NOTE

The notation standard used for describing usage can be found here.

Meta Options

Help

sh
$ pgexporter-cli --help
$ pgexporter-cli --help
txt
pgexporter-cli 0.6.1
  Command line utility for pgexporter

USAGE:
  pgexporter-cli -c <config-file> [options] <command>
  pgexporter-cli -h <host> -p <port> [options] <command>
  pgexporter-cli -?
  pgexporter-cli -V

OPTIONS:

Usage:
  pgexporter-cli [ -c CONFIG_FILE ] [ COMMAND ]

Options:
  -c, --config CONFIG_FILE                       Set the path to the pgexporter.conf file
  -h, --host HOST                                Set the host name
  -p, --port PORT                                Set the port number
  -U, --user USERNAME                            Set the user name
  -P, --password PASSWORD                        Set the password
  -L, --logfile FILE                             Set the log file
  -v, --verbose                                  Output text string of result
  -V, --version                                  Display version information
  -F, --format text|json|raw                     Set the output format
  -C, --compress none|gz|zstd|lz4|bz2            Compress the wire protocol
  -E, --encrypt none|aes|aes256|aes192|aes128    Encrypt the wire protocol
  -?, --help                                     Display help

COMMANDS:
  ping                     Check if pgexporter is alive
  shutdown                 Shutdown pgexporter
  status [details]         Status of pgexporter, with optional details
  conf <action>            Manage the configuration, with one of subcommands:
                           - 'reload' to reload the configuration
                           - 'ls' to print the configurations used
                           - 'get' to obtain information about a runtime configuration value
                           - 'set' to modify a configuration value;
  clear <what>             Clear data, with:
                           - 'prometheus' to reset the Prometheus statistics
pgexporter-cli 0.6.1
  Command line utility for pgexporter

USAGE:
  pgexporter-cli -c <config-file> [options] <command>
  pgexporter-cli -h <host> -p <port> [options] <command>
  pgexporter-cli -?
  pgexporter-cli -V

OPTIONS:

Usage:
  pgexporter-cli [ -c CONFIG_FILE ] [ COMMAND ]

Options:
  -c, --config CONFIG_FILE                       Set the path to the pgexporter.conf file
  -h, --host HOST                                Set the host name
  -p, --port PORT                                Set the port number
  -U, --user USERNAME                            Set the user name
  -P, --password PASSWORD                        Set the password
  -L, --logfile FILE                             Set the log file
  -v, --verbose                                  Output text string of result
  -V, --version                                  Display version information
  -F, --format text|json|raw                     Set the output format
  -C, --compress none|gz|zstd|lz4|bz2            Compress the wire protocol
  -E, --encrypt none|aes|aes256|aes192|aes128    Encrypt the wire protocol
  -?, --help                                     Display help

COMMANDS:
  ping                     Check if pgexporter is alive
  shutdown                 Shutdown pgexporter
  status [details]         Status of pgexporter, with optional details
  conf <action>            Manage the configuration, with one of subcommands:
                           - 'reload' to reload the configuration
                           - 'ls' to print the configurations used
                           - 'get' to obtain information about a runtime configuration value
                           - 'set' to modify a configuration value;
  clear <what>             Clear data, with:
                           - 'prometheus' to reset the Prometheus statistics

Version

sh
$ pgexporter-cli --version
# or
$ pgexporter-cli -V
$ pgexporter-cli --version
# or
$ pgexporter-cli -V
txt
pgexporter-cli 0.6.1
pgexporter-cli 0.6.1

Commands

ping

Description: Checks if pgexporter is successfully running.

NOTE

It needs verbose flag to output anything.

sh
$ pgexporter-cli ping # -c <config-file> [options] --verbose
# or
$ pgexporter-cli ping # -h <host> -p port [options] --verbose
$ pgexporter-cli ping # -c <config-file> [options] --verbose
# or
$ pgexporter-cli ping # -h <host> -p port [options] --verbose
txt
pgexporter is running.
pgexporter is running.
txt
pgexporter is not running.
pgexporter is not running.

shutdown

Description: Shutdown pgexporter.

sh
$ pgexporter-cli shutdown # -c <config-file> [options]
# or
$ pgexporter-cli shutdown # -h <host> -p port [options]
$ pgexporter-cli shutdown # -c <config-file> [options]
# or
$ pgexporter-cli shutdown # -h <host> -p port [options]

status

Description: Provides status of the servers pgexporter is listening to for metrics.

sh
$ pgexporter-cli status # -c <config-file> [options]
# or
$ pgexporter-cli status # -h <host> -p port [options]
$ pgexporter-cli status # -c <config-file> [options]
# or
$ pgexporter-cli status # -h <host> -p port [options]
txt
Number of servers: 8
Server           : own
  Active         : Yes
Server           : v10
  Active         : No
Server           : v11
  Active         : No
Server           : v12
  Active         : No
Server           : v13
  Active         : Yes
Server           : v14
  Active         : No
Server           : v15
  Active         : Yes
Server           : v16beta2
  Active         : No
Number of servers: 8
Server           : own
  Active         : Yes
Server           : v10
  Active         : No
Server           : v11
  Active         : No
Server           : v12
  Active         : No
Server           : v13
  Active         : Yes
Server           : v14
  Active         : No
Server           : v15
  Active         : Yes
Server           : v16beta2
  Active         : No

status details

Description: See status.

sh
$ pgexporter-cli status details # -c <config-file> [options]
# or
$ pgexporter-cli status details # -h <host> -p port [options]
$ pgexporter-cli status details # -c <config-file> [options]
# or
$ pgexporter-cli status details # -h <host> -p port [options]
txt
Number of servers: 8
Server           : own
  Active         : Yes
Server           : v10
  Active         : No
Server           : v11
  Active         : No
Server           : v12
  Active         : No
Server           : v13
  Active         : Yes
Server           : v14
  Active         : No
Server           : v15
  Active         : Yes
Server           : v16beta2
  Active         : No
Number of servers: 8
Server           : own
  Active         : Yes
Server           : v10
  Active         : No
Server           : v11
  Active         : No
Server           : v12
  Active         : No
Server           : v13
  Active         : Yes
Server           : v14
  Active         : No
Server           : v15
  Active         : Yes
Server           : v16beta2
  Active         : No

conf reload

Description: Reload the configuration of pgexporter (in case of changes).

sh
$ pgexporter-cli conf reload # -c <config-file> [options]
$ pgexporter-cli conf reload # -c <config-file> [options]

WARNING

conf reload can only be done in local connections.

Options

Config File

Description:

Specify the pgexporter.conf file.

sh
$ pgexporter-cli -c <path-of-config-file> # [options] [command]
# or
$ pgexporter-cli --config <path-of-config-file> # [options] [command]
$ pgexporter-cli -c <path-of-config-file> # [options] [command]
# or
$ pgexporter-cli --config <path-of-config-file> # [options] [command]
sh
# Assuming path to config is ./pgexporter.conf
$ pgexporter-cli -c ./pgexporter.conf # [options] [command]
# Assuming path to config is ./pgexporter.conf
$ pgexporter-cli -c ./pgexporter.conf # [options] [command]

Host

Description:

Specify the host of pgexporter.

sh
$ pgexporter-cli -h <host> # -p <port> [options] [command]
# or
$ pgexporter-cli --host <host> # -p <port> [options] [command]
$ pgexporter-cli -h <host> # -p <port> [options] [command]
# or
$ pgexporter-cli --host <host> # -p <port> [options] [command]
sh
# Assuming host is localhost
$ pgexporter-cli -h localhost # -p <port> [options] [command]
# or
# Assuming host is 127.0.0.1
$ pgexporter-cli -h 127.0.0.1 # -p <port> [options] [command]
# Assuming host is localhost
$ pgexporter-cli -h localhost # -p <port> [options] [command]
# or
# Assuming host is 127.0.0.1
$ pgexporter-cli -h 127.0.0.1 # -p <port> [options] [command]

Port

Description:

Speicfy the port of pgexporter.

sh
$ pgexporter-cli -p <port> # -h <host> [options] [command]
# or
$ pgexporter-cli --port <port> # -h <host> [options] [command]
$ pgexporter-cli -p <port> # -h <host> [options] [command]
# or
$ pgexporter-cli --port <port> # -h <host> [options] [command]
sh
# Assuming port is 8080
$ pgexporter-cli -p 8080 # -h <host> [options] [command]
# Assuming port is 8080
$ pgexporter-cli -p 8080 # -h <host> [options] [command]

NOTE

The port mentioned here is the port at which management is open.

Username

Description:

Username of the user trying to interact with pgexporter.

sh
$ pgexporter-cli -U <username> # -P <password> [options] [command]
# or
$ pgexporter-cli --user <username> # -P <password> [options] [command]
$ pgexporter-cli -U <username> # -P <password> [options] [command]
# or
$ pgexporter-cli --user <username> # -P <password> [options] [command]
sh
$ pgexporter-cli -U pgexporter # -P <password> [options] [command]
$ pgexporter-cli -U pgexporter # -P <password> [options] [command]

NOTE

If you do not provide your credentials in the arguments, you will be prompted to provide them later.

NOTE

Steps for registering a username and password to access pgexporter through pgexporter-cli can be viewed here.

Password

Description:

Password of the user trying to interact with pgexporter.

sh
$ pgexporter-cli -P <password> # -U <username> [options] [command]
# or
$ pgexporter-cli --password <password> # --user <username> [options] [command]
$ pgexporter-cli -P <password> # -U <username> [options] [command]
# or
$ pgexporter-cli --password <password> # --user <username> [options] [command]
sh
$ pgexporter-cli -P pgexporter # -U pgexporter [options] [command]
$ pgexporter-cli -P pgexporter # -U pgexporter [options] [command]

NOTE

If you do not provide your credentials in the arguments, you will be prompted to provide them later.

NOTE

Steps for registering a username and password to access pgexporter through pgexporter-cli can be viewed here.

Log File

Description:

Specify the log file for pgexporter_config.

sh
$ pgexporter-cli -L <path-to-log-file> # -U <username> [options] [command]
# or
$ pgexporter-cli --logfile <path-to-log-file> # -U <username> [options] [command]
$ pgexporter-cli -L <path-to-log-file> # -U <username> [options] [command]
# or
$ pgexporter-cli --logfile <path-to-log-file> # -U <username> [options] [command]
sh
# Assuming wanting a logfile ./log.out
$ pgexporter-cli -L ./log.out # -U <username> [options] [command]
# Assuming wanting a logfile ./log.out
$ pgexporter-cli -L ./log.out # -U <username> [options] [command]

Verbose

Description:

Outputs more verbose information.

sh
$ pgexporter-cli -v  # [options] [command]
# or
$ pgexporter-cli --verbose # [options] [command]
$ pgexporter-cli -v  # [options] [command]
# or
$ pgexporter-cli --verbose # [options] [command]