Registering a Server¶
Before you can manage or monitor a server with PEM, you must register the server with PEM, and bind an agent. A server may be bound to a remote agent (an agent that resides on a different host), but if the agent does not reside on the same host, it will not have access to all of the statistical information about the instance.
Manually Registering a Server¶
To manage or monitor a server with PEM, you must:
Register your Advanced Server or PostgreSQL server with the PEM server.
Bind the server to a PEM agent.
You can use the Create - Server dialog to provide registration
information for a server, bind a PEM agent, and display the server in
PEM client tree control. To open the Create - Server dialog, navigate
through the Create option on the Object menu (or the context menu of a
server group) and select Server….
Accessing the Create – Server dialog¶
Note
You must ensure the pg_hba.conf file of the Postgres server that you are registering allows connections from the host of the PEM client before attempting to connect.
The General tab of the Create – Server dialog¶
Use the fields on the General tab to describe the general properties of the server:
Use the
Namefield to specify a user-friendly name for the server. The name specified will identify the server in the PEMBrowsertree control.You can use groups to organize your servers and agents in the tree control. Using groups can help you manage large numbers of servers more easily. For example, you may want to have a production group, a test group, or LAN specific groups. Use the
Groupdrop-down listbox to select the server group in which the new server will be displayed.Use the
Teamfield to specify a Postgres role name. Only PEM users who are members of this role, who created the server initially, or have superuser privileges on the PEM server will see this server when they logon to PEM. If this field is left blank, all PEM users will see the server.Use the
Backgroundcolor selector to select the color that will be displayed in the PEM tree control behind database objects that are stored on the server.Use the
Foregroundcolor selector to select the font color of labels in the PEM tree control for objects stored on the server.Check the box next to
Connect now?to instruct PEM to attempt a server connection when you click the Save button. LeaveConnect now?unchecked if you do not want the PEM client to validate the specified connection parameters until a later connection attempt.Provide notes about the server in the
Commentsfield.
The Connection tab of the Create – Server dialog¶
Use fields on the Connection tab to specify connection details for the server:
Specify the IP address of the server host, or the fully qualified domain name in the
Host name/addressfield. On Unix based systems, the address field may be left blank to use the default PostgreSQL Unix Domain Socket on the local machine, or may be set to an alternate path containing a PostgreSQL socket. If you enter a path, the path must begin with a “/”.Specify the port number of the host in the
Portfield.Use the
Maintenance databasefield to specify the name of the initial database that PEM will connect to, and that will be expected to containpgAgentschema andadminpackobjects installed (both optional). On PostgreSQL 8.1 and above, the maintenance DB is normally calledpostgres; on earlier versionstemplate1is often used, though it is preferrable to create apostgresdatabase to avoid cluttering the template database.Specify the name that will be used when authenticating with the server in the
Usernamefield.Provide the password associated with the specified user in the
Passwordfield.Check the box next to
Save password?to instruct PEM to store passwords in the~/.pgpassfile (on Linux) or%APPDATA%\postgresql\pgpass.conf(on Windows) for later reuse. For details, see thepgpassdocumentation. Stored passwords will be used for all libpq based tools. To remove a password, disconnect from the server, open the server’s Properties dialog and uncheck the selection.Use the
Rolefield to specify the name of the role that is assigned the privileges that the client should use after connecting to the server. This allows you to connect as one role, and then assume the permissions of another role when the connection is established (the one you specified in this field). The connecting role must be a member of the role specified.
The SSL tab of the Create – Server dialog¶
Use the fields on the SSL tab to configure SSL:
Use the drop-down list box in the
SSL modefield to select the type of SSL connection the server should use. For more information about using SSL encryption, see the PostgreSQL documentation at:https://www.postgresql.org/docs/current/static/libpq-ssl.html
You can use the platform-specific File manager dialog to upload files that
support SSL encryption to the server. To access the File manager, click
the icon that is located to the right of each of the following fields:
Use the
Client certificatefield to specify the file containing the client SSL certificate. This file will replace the default~/.postgresql/postgresql.crtfile if PEM is installed in Desktop mode, and<STORAGE_DIR>/<USERNAME>/.postgresql/postgresql.crtif PEM is installed in Web mode. This parameter is ignored if an SSL connection is not made.Use the
Client certificatekey field to specify the file containing the secret key used for the client certificate. This file will replace the default~/.postgresql/postgresql.keyif PEM is installed in Desktop mode, and<STORAGE_DIR>/<USERNAME>/.postgresql/postgresql.keyif PEM is installed in Web mode. This parameter is ignored if an SSL connection is not made.Use the
Root certificatefield to specify the file containing the SSL certificate authority. This file will replace the default~/.postgresql/root.crtfile. This parameter is ignored if an SSL connection is not made.Use the
Certificate revocation listfield to specify the file containing the SSL certificate revocation list. This list will replace the default list, found in~/.postgresql/root.crl. This parameter is ignored if an SSL connection is not made.When
SSL compression?is set to True, data sent over SSL connections will be compressed. The default value isFalse(compression is disabled). This parameter is ignored if an SSL connection is not made.
Warning
Certificates, private keys, and the revocation list are stored in the per-user file storage area on the server, which is owned by the user account under which the PEM server process is run. This means that administrators of the server may be able to access those files; appropriate caution should be taken before choosing to use this feature.
The SSH Tunnel tab of the Create – Server dialog¶
Use the fields on the SSH Tunnel tab to configure SSH
Tunneling. You can use a tunnel to connect a database server (through an
intermediary proxy host) to a server that resides on a network to which
the client may not be able to connect directly.
Set
Use SSH tunnelingtoYesto specify that PEM should use an SSH tunnel when connecting to the specified server.Specify the name or IP address of the SSH host (through which client connections will be forwarded) in the
Tunnel hostfield.Specify the port of the SSH host (through which client connections will be forwarded) in the
Tunnel portfield.Specify the name of a user with login privileges for the SSH host in the
Usernamefield.Specify the type of authentication that will be used when connecting to the SSH host in the
Authenticationfield.Select
Passwordto specify that PEM will use a password for authentication to the SSH host. This is the default.Select
Identity fileto specify that PEM will use a private key file when connecting.If the SSH host is expecting a private key file for authentication, use the
Identity filefield to specify the location of the key file.If the SSH host is expecting a password, use the
Passwordfield to specify the password, or if an identity file is being used, the passphrase.
The Advanced tab of the Create – Server dialog¶
Use fields on the Advanced tab to specify details that are used to manage the server:
Specify the IP address of the server host in the
Host Address1field.Use the
DB restrictionfield to specify a SQL restriction that will be used against the pg_database table to limit the databases displayed in the tree control. For example, you might enter:'live_db','test_db'to instruct the PEM browser to display only thelive_dbandtest_dbdatabases. Note that you can also limit the schemas shown in the database from the database properties dialog by entering a restriction against pg_namespace.Use the
Password filefield to specify the location of a password file (.pgpass). The.pgpassfile allows a user to login without providing a password when they connect. For more information, see the Postgres documentation at:http://www.postgresql.org/docs/current/static/libpq-pgpass.html
Note
Use of a password file is only supported when PEM is using libpq v10.0 or later to connect to the server.
Use the
Service IDfield to specify parameters to control the database service process. For servers that are stored in the Enterprise Manager directory, enter the service ID. On Windows machines, this is the identifier for the Windows service. On Linux machines, this is the name of the init script used to start the server in/etc/init.d. For example, the name of the Advanced Server 10 service isedb-as-10. For local servers, the setting is operating system dependent:If the PEM client is running on a Windows machine, it can control the postmaster service if you have sufficient access rights. Enter the name of the service. In case of a remote server, it must be prepended by the machine name (e.g.
PSE1\pgsql-8.0). PEM will automatically discover services running on your local machine.If the PEM client is running on a Linux machine, it can control processes running on the local machine if you have enough access rights. Provide a full path and needed options to access the
pg_ctlprogram. When executing service control functions, PEM will append status/start/stop keywords to this. For example:
sudo /usr/local/pgsql/bin/pg_ctl -D /data/pgsqlIf the server is a member of a Failover Manager cluster, you can use PEM to monitor the health of the cluster and to replace the master node if necessary. To enable PEM to monitor Failover Manager, use the
EFM cluster namefield to specify the cluster name. The cluster name is the prefix of the name of the Failover Manager cluster properties file. For example, if the cluster properties file is namedefm.properties, the cluster name isefm.If you are using PEM to monitor the status of a Failover Manager cluster, use the
EFM installation pathfield to specify the location of the Failover Manager binary file. By default, the Failover Manager binary file is installed in/usr/efm-2.x/bin, where x specifies the Failover Manager version.
The PEM Agent tab of the Create – Server dialog¶
Use fields on the PEM Agent tab to specify connection details for the PEM agent:
Move the
Remote monitoring?slider toYesto indicate that the PEM agent does not reside on the same host as the monitored server. When remote monitoring is enabled, agent level statistics for the monitored server will not be available for custom charts and dashboards, and the remote server will not be accessible by some PEM utilities (such as Audit Manager, Capacity Manager, Log Manager, Postgres Expert and Tuning Wizard).Select an Enterprise Manager agent using the drop-down listbox to the right of the
Bound agentlabel. One agent can monitor multiple Postgres servers.Enter the IP address or socket path that the agent should use when connecting to the database server in the
Hostfield. By default, the agent will use the host address shown on theGeneraltab. On a Unix server, you may wish to specify a socket path, e.g./tmp.Enter the
Portnumber that the agent will use when connecting to the server. By default, the agent will use the port defined on thePropertiestab.Use the drop-down listbox in the
SSLfield to specify an SSL operational mode; specify require, prefer, allow, disable, verify-ca or verify-full. For more information about using SSL encryption, see the PostgreSQL documentation at:Use the
Databasefield to specify the name of the database to which the agent will initially connect.Specify the name of the role that agent should use when connecting to the server in the
User namefield. Note that if the specified role is not a database superuser, then some of the features will not work as expected. For the list of features that do not work if the specified role is not a database superuser, see Agent privileges.
If you are using Postgres version 10 or above, you can use the
pg_monitorrole to grant the required privileges to a non-superuser. For information aboutpg_monitorrole, see:
Specify the password that the agent should use when connecting to the server in the
Passwordfield, and verify it by typing it again in theConfirm passwordfield. If you do not specify a password, you will need to configure the authentication for the agent manually; for example, you can use a.pgpassfile.Set the
Allow takeover?slider toYesto specify that the server may be taken over by another agent. This feature allows an agent to take responsibility for the monitoring of the database server if, for example, the server has been moved to another host as part of a high availability failover process.
To view the properties of a server, right-click on the server name in
the PEM client tree control, and select the Properties… option from the
context menu. To modify a server’s properties, disconnect from the
server before opening the Properties dialog.
Automatic Server Discovery¶
If the server you wish to monitor resides on the same host as the
monitoring agent, you can use the Auto Discovery dialog to simplify the
registration and binding process.
To enable auto discovery for a specific agent, you must enable the
Server Auto Discovery probe. To access the Manage Probes tab, highlight
the name of a PEM agent in the PEM client tree control, and select
Manage Probes... from the Management menu. When the Manage Probes tab
opens, confirm that the slider control in the Enabled? column is set to
Yes.
To open the Auto Discovery dialog, highlight the name
of a PEM agent in the PEM client tree control, and select Auto
Discovery... from the Management menu.
The PEM Auto Discovery dialog¶
When the Auto Discovery dialog opens, the Discovered Database Servers
box will display a list of servers that are currently not being monitored by a
PEM agent. Check the box next to a server name to display information
about the server in the Server Connection Details box, and connection
properties for the agent in the Agent Connection Details box.
Use the Check All button to select the box next to all of the displayed
servers, or Uncheck All to deselect all of the boxes to the left of the
server names.
The fields in the Server Connection Details box provide information
about the server that PEM will monitor:
Accept or modify the name of the monitored server in the
Namefield. The specified name will be displayed in the tree control of the PEM client.Use the
Server groupdrop-down listbox to select the server group under which the server will be displayed in the PEM client tree control.Use the
Host name/addressfield to specify the IP address of the monitored server.The
Portfield displays the port that is monitored by the server; this field may not be modified.Provide the name of the service in the
Service IDfield. Please note that the service name must be provided to enable some PEM functionality.By default, the
Maintenance databasefield indicates that the selected server uses a Postgres maintenance database. Customize the content of theMaintenance databasefield for your installation.
The fields in the Agent Connection Details box specify the properties
that the PEM agent will use when connecting to the server:
The
Hostfield displays the IP address that will be used for the PEM agent binding.The
User namefield displays the name that will be used by the PEM agent when connecting to the selected server.The
Passwordfield displays the password associated with the specified user name.Use the drop-down listbox in the
SSL modefield to specify your SSL connection preferences.
When you’ve finished specifying the connection properties for the
servers that you are binding for monitoring, click the OK button to
register the servers. Click Cancel to exit without preserving any
changes.
The registered server¶
After clicking the OK button, the newly registered server is displayed
in the PEM tree control and is monitored by the PEM
server.
Using the pemworker Utility to Register a Server¶
You can use the pemworker utility to register a server for monitoring by
the PEM server or to unregister a database server. During registration,
the pemworker utility will bind the new server to the agent that resides
on the system from which you invoked the registration command. To
register a server:
on a Linux host, use the command:
pemworker --register-server
on a Windows host, use the command:
pemworker.exe REGISTER-SERVICE
Append command line options to the command string when invoking the
pemworker utility. Each option should be followed by a corresponding
value:
Option |
Description |
|---|---|
|
Specifies the name of the PEM administrative user. Required. |
|
Specifies the IP address of the server host, or the fully qualified domain name. On Unix based systems, the address field may be left blank to use the default PostgreSQL Unix Domain Socket on the local machine, or may be set to an alternate path containing a PostgreSQL socket. If you enter a path, the path must begin with a /. Required. |
|
Specifies the port number of the host. Required. |
|
Specifies the name of the database to which the server will connect. Required. |
|
Specify the name of the user that will be used by the agent when monitoring the server. Required. |
|
Specifies the name of the database service that controls operations on the server that is being registered (STOP, START, RESTART, etc.). Optional. |
|
Include the –remote-monitoring clause and a value of false (the default) to indicate that the server is installed on the same machine as the PEM agent. When remote monitoring is enabled (true), agent level statistics for the monitored server will not be available for custom charts and dashboards, and the remote server will not be accessible by some PEM utilities (such as Audit Manager, Capacity Manager, Log Manager, Postgres Expert and Tuning Wizard). Required. |
|
Specifies the name of the Failover Manager cluster that monitors the server (if applicable). Optional. |
|
Specifies the complete path to the installation directory of Failover Manager (if applicable). Optional. |
|
Specifies the name of the host to which the agent is connecting. |
|
Specifies the port number that the agent will use when connecting to the database. |
|
Specifies the name of the database to which the agent will connect. |
|
Specifies the database user name that the agent will supply when authenticating with the database. |
|
Specifies the type of SSL authentication that will be used for connections. Supported values include: prefer, require, disable, verify-CA, verify-full. |
|
Specifies the name of the group in which the server will be displayed. |
|
Specifies the name of the group role that will be allowed to access the server. |
|
Specifies the name of the role that will own the monitored server. |
Set the 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 the environment variable PEM_MONITORED_SERVER_PASSWORD to provide the password of the database server being registered and monitored by pemagent.
Failure to provide the password will result in a password authentication error. The PEM server will acknowledge that the server has been registered properly.
Using the pemworker Utility to Unregister a Server¶
You can use the pemworker utility to unregister a database server; to
unregister a server, invoke the pemworker utility:
on a Linux host, use the command:
pemworker --unregister-server
on a Windows host, use the command:
pemworker.exe UNREGISTER-SERVICE
Append command line options to the command string when invoking the
pemworker utility. Each option should be followed by a corresponding
value:
Option |
Description |
|---|---|
|
Specifies the name of the PEM administrative user. Required. |
|
Specifies the IP address of the server host, or the fully qualified domain name. On Unix based systems, the address field may be left blank to use the default PostgreSQL Unix Domain Socket on the local machine, or may be set to an alternate path containing a PostgreSQL socket. If you enter a path, the path must begin with a /. Required. |
|
Specifies the port number of the host. Required. |
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.
Failure to provide the password will result in a password authentication error. The PEM server will acknowledge that the server has been unregistered.
Verifying the Connection and Binding¶
Once registered, the new server will be added to the PEM Browser tree
control, and be displayed on the Global Overview.
The Global Overview dashboard¶
When initially connecting to a newly bound server, the Global Overview
dashboard may display the new server with a status of “unknown” in the
server list; before recognizing the server, the bound agent must execute
a number of probes to examine the server, which may take a few minutes
to complete depending on network availability.
Within a few minutes, bar graphs on the Global Overview dashboard should
show that the agent has now connected successfully, and the new server
is included in the Postgres Server Status list.
If after five minutes, the Global Overview dashboard still does not list
the new server, you should review the logfiles for the monitoring agent,
checking for errors. Right-click the agent’s name in the tree control,
and select the Probe Log Analysis option from the Dashboards sub-menu of
the context menu.