2.2.3 Registering a PEM AgentThe PEM agent is responsible for executing tasks and reporting statistics from a monitored Postgres instance to the PEM server. The PEM agent is installed by the pem-agent RPM. By default, all engine configurations shipped with the Ark console include the PEM agent.After installing the PEM agent, the agent must be registered on each node that will be monitored by the PEM server. The steps that follow detail registering the PEM agent with the server, and configuring the server to monitor the agent.
• modify the pg_hba.conf file on the node hosting the PEM server to allow connections from any monitored node.
• modify the pg_hba.conf file on any monitored node, allowing connections from the PEM server.The steps that follow provide detailed information about each configuration step. The steps assume that you have installed and configured a PEM server; for information about using PEM, please visit the EDB website at:Please note: when a cluster node is stopped (for example, when scaling down), or if a cluster is deleted, the Monitoring tab of the PEM web interface will alert you that the agent on that node is down.If the cluster has been deleted (and the agent will not resume monitoring), you can use the PEM Browser tree control to remove the agent definition from the PEM server. Expand the PEM Agents node of the tree control, and right-click on the name of the deleted agent; then, select Delete/Drop from the context menu.Navigate to the Clusters tab, and create a new cluster that is provisioned using an engine definition that includes the pem-agent RPM package in the list of required RPM packages. For detailed information about creating a new server cluster, please see the EDB Ark Getting Started Guide, available through the EDB Ark Dashboard tab.The PEM server consists of an instance of PostgreSQL, an associated PostgreSQL database for storage of monitoring data, and a server that provides web services for the PEM web interface. The PEM server may reside on a host outside of a monitored EDB Ark cluster, or on the master node of an Ark cluster.Before a PEM agent that resides on an Ark cluster can communicate with the PEM server, you must modify the pg_hba.conf file (see Figure 4.24) of the PostgreSQL database that stores PEM statistics to allow connections from any monitored servers as well as the PEM client.With your choice of editor, modify the pg_hba.conf file of the PEM Server backing database, adding entries for the IP address of the EDB Ark cluster. The connection properties should allow connections that use cert and md5 authentication.For detailed information about modifying the pg_hba.conf file, please see the PostgreSQL documentation, available from the EnterpriseDB website at:After modifying the pg_hba.conf file for the PostgreSQL installation that stores statistical information for PEM, you must restart the PEM backing database server to apply the changes. The name of the PEM service is:Where x specifies the version. For example:Use the Download SSH Key icon on the Clusters tab to download the SSH key for your cluster. When you download the key, a popup will open, informing you of the steps required to connect to the master node of your cluster (see Figure 4.25).Open a terminal window, modify the permissions on the downloaded file, and use the command shown on the popup to establish a connection with the server.Use your choice of editor to modify the pg_hba.conf file on the Ark node. By default, the pg_hba.conf file is located in /var/lib/ppas/9.5/data.Add entries to the pg_hba.conf file that allow connections from the PEM server (see Figure 4.26).After modifying the pg_hba.conf file, you must restart the server to apply the changes. The name of the service is Arkdb. Use the platform and version specific command for your cluster to restart the Arkdb service.You must register each PEM agent that resides in an Ark cluster with the PEM server. Using the SSH connection to the cluster node on which the agent resides, navigate into the directory that contains the PEM agent installation:PGPASSWORD=password ./pemagent --register-agent --pem-server x.x.x.x --pem-port port --pem-user user_namex.x.x.x specifies the IP address of the PEM server.port specifies the port on which the server is listening for connectionsuser_name specifies the name of the PEM user.After registering the agent, use the following command to ensure that the service is configured to restart when if the node restarts, and that the pemagent service is running:For more information about Postgres Enterprise Manager, and to download PEM documentation, please visit the EnterpriseDB website at: