PEM Worker Usage Guide v8

The PEM Worker performs tasks on behalf of the PEM Agent. Please note that all the pemworker command-line options must be run as root user on Linux platforms and as an administrator user on Windows platforms.

The following command-line options are supported by the PEM Worker:

On Linux:

  $./pemworker
  Postgres Enterprise Manager Agent
  Version: 8.0.0
  (Revision: REL-7_15_0-5-685-g415f794, Built on: Dec  1 2020 13:27:02)
  Schema Supported: 202010081

  ./pemworker [options]
  ./pemworker --register-agent [register-options]
  ./pemworker --register-server [register-server-options]
  ./pemworker --unregister-server [unregister-server-options]
  ./pemworker --unregister-agent [unregister-agent-options]
  ./pemworker --add-webhook [add-webhook-options]
  ./pemworker --remove-webhook [remove-webhook-options]
  ./pemworker --register-barman [barman-registration-options]
  ./pemworker --update-barman [barman-update-options]
  ./pemworker --unregister-barman [barman-unregistration-options]

  options:
    -v/--version (Show the version & the supported schema and, then exit.)
    -c <filepath> (Path to the configuration file.)
    -o <option name>=<option value> (Override the configuration file options.)
    -f Run in the foreground (do not detach from the terminal.)
    -t <short_wait> (Default: 10, Poll time interval (in seconds).)
    -r <long_wait> (Default: 30, Retry period (in seconds) after connection aborted.)
    -s <log file> (Path to the worker log file. Messages are logged to STDOUT if not specified.)
    -l <logging verbosity> (Default: ERROR, Possible Values: ERROR, WARNING, DEBUG1, DEBUG2)
    --allow_server_restart <true|false> (Default: true, Allow to restart the monitored server.)
    --allow-batch-probes <true|false> (Default: false, Allow to run the batch probes on this agent.)
    --batch-script-user <os-user> (Default: <none>, Name of the operating system user to run the batch script that is defined as a batch probe and a step in jobs.)
    --enable-heartbeat-connection (Default: false, Agent to use dedicated connection to update the heartbeat)
    --enable-smtp <true|false> (Default: false, Allow the PEM agent to send the email on behalf of the PEM server.)
    --enable-snmp <true|false> (Default: false, Allow the PEM agent to send the SNMP traps on behalf of the PEM server.)
    --enable-webhook <true|false> (Default: false, Allow the PEM agent to call webhooks on behalf of the PEM server.)
    --max-webhook-retries (Default: 3, Retry webhooks for specified times on failure.)

  register-options:
    --pem-server <hostname|address> (Host name/address of the PEM backend database server.)
    --pem-port <port number (Default: 5432, Port of the PEM backend database server.)
    --pem-user <username> (Database user, having superuser privileges, of the PEM backend database server.)
    --pem-agent-user <username> (Default: agent<agent_id>, Agent user to connect the PEM server backend database server)
    --cert-path <path> (Default: "~/.pem", Path where SSL certificates are saved.)
    --config-dir <path> (Default: "<pemworker path>/../etc", Directory path where configuration file can be found.)
    --display-name <name> (Default: system hostname, Display name for the agent.)
    --force-registration (forcefully registers the agent to PEM server with arguments provided.)
    --group <name> (Specify the group name where registered agent will be displayed.)
    --team <database-role> (Specify the name of the database role, on the PEM backend database server, that should have access to the monitored database server.)
    --owner <database-user> <Specify the name of the database user, on the PEM backend database server, who will own the agent.)
    --allow_server_restart <true|false> (Default: true, Allow to restart the monitored server.)
    --allow-batch-probes <true|false> (Default: false, Allow to run the batch probes on this agent.)
    --batch-script-user <os-user> (Default: <none>, Name of the operating system user to run the batch script that is defined as a batch probe and a step in jobs.)
    --enable-heartbeat-connection (Default: false, Agent to use dedicated connection to update the heartbeat)
    --enable-smtp <true|false> (Default: false, Allow the PEM agent to send the email on behalf of the PEM server.)
    --enable-snmp <true|false> (Default: false, Allow the PEM agent to send the SNMP traps on behalf of the PEM server.)
    --enable-webhook <true|false> (Default: false, Allow the PEM agent to call webhooks on behalf of the PEM server.)
    --max-webhook-retries (Default: 3, Retry webhooks for specified times on failure.)
    -o <option name>=<option value> (Override the configuration file options.)

    NOTE:
      Set environment variable PEM_SERVER_PASSWORD to provide the password for the
      PEM server to allow the pemworker to register itself.

  register-server-options:
    --pem-user <username> (Database user, a member of 'pem_admin' role, of the PEM backend database server.)
    --display-name <name> (Default: system hostname, Display name for the monitored database server.)
    --server-addr <hostname|address> (Host name/address of the database server to register with PEM server.)
    --server-port <port> (Port of the database server.)
    --server-database <name>(Postgres server database.)
    --server-user <name>(Database server user name.)
    --server-service-name <service-name> (Database server service name.)
    --efm-cluster-name <name> (EFM Cluster name.)
    --efm-install-path <path> (EFM installation path.)
    --config-dir <Directory path of agent configuration file (Default: "<pemworker path>/../etc")
    --remote-monitoring <yes|no> (Default: 'no', Allow remote monitoring.)
    --group <name> (Specify the group name where registered server will be displayed.)
    --team <datase-role> (Specify the name of the database role, on the PEM backend database server, that should have access to the monitored database server.)
    --owner <name> (Specify the name of the database user who will own the monitored server.)
    --asb-host-name <hostname> (Host name that the agent will use to connect to the database server. If not provided then '--server-addr' value will be used.)
    --asb-host-port <port> (Port number that agent will use to connect to database server. If not provided then '--server-port' value will be used.
    --asb-host-db <database> (Database name that agent will use to connect to database server. If not provided then '--server-database' value will be used.)
    --asb-host-user <database-user> (Database username that agent will use to connect to database server. If not provided then '--server-user' value will be used.)
    --asb-ssl-mode <ssl-mode> (Default: 'prefer', SSL mode that agent will use to connect to database server.)

    NOTE:
      Set environment variable PEM_SERVER_PASSWORD to provide the password for the
      PEM server to allow the pemworker to connect as a PEM admin user. Set
      PEM_MONITORED_SERVER_PASSWORD to provide the password of the database server being
      registered and monitored by pemagent.

  unregister-server-options:
    --pem-user <username> (Database user, a member of 'pem_admin' role, of the PEM backend database server.)
    --server-addr (Database server address to unregister from PEM server.)
    --server-port (Port of database server.)
    --config-dir <Directory path of agent configuration file (Default: "<pemworker path>/../etc")

  unregister-agent-options:
    --pem-user <username> (Database user, a member of 'pem_admin' role, of the PEM backend database server.)
    --config-dir <Directory path of agent configuration file (Default: "<pemworker path>/../etc")

  add-webhook-options:
    --webhook-name (Name of the webhook endpoint.)
    --webhook-ssl-key (The complete path of the client key file to connect to the webhook server.)
    --webhook-ssl-crt (The complete path of the client certificate file to connect to the webhook server.)
    --webhook-ssl-ca-crt (The complete path to the webhook SSL CA certificate file.)
    --webhook-ssl-crl (The complete path of the CRL file to validate revoked webhook server certificate.)
    --webhook-allow-insecure-ssl (Default: false, Allow webhooks to call with insecure flag.)
    --config-dir <Directory path of agent configuration file (Default: "<pemworker path>/../etc")

  remove-webhook-options:
    --webhook-name (Name of the webhook endpoint.)
    --config-dir <Directory path of agent configuration file (Default: "<pemworker path>/../etc")

  barman-registration-options:
    --api-url <url> (URL of the BARMAN API 'pg-backup-api')
    --description <name> (Description to show on the UI 'User interface' for the BARMAN API.)
    --probe-execution-frequency <interval> (Default: 30, Probe the BARMAN API 'pg-backup-api' at regular interval 'in seconds' and fetch the metrics.)
    --heartbeat-interval <interval> (Default: 10, Ping the BARMAN API 'pg-backup-api' 'status' API at a regular interval 'in seconds' for checking its availability.)
    --ssl-crt <certificate_file> (SSL certificate file for the BARMAN API.)
    --ssl-key <key_file> (Private SSL key for the BARMAN API.)
    --ssl-ca-cert <ca_file> (CA certificate to verify peer against the BARMAN API.)
    --team <database-role> (Specify the name of the database group role, on the PEM backend database server, that should have access to this BARMAN API Server.)
    --owner <database-user> (Specify the name of the database user, on the PEM backend database server, who will own the BARMAN API Server.)
    --config-file/-c <config_file> (Path to the agent configuration file.)

  barman-update-options:
    --id <barman-id> (ID for the existing BARMAN API 'pg-backup-api')
    --api-url <url> (URL of the BARMAN API 'pg-backup-api')
    --probe-execution-frequency <interval> (Default: 30, Probe the BARMAN API 'pg-backup-api' at regular interval 'in seconds' and fetch the metrics.)
    --heartbeat-interval <interval> (Default: 10, Ping the BARMAN API 'pg-backup-api' 'status' API at a regular interval 'in seconds' for checking its availability.)
    --ssl-crt <certificate_file> (SSL certificate file for the BARMAN API.)
    --ssl-key <key_file> (Private SSL key for the BARMAN API.)
    --ssl-ca-cert <ca_file> (CA certificate to verify peer against the BARMAN API.)
    --config-file/-c <config_file> (Path to the agent configuration file.)

  barman-unregistration-options:
    --id <barman-id> (ID for the existing BARMAN API, registered with the PEM Server.'pg-backup-api')
    --config-file/-c <config_file> (Path to the agent configuration file.)

    NOTE:
      Set environment variable PEM_SERVER_PASSWORD to provide the password for the
      PEM server to allow the pemworker to connect as a PEM admin user.

On Windows:

```shell-session
C:\Program Files\edb\pem\agent\bin> pemworker.exe --help
Postgres Enterprise Manager Worker
Version: 8.0.0

pemworker.exe DEBUG [options]
pemworker.exe REGISTER [register-options]
pemworker.exe REGISTER-SERVER [register-server-options]
pemworker.exe UNREGISTER-SERVER [unregister-server-options]
pemworker.exe UNREGISTER-AGENT [unregister-agent-options]
pemworker.exe ADD-WEBHOOK [--add-webhook-options]
pemworker.exe REMOVE-WEBHOOK [--remove-webhook-options]

options:
  -v/--version (Show the version & the supported schema and, then exit.)
  -c <filepath> (Path to the configuration file.)
  -o <option name>=<option value> (Override the configuration file options.)
  -t <short_wait> (Default: 10, Poll time interval (in seconds).)
  -r <long_wait> (Default: 30, Retry period (in seconds) after connection aborted.)
  -l <logging verbosity> (Default: ERROR, Possible Values: ERROR, WARNING, DEBUG1, DEBUG2)
  --allow_server_restart <true|false> (Default: true, Allow to restart the monitored server.)
  --allow-batch-probes <true|false> (Default: false, Allow to run the batch probes on this agent.)
  --enable-heartbeat-connection (Default: false, Agent to use dedicated connection to update the heartbeat)
  --enable-smtp <true|false> (Default: false, Allow the PEM agent to send the email on behalf of the PEM server.)
  --enable-snmp <true|false> (Default: false, Allow the PEM agent to send the SNMP traps on behalf of the PEM server.)
  --enable-webhook <true|false> (Default: false, Allow the PEM agent to call webhooks on behalf of the PEM server.)
  --max-webhook-retries (Default: 3, Retry webhooks for specified times on failure.)

register-options:
  --pem-server <hostname|address> (Host name/address of the PEM backend database server.)
  --pem-port <port number (Default: 5432, Port of the PEM backend database server.)
  --pem-user <username> (Database user, having superuser privileges, of the PEM backend database server.)
  --pem-agent-user <username> (Default: agent<agent_id>, Agent user to connect the PEM server backend database server)
  --cert-path <path> (Default: "%APPDATA%\pem", Path where SSL certificates are saved.)
  --display-name <name> (Default: system hostname, Display name for the agent.)
  --force-registration (forcefully registers the agent to PEM server with arguments provided.)
  --group <name> (Specify the group name where registered agent will be displayed.)
  --team <database-role> (Specify the name of the database role, on the PEM backend database server, that should have access to the monitored database server.)
  --owner <database-user> <Specify the name of the database user, on the PEM backend database server, who will own the agent.)
  --allow_server_restart <true|false> (Default: true, Allow to restart the monitored server.)
  --allow-batch-probes <true|false> (Default: false, Allow to run the batch probes on this agent.)
  --enable-heartbeat-connection (Default: false, Agent to use dedicated connection to update the heartbeat)
  --enable-smtp <true|false> (Default: false, Allow the PEM agent to send the email on behalf of the PEM server.)
  --enable-snmp <true|false> (Default: false, Allow the PEM agent to send the SNMP traps on behalf of the PEM server.)
  --enable-webhook <true|false> (Default: false, Allow the PEM agent to call webhooks on behalf of the PEM server.)
  --max-webhook-retries (Default: 3, Retry webhooks for specified times on failure.)
  -o <option name>=<option value> (Override the configuration file options.)

  NOTE:
   Set environment variable PEM_SERVER_PASSWORD to provide the password for the
   PEM server to allow the pemworker to register itself.

register-server-options:
  --pem-user <username> (Database user, a member of 'pem_admin' role, of the PEM backend database server.)
  --display-name <name> (Default: system hostname, Display name for the monitored database server.)
  --server-addr <hostname|address> (Host name/address of the database server to register with PEM server.)
  --server-port <port> (Port of the database server.)
  --server-database <name>(Postgres server database.)
  --server-user <name>(Database server user name.)
  --server-service-name <service-name> (Database server service name.)
  --remote-monitoring <true|false> (Allow remote monitoring.)
  --group <name> (Specify the group name where registered server will be displayed.)
  --team <database-role> (Specify the name of the database role, on the PEM backend database server, that should have access to the monitored database server.)
  --owner <name> (Specify the name of the database user who will own the monitored server.)
  --asb-host-name <hostname> (Host name that the agent will use to connect to the database server. If not provided then '--server-addr' value will be used.)
  --asb-host-port <port> (Port number that agent will use to connect to database server. If not provided then '--server-port' value will be used.
  --asb-host-db <database> (Database name that agent will use to connect to database server. If not provided then '--server-database' value will be used.)
  --asb-host-user <database-user> (Database username that agent will use to connect to database server. If not provided then '--server-user' value will be used.)
  --asb-ssl-mode <ssl-mode> (Default: 'prefer', SSL mode that agent will use to connect to database server.)

  NOTE:
   Set environment variable PEM_SERVER_PASSWORD to provide the password for the
   PEM server to allow the pemworker to connect as a PEM admin user. Set
   PEM_MONITORED_SERVER_PASSWORD to provide the password of the database server being
   registered and monitored by pemagent.

unregister-server-options:
  --pem-user <username> (Database user, a member of 'pem_admin' role, of the PEM backend database server.)
  --server-addr (Database server address to unregister from PEM server.)
  --server-port (Port of database server.)
  --config-dir <Directory path of agent configuration file (Default: "<pemworker path>/../etc")

unregister-agent-options:
  --pem-user <username> (Database user, a member of 'pem_admin' role, of the PEM backend database server.)

add-webhook-options:
  --webhook-name (Name of the webhook endpoint.)
  --webhook-ssl-key (The complete path of the client key file to connect to the webhook server.)
  --webhook-ssl-crt (The complete path of the client certificate file to connect to the webhook server.)
  --webhook-ssl-ca-crt (The complete path to the webhook SSL CA certificate file.)
  --webhook-ssl-crl (The complete path of the CRL file to validate revoked webhook server certificate.)
  --webhook-allow-insecure-ssl (Default: false, Allow webhooks to call with insecure flag.)

remove-webhook-options:
  --webhook-name (Name of the webhook endpoint.)

  NOTE:
   Set environment variable PEM_SERVER_PASSWORD to provide the password for the
   PEM server to allow the pemworker to connect as a PEM admin user.
```