• Postgres Enterprise Manager Overview – Chapter 2 provides information about PEM functionality, components, architecture, and supported platforms.
• Using the PEM Web Interface – Chapter 3 provides an overview of PEM's web interface. The web interface is installed with the PEM server, and can be used from your browser of choice.
• Registering a Server - Chapter 4 highlights the different tools available to assist with server registration.
• General database administration – Chapter 5 will assist you in performing general database administration tasks, and SQL query and stored procedure development.
• Server Management - Chapter 6 provides information about controlling the PEM server, and managing server authentication.This document uses Postgres to mean either the PostgreSQL or EDB Postgres Advanced Server database.
1.1 What's NewFor detailed information about supported features, please see the EDB Postgres Enterprise Manager EDB Ark Management Guide available from the EnterpriseDB website at:
In the following descriptions a term refers to any word or group of words that are language keywords, user-supplied values, literals, etc. A term’s exact meaning depends upon the context in which it is used.
• Italic font introduces a new term, typically, in the sentence that defines it for the first time.
• Fixed-width (mono-spaced) font is used for terms that must be given literally such as SQL commands, specific table and column names used in the examples, programming language keywords, etc. For example, SELECT * FROM emp;
• Italic fixed-width font is used for terms for which the user must substitute values in actual usage. For example, DELETE FROM table_name;
• Square brackets [ ] denote that one or none of the enclosed term(s) may be substituted. For example, [ a | b ], means choose one of “a” or “b” or neither of the two.
• Braces {} denote that exactly one of the enclosed alternatives must be specified. For example, { a | b }, means exactly one of “a” or “b” must be specified.
• Ellipses ... denote that the proceeding term may be repeated. For example, [ a | b ] ... means that you may have the sequence, “b a a b a”.
Postgres Enterprise Manager (PEM) is an enterprise management tool designed to assist database administrators, system architects, and performance analysts in administering, monitoring, and tuning PostgreSQL and EnterpriseDB Advanced Server database servers. PEM is architected to manage and monitor anywhere from a handful, to hundreds of servers from a single console, allowing complete and remote control over all aspects of your databases.
• Management en Masse Design. PEM is designed for enterprise database management, and is built to tackle the management of large numbers of servers across geographical boundaries. Global dashboards keep you up to date on the up/down/performance status of all your servers in an at-a-glance fashion.
• Distributed Architecture. PEM is architected in a way that maximizes its ability to gather statistical information and to perform operations remotely on machines regardless of operating system platform.
• Graphical Administration. All aspects of database administration can be carried out in the PEM client via a graphical interface. Server startup and shutdown, configuration management, storage and security control, object creation, performance management, and more can be handled from a single console.
• Full SQL IDE. PEM contains a robust SQL integrated development environment (IDE) that provides ad-hoc SQL querying, stored procedure/function development, and a graphical debugger.
• Enterprise Performance Monitoring. PEM provides enterprise-class performance monitoring for all managed database servers. Lightweight and efficient agents monitor all aspects of each database server’s operations as well as each machine’s underlying operating system and provide detailed statistics back to easily navigated performance pages within the interface.
• Proactive Alert Management. PEM ships out-of-the-box with the ability to create performance thresholds for each key metric (e.g. memory, storage, etc.) that are monitored around-the-clock. Any threshold violation results in an alert being sent to a centralized dashboard that communicates the nature of the problem and what actions are necessary to prevent the situation from jeopardizing the overall performance of the server.
• Simplified Capacity Planning. All key performance-related statistics are automatically collected and retained for a specified period of time in PEM’s repository. The Capacity Manager utility allows you to select various statistics and perform trend analysis over time to understand things such as peak load periods, storage consumption trends, and much more. A forecasting mechanism in the tool allows you to also forecast resource usage in the future and plan/budget accordingly.
• Audit Manager. The Audit Manager configures audit logging on Advanced Server instances. Activities such as connections to a database, disconnections from a database, and the SQL statements run against a database can be logged. The Audit Log dashboard can then be used to filter and view the log.
• Log Manager. The Log Manager wizard configures server logging parameters, with (optional) log collection into a central table. Use the wizard to specify your preference for logging behaviors such as log file rotation, log destination and error message severity. Use the Server Log dashboard to filter and review the collected server log entries.
• SQL Workload Profiling. PEM contains a SQL profiling utility that allows you to trace the SQL statements that are executed against one or more servers. SQL profiling can either be done in an ad-hoc or scheduled manner. Captured SQL statements can then be filtered so you can easily identify and tune poorly running SQL statements. SQL statements can also be fed into an Index Advisor on Advanced Server that analyzes each statement and makes recommendations on new indexes that should be created to help performance.
• Expert Database Analysis. PEM includes the Postgres Expert utility. Postgres Expert analyzes selected databases for best practice enforcement purposes. Areas such as general configuration, security setup, and much more are examined. Any deviations from recommended best practices are reported back to you, along with an explanation of each particular issue, and expert help on what to do about making things right.
• Streaming Replication Configuration and Monitoring. The Streaming Replication wizard simplifies the process of adding new servers to a Postgres streaming replication scenario or configuring existing servers to create a replication scenario. After configuring the replication scenario, you can monitor the scenario on the Streaming Replication dashboard or use options on the PEM client to promote a standby node to the master node.
• Secure Client Connectivity. PEM supports secure client connections through an encrypted SSH tunnel. The full-featured PEM client includes an SSH Tunnel definition dialog that allows you to provide connection information for a secure connection.
• Wide Platform Support. PEM supports most major Linux and Windows platforms.
Figure 2.1 - The Postgres Enterprise Manager general architecture.
•
1. Install the PEM server components. The PEM server software and backend database (named pem) may reside on the same host as the supporting httpd server, or may reside on a separate host.
Where ip_address_of_PEM_host specifies the IP address of the host of the PEM server. The Postgres Enterprise Manager Login window (shown in Figure 3.1) opens:Use the fields on the Postgres Enterprise Manager Login window to authenticate yourself with the PEM server:
• Provide the name of a pem database user in the Username field. For the first user connecting, this will be the name provided when installing the PEM server.
• Provide the password associated with the user in the Password field.After providing your credentials, click Login to connect to PEM.The Browser pane displays a tree control that provides access to information about the database objects that reside on each server. The tree control expands to display a hierarchical view of the servers and objects that are monitored by the PEM server.
3.1 The PEM ToolbarUse the File menu (see Figure 3.3) to access the following options:
The Object menu (see Figure 3.4) is context-sensitive. Use the Object menu to access the following options:
Click to hide the currently selected group; to view hidden groups, enable the Show hidden groups option in Preferences. Use the Management menu (see Figure 3.5) to access the following PEM features:
Use the context-sensitive Dashboards menu (see Figure 3.6) to access dashboards:
Use the options on the Tools menu (see Figure 3.7) to access the following features:
Use the options on the Help menu (see Figure 3.8) to access online help documents or to review information about the PEM installation:
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… (see Figure 4.1).Please 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.Use the fields on the General tab (shown in Figure 4.2) to describe the general properties of the server:
• Use the Name field to specify a user-friendly name for the server. The name specified will identify the server in the PEM Browser tree 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 Group drop-down listbox to select the server group in which the new server will be displayed.
• Use the Team field 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 Background color 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 Foreground color 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. Leave Connect 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 Comments field.Use fields on the Connection tab (shown in Figure 4.3) 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/address field. 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 Port field.
• Use the Maintenance database field to specify the name of the initial database that PEM will connect to, and that will be expected to contain pgAgent schema and adminpack objects installed (both optional). On PostgreSQL 8.1 and above, the maintenance DB is normally called postgres; on earlier versions template1 is often used, though it is preferrable to create a postgres database to avoid cluttering the template database.
• Provide the password associated with the specified user in the Password field.
• Check the box next to Save password? to instruct PEM to store passwords in the ~/.pgpass file (on Linux) or %APPDATA%\\postgresql\\pgpass.conf (on Windows) for later reuse. For details, see the pgpass documentation. 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 Role field 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.Use the fields on the SSL tab (see Figure 4.4) to configure SSL:
• Use the drop-down list box in the SSL mode field to select the type of SSL connection the server should use. For more information about using SSL encryption, see the PostgreSQL documentation at: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 certificate field to specify the file containing the client SSL certificate. This file will replace the default ~/.postgresql/postgresql.crt file if PEM is installed in Desktop mode, and <STORAGE_DIR>/<USERNAME>/.postgresql/postgresql.crt if PEM is installed in Web mode. This parameter is ignored if an SSL connection is not made.
• Use the Client certificate key field to specify the file containing the secret key used for the client certificate. This file will replace the default ~/.postgresql/postgresql.key if PEM is installed in Desktop mode, and <STORAGE_DIR>/<USERNAME>/.postgresql/postgresql.key if PEM is installed in Web mode. This parameter is ignored if an SSL connection is not made.
• Use the Root certificate field to specify the file containing the SSL certificate authority. This file will replace the default ~/.postgresql/root.crt file. This parameter is ignored if an SSL connection is not made.
• Use the Certificate revocation list field 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 is False (compression is disabled). This parameter is ignored if an SSL connection is not made.Use the fields on the SSH Tunnel tab (see Figure 4.5) 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 tunneling to Yes to specify that PEM should use an SSH tunnel when connecting to the specified server.
•
•
•
•
• Select Password to specify that PEM will use a password for authentication to the SSH host. This is the default.
•
• If the SSH host is expecting a private key file for authentication, use the Identity file field to specify the location of the key file.
• If the SSH host is expecting a password, use the Password field to specify the password, or if an identity file is being used, the passphrase.Use fields on the Advanced tab (shown in Figure 4.6) to specify details that are used to manage the server:
•
• Use the DB restriction field 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 the live_db and test_db databases. 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 file field to specify the location of a password file (.pgpass). The .pgpass file allows a user to login without providing a password when they connect. For more information, see the Postgres documentation at:
• Use the Service ID field 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 is edb-as-10. For local servers, the setting is operating system dependent:
o 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 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 name field 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 named efm.properties, the cluster name is efm.
• If you are using PEM to monitor the status of a Failover Manager cluster, use the EFM installation path field 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.Use fields on the PEM Agent tab (shown in Figure 4.7) to specify connection details for the PEM agent:
• Move the Remote monitoring? slider to Yes to 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 agent label. 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 Host field. By default, the agent will use the host address shown on the General tab. On a Unix server, you may wish to specify a socket path, e.g. /tmp.
• Enter the Port number that the agent will use when connecting to the server. By default, the agent will use the port defined on the Properties tab.
• Use the drop-down listbox in the SSL field 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 Database field to specify the name of the database to which the agent will initially connect.
•
• Specify the password that the agent should use when connecting to the server in the Password field, and verify it by typing it again in the Confirm password field. If you do not specify a password, you will need to configure the authentication for the agent manually; for example, you can use a .pgpass file.
• Set the Allow takeover? slider to Yes to 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.
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 (see Figure 4.8), highlight the name of a PEM agent in the PEM client tree control, and select Auto Discovery... from the Management menu.When the Auto Discovery dialog opens, the Discovered Database Servers box will display a list of servers that are not currently 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 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 Name field. The specified name will be displayed in the tree control of the PEM client.
• Use the Server group drop-down listbox to select the server group under which the server will be displayed in the PEM client tree control.
•
• The Port field displays the port that is monitored by the server; this field may not be modified.
• Provide the name of the service in the Service ID field. Please note that the service name must be provided to enable some PEM functionality.
• By default, the Maintenance database field indicates that the selected server uses a postgres maintenance database. Customize the content of the Maintenance database field 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 Host field displays the IP address that will be used for the PEM agent binding.
• The User name field displays the name that will be used by the PEM agent when connecting to the selected server.
• The Password field displays the password associated with the specified user name.
• 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.After clicking the OK button, the newly registered server is displayed in the PEM tree control (see Figure 4.9) and is monitored by the PEM server.
When registering a database server, you must provide the password associated with the administrative user on the new server. Use the PEM_NEW_SERVER_PASSWORD environment variable to provide the associated password.
•
• provide the password on the command line with the PGPASSWORD keyword.
• create an entry in the .pgpass file.
When invoking the pemworker utility, you must provide the password associated with the PEM server administrative user. There are three ways to specify the password of the administrative user; you can:
•
• provide the password on the command line with the PGPASSWORD keyword.
• create an entry in the .pgpass file.
Once registered, the new server will be added to the PEM Browser tree control, and be displayed on the Global Overview (see Figure 4.10).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.
PEM allows you to startup and shutdown managed server instances with the PEM client. To configure a server to allow PEM to manage the service, complete the Server registration dialog, registering the database server with a PEM agent and:
•
•
o For Advanced Server 10, the service name is edb-as-10.
o For Advanced Server 9.6, the service name is edb-as-9.6.
o For PostgreSQL 10, the service name is postgresql-10.
o After connecting to the server, you can start or stop the server by highlighting the server name in the tree control, and selecting Queue Server Startup or Queue Server Shutdown (shown in Figure 4.11) from the Management menu.
You can use the PEM client to graphically manage the configuration parameters of the PEM server to enable features or modify default settings. To open the Server Configuration dialog (see Figure 5.1), select Server Configuration… from the Management menu.To modify a parameter value, edit the content displayed in the Value field to the right of a parameter name. Click the Save button to preserve your changes, or click the Close button to exit the dialog without applying the changes. Use the Reset button to return the parameters to their original value.
The Windows operating system includes a graphical service controller that displays the server status, and offers point-and-click server control. The Services utility can be accessed through the Windows Control Panel. When the utility opens, use the scroll bar to navigate through the listed services to highlight the service name (see Figure 5.2).
5.3 Managing Security5.3.1 Login RolesWhen you connect to the PEM server, you must provide role credentials that allow access to the database on which the PEM server stores data. By default, the postgres superuser account is used to initially connect to the server, but it is strongly recommended (for both security and auditing purposes) that individual roles are created for each connecting user. You can use the PEM Query Tool, the PEM web interface Create – Login/Group Role dialog, or a command line client (such as psql) to create a role.To use the Create – Login/Group Role dialog to create a role, expand the node for the server on which the role will reside in the PEM tree control, and right-click on the Login/Group Roles node to access the context menu. Then, select Login/Group Role… from the Create menu (see Figure 5.3).Use fields on the tabs of the Create – Login/Group Role dialog (see Figure 5.4) to define the role. To display the PEM online help in a browser tab, click the help (?) button located in the lower-left corner of the dialog.When you've finished defining the new role, click Save to create the role.To modify the properties of an existing login role, right click on the name of a login role in the tree control, and select Properties from the context menu. To delete a login role, right click on the name of the role, and select Delete/Drop from the context menu.5.3.2 Group RolesUse the Group Roles node (located beneath the name of each registered server in the PEM tree control) to create and manage group roles. Options on the context menu provide access to a dialog that allows you to create a new role or modify the properties of an existing role. You can find more information about creating roles at:You can use the Login/Group Role dialog to allow a role with limited privileges to access PEM features such as the Audit Manager, Capacity Manager, or SQL Profiler. PEM pre-defined roles allow access to PEM functionality; roles that are assigned membership in these roles can access the associated feature.When defining a user, use the Membership tab to specify the roles in which the new user is a member. The new user will share the privileges associated with each role in which it is a member. For a user to have access to PEM extended functionality, the role must be a member of the pem_user role and the pre-defined role that grants access to the feature. Use the Roles field to select pre-defined role names from a drop down list.The example shown above creates a login role named acctg_clerk that will have access to the Audit Manager; the role can make unlimited connections to the server at any given time.
5.3.4 Using a Team RoleWhen you register a server for monitoring by PEM, you can specify a Team that will be associated with the server. A Team is a group role that can be used to allow or restrict access to one or more monitored servers to a limited group of role members. The PEM client will only display a server with a specified Team to those users who are:To create a team role, expand the node for the server on which the role will reside in the PEM tree control, and right-click on the Login/Group Roles node to access the context menu. Then, select Login/Group Role… from the Create menu; when the Create - Login/Group Role dialog opens, use the fields provided to specify the properties of the team role.5.3.5 Object PermissionsA role must be granted sufficient privileges before accessing, executing, or creating any database object. PEM allows you to assign (GRANT) and remove (REVOKE) object permissions to group roles or login accounts using the graphical interface of the PEM client.Object permissions are managed via the graphical object editor for each particular object. For example, to assign privileges to access a database table, right click on the table name in the tree control, and select the Properties option from the context menu. Use the options displayed on the Privileges tab to assign privileges for the table.The PEM client also contains a Grant Wizard (accessed through the Tools menu) that allows you to manage many object permissions at once.
Creating a database is easy in PEM: simply right click on any managed server’s Databases node and select Database… from the Create menu. After defining a database, you can create objects within the new database.For example, to create a new table, right click on a Tables node, select Table… from the Create menu. When the New Table dialog opens, specify the attributes of the new table (see Figure 5.7).
•
•
•
• Each object type is displayed in the tree control; right click on the node that corresponds to an object type to access the Create menu and create a new object, or select Properties from the context menu of a named node to perform administrative tasks for the highlighted object.
PEM contains built-in help that provides assistance in using the tool (see Figure 5.8). To access the online help for PEM, select Online Help from the Help option on the Help menu.The Help menu also allows quick access to the EnterpriseDB website.
The sections that follow provide information about modifying the pg_hba.conf file, restarting the PEM server, and controlling the HTTPD service on Linux and Windows.
• A PEM server on Advanced Server 10 is edb-as-10.
• A PEM server on Advanced Server 9.6 is edb-as-9.6.
•
• A PEM server on PostgreSQL 10 is postgresql-10
•
• A PEM agent is pemagent.service_name is the name of the service.action specifies the action taken by the service. Specify:
• start to start the service.
• stop to stop the service.
• restart to stop and then start the service.
• status to check the status of the service.
•
•
• a PEM agent is Postgres Enterprise Manager - pemAgentWhere x indicates the server version number.Navigate through the Windows Control Panel to open the Services utility. When the utility opens, use the scroll bar to browse the list of services (see Figure 6.1).Use the Stop the service option to stop a service. Any user (or client application) connected to the server will be abruptly disconnected if you stop the service.Use the Pause the service option to instruct Postgres to reload a service's configuration parameters. The Pause the service option is an effective way to reset parameters without disrupting user sessions for many of the configuration parameters.Use the Start the service option to start a service.
If Linux responds with an answer that is similar to the following example, httpd is not running:On Windows, you can use the Services applet to check the status of the PEM HTTPD service. After opening the Services applet, scroll through the list to locate the PEM HTTPD service (see Figure 6.2).The Status column displays the current state of the server. Click the Start link to start PEM HTTPD if the service is not running.
Entries in the pg_hba.conf file control network authentication and authorization. The pg_hba.conf file on the PEM server host must allow connections between the PEM server and PEM-HTTPD, the PEM agent, and the monitored servers.During the PEM server installation process, you are prompted for the IP address and connection information for hosts that will be monitored by PEM; this information is added to the top of the pg_hba.conf file of the PEM backing database (see Figure 6.3).You may also need to manually modify the pg_hba.conf file to allow connections between the PEM server and other components. For example, if your PEM-HTTPD installation does not reside on the same host as the PEM server, you must modify the pg_hba.conf file on the PEM server host to allowPEM-HTTPD to connect to the server.By default, the pg_hba.conf file resides in the data directory, under your Postgres installation; for example, on an Advanced Server 10 host, the default location of the pg_hba.conf is:You can modify the pg_hba.conf file with your editor of choice. After modifying the file, restart the server for changes to take effect.The following example shows a pg_hba.conf entry that allows an md5 password authenticated connection from a user named postgres, to the postgres database on the host on which the pg_hba.conf file resides. The connection is coming from an IP address of 192.168.10.102:You may specify the address of a network host, or a network address range. For example, if you wish to allow connections from servers with the addresses 192.168.10.23, 192.168.10.76 and 192.168.10.184, enter a CIDR-ADDRESS of 192.168.10.0/24 to allow connections from all of the hosts in that network:For more information about formatting a pg_hba.conf file entry, please see the PostgreSQL core documentation at:Before you can connect to a Postgres server with PEM, you must ensure that the pg_hba.conf file on both servers allows the connection (see Figure 6.4).If you receive this error when connecting to the database server, modify the pg_hba.conf file, adding an entry that allows the connection.
•
•
•
•
•
•
• Postgres (and PEM) authentication is controlled by the pg_hba.conf configuration file. Entries within the configuration file specify who may connect to a specific database, and the type of authentication required before that user is allowed to connect.A typical entry in the pg_hba.conf file that allows a user named postgres to connect to all databases from the local host (127.0.0.1/32) using secure password (md5) authentication connections would take the form:Depending on your system's configuration, you may also need to create a password file for the user account that the PEM agent uses to connect to the server, to allow the agent to properly respond to the server’s authentication request. An entry in the password file for a user named postgres, with a password of 1safepwd would take the form:The password file is usually named ~root/.pgpass on Linux systems, or %APPDATA%\postgresql\pgpass.conf (on Windows). For more information about configuring a password file, visit the EnterpriseDB website at:
• updating the package_catalog table with information about the packages that are available for installation or updateTo access the Server Configuration dialog and modify the server configuration, connect to the PEM web interface, and select Server Configuration… from the Management menu. The PEM Server Configuration dialog opens as shown in Figure 6.6.To modify a parameter value, locate the parameter, and modify the parameter value in the Value column. Use the following PEM Server configuration parameters to specify connection details that allow PEM to connect to the proxy server:
•
• Specify a value of t in the proxy_server_authentication parameter to indicate that the proxy server will require PEM to authenticate when connecting; specify f if authentication is not required.
• Specify a value of t in the proxy_server_enabled parameter if PEM is required to use a proxy server when retrieving the package list, or f if a proxy server is not configured.
• Use the proxy_server_password parameter to provide the password associated with the user specified in proxy_server_username.
•
• Specify the user name that should be used when authenticating with the proxy server in the proxy_server_username parameter.When you've finished updating the parameters required to configure the proxy server, click the Save icon in the upper-right corner of the dialog before closing the dialog.
•
•
By default, the PEM agent is installed with root privileges for the operating system host and superuser privileges for the database server. These privileges allow the PEM agent to invoke unrestricted probes on the monitored host and database server about system usage, retrieving and returning the information to the PEM server.Please note that PEM functionality diminishes as the privileges of the PEM agent decrease. For complete functionality, the PEM agent should run as root. If the PEM agent is run under the database server's service account, PEM probes will not have complete access to the statistical information used to generate reports, and functionality will be limited to the capabilities of that account. If the PEM agent is run under another lesser-privileged account, functionality will be limited even further.
If the probe is querying the operating system with insufficient privileges, the probe may return a permission denied error.If the probe is querying the database with insufficient privileges, the probe may return a permission denied error or display the returned data in a PEM chart or graph as an empty value.
With the exception of the PEM_MAXCONN parameter, we strongly recommend against modifying any of the configuration parameters or registry entries listed below without first consulting EnterpriseDB support experts unless the modifications are required to enable PEM functionality.
• On 64 bit Windows systems, PEM registry entries are located in HKEY_LOCAL_MACHINE\\Software\\Wow6432Node\\EnterpriseDB\\PEM\\agent
• On Linux systems, PEM configuration options are stored in the agent.cfg file, located in /opt/edb/pem/agent/etc
The PEM Agent Properties dialog provides information about the PEM agent from which the dialog was opened; to open the dialog, right-click on an agent name in the PEM client tree control, and select Properties from the context menu.
• The Description field displays a modifiable description of the PEM agent. This description is displayed in the tree control of the PEM client.
• You can use groups to organize your servers and agents in the PEM client tree control. Use the Group drop-down listbox to select the group in which the agent will be displayed.
• Use the Team field to specify the name of the group role that should be able to access servers monitored by the agent; the servers monitored by this agent will be displayed in the PEM client tree control to connected team members. Please note that this is a convenience feature. The Team field does not provide true isolation, and should not be used for security purposes.
• The Heartbeat interval fields display the length of time that will elapse between reports from the PEM agent to the PEM server. Use the selectors next to the Minutes or Seconds fields to modify the interval.
On a Windows host, you can use the Services applet to stop the PEM agent. The PEM agent service is named Postgres Enterprise Manager Agent; highlight the service name in the Services dialog, and click Stop the service.
2. Take a backup of the existing SSL keys and certificates. The SSL keys and certificates are stored in the /data directory under your PEM installation. For example, the default location on a Linux system is:
3. After creating the ca_key.key file, cat the contents to the variable CA_KEY for use when generating the ca_certificate.crt file and modify the privileges on the ca_key.key file.
4. Use the key to generate the ca_certificate.crt file. For simplicity, place the SQL query into a temporary file with a unique name:Then use the variable to execute the query, placing the content into the ca_certificate.crt file.Modify the permissions of the ca_certificate.crt file, and remove the temporary file that contained the SQL command:
5. Modify the permissions of the root.crt file:
6. Modify the permissions of the root.crl file:
7. After creating the server.key file, cat the contents to the variable SSL_KEY for use when generating the server.crt file and modify the privileges on the server.key file.
8. Use the SSL_KEY to generate the server certificate. Save the certificate in the server.crt file. For simplicity, place the SQL query into a temporary file with a unique name:Then, generate the server.crt file:Modify the privileges on the server.crt file, and delete the temporary file:
Each agent has a unique identifier that is stored in the pem.agent table in the pem database. You must replace the key and certificate files with the key or certificate that corresponds to the agent's identifier. Please note that you must move the agent.key and agent.crt files (generated in Steps 2 and 3 into place on their respective PEM agent host before generating the next key file pair; subsequent commands will overwrite the previously generated file.
1. Use psql to find the number of agents and their corresponding identifiers:On Linux, you can also find the agent identifier and location of the keys and certificates in the PEM/agent section of the /etc/postgres-reg.ini file.
2. After identifying the agents that will need key files, generate an agent.key for each agent. To generate the key, execute the following command, capturing the output in a file:Modify the privileges of the agent.key file./opt/PostgreSQL/10/bin/psql -U postgres -d pem --no-psqlrc -t -A -c "SELECT openssl_csr_to_crt(openssl_rsa_key_to_csr('$(cat agent.key)', 'agent$ID', 'US', 'MA', 'Bedford', 'Postgres Enterprise Manager', 'support@enterprisedb.com'), '/opt/PostgreSQL/10/data/ca_certificate.crt', '/opt/PostgreSQL/10/data/ca_key.key')" > agent.crtModify the privileges of the agent.crt file:On a Windows host, you can use the Services applet to start the PEM agent. The PEM agent service is named Postgres Enterprise Manager Agent; highlight the service name in the Services dialog, and click Start the service.