Skip to content

Using radar

Each radar invocation runs one collection, writes a single ZIP archive, and exits.

Running a Collection

The following commands collect both kinds of data, system data only, and PostgreSQL data only:

# Collect system and PostgreSQL data (the default)
radar -d mydatabase -U databaseuser

# Collect system data only
radar --skip-postgres

# Collect PostgreSQL data only
radar -d mydatabase -U databaseuser --skip-system

The --skip-system option also skips the PgBouncer collectors, which radar treats as system collectors. When radar cannot connect to PostgreSQL and --skip-system is set, nothing remains to collect; radar reports the failure and writes no archive.

radar stops a command, or cancels a query, that is still running after 30 seconds. radar then reports an error for that collector and continues with the next one; the output or rows that arrived before the limit stay in the archive.

radar prints the archive name and its size in kilobytes when the collection finishes:

$ radar -d mydatabase
Collecting diagnostic data...
✓ Archive created: radar-hostname-20260115-133700.zip (1234 KB)

Reviewing the Command-Line Options

The radar --help command prints the following usage summary:

Usage: radar [options]

GLOBAL OPTIONS:
   --help         show help
   --version, -V  print the version

Options:
  -U string
        database user
  -d string
        database name
  -data-dir string
        PostgreSQL data directory
  -exclude string
        comma-separated task names to skip (e.g. -exclude bloat,stat_ssl)
  -h string
        database host
  -include string
        comma-separated default-disabled task names to enable (e.g. pgstattuple, disabled by default)
  -p int
        database port (default 5432)
  -pgbouncer-conf string
        PgBouncer configuration directory (default: /etc/pgbouncer, /usr/local/etc/pgbouncer)
  -skip-postgres
        skip PostgreSQL data collection
  -skip-system
        skip system data collection
  -sslcert string
        client SSL certificate file
  -sslkey string
        client SSL key file
  -sslmode string
        SSL mode (prefer, disable, require, verify-ca, verify-full) (default "prefer")
  -sslrootcert string
        SSL root certificate file
  -v    verbose output (summary)
  -vv
        very verbose output (detailed)

Excluding Collectors

The --exclude option skips the collectors that you name, and the --include option enables the collectors that are disabled by default; --include takes precedence over --exclude.

Run radar with -vv to list each collector by name; for a per-database collector, the name after the database prefix is the name that --exclude accepts:

✓ stat_ssl
✓ postgres/tables

The following command skips the bloat and stat_ssl collectors:

radar -d mydatabase -U databaseuser --exclude bloat,stat_ssl

Interpreting Exit Codes

radar returns an exit code that indicates the result of each run. The following table describes the exit codes:

Exit Code Meaning
0 The run succeeded.
4 radar collected no data.
64 The command line is incorrect: radar cannot parse it, such as an unknown option, or an argument is invalid or missing, such as an unsupported SSL mode.
69 radar cannot connect to PostgreSQL.
73 radar cannot create the archive.
74 radar cannot finish writing the archive.

The codes from 64 to 74 have the meanings that sysexits.h gives them.

When radar cannot connect to PostgreSQL, radar continues with system-only collection, writes the archive, and exits with code 69. With --skip-system, a connection failure leaves nothing to collect, so radar exits with code 69 and writes no archive.