Instalar y configurar agente de EDB PEM para monitorear un motor EDB Postgresql

Categorías:

Vamos a instalar el agente PEM para monitorear EDB Postgresql en otro servidor.  Ejecutamos el comando dnf -y install edb-pem-agent

[root@rocky88 ~]# dnf -y install edb-pem-agent
enterprisedb-enterprise                                                                                                                            567  B/s | 659  B     00:01    
enterprisedb-enterprise                                                                                                                            2.3 MB/s | 8.7 MB     00:03    
enterprisedb-enterprise-noarch                                                                                                                     763  B/s | 659  B     00:00    
enterprisedb-enterprise-source                                                                                                                     676  B/s | 659  B     00:00    
enterprisedb-enterprise-source                                                                                                                     8.7 kB/s |  13 kB     00:01    
Dependencies resolved.
===================================================================================================================================================================================
 Package                                           Architecture                    Version                                  Repository                                        Size
===================================================================================================================================================================================
Installing:
 edb-pem-agent                                     x86_64                          9.2.0-1.el8                              enterprisedb-enterprise                          924 k
Installing dependencies:
 boost169-atomic                                   x86_64                          1.69.0-5.el8                             epel                                              12 k
 boost169-chrono                                   x86_64                          1.69.0-5.el8                             epel                                              25 k
 boost169-date-time                                x86_64                          1.69.0-5.el8                             epel                                              28 k
 boost169-filesystem                               x86_64                          1.69.0-5.el8                             epel                                              50 k
 boost169-program-options                          x86_64                          1.69.0-5.el8                             epel                                             149 k
 boost169-regex                                    x86_64                          1.69.0-5.el8                             epel                                             271 k
 boost169-system                                   x86_64                          1.69.0-5.el8                             epel                                              12 k
 boost169-thread                                   x86_64                          1.69.0-5.el8                             epel                                              58 k
 edb-as15-server-libs                              x86_64                          15.3.0-1.el8                             enterprisedb-enterprise                          666 k
 libcurl-pem                                       x86_64                          7.71.1-1.rhel8                           enterprisedb-enterprise                          701 k
 snmp++                                            x86_64                          3.4.2-1.rhel8                            enterprisedb-enterprise                          1.1 M

Transaction Summary
===================================================================================================================================================================================
Install  12 Packages

Total download size: 3.9 M
Installed size: 14 M
Downloading Packages:
(1/12): edb-as15-server-libs-15.3.0-1.el8.x86_64.rpm                                                                                               466 kB/s | 666 kB     00:01    
(2/12): edb-pem-agent-9.2.0-1.el8.x86_64.rpm                                                                                                       627 kB/s | 924 kB     00:01    
(3/12): libcurl-pem-7.71.1-1.rhel8.x86_64.rpm                                                                                                      460 kB/s | 701 kB     00:01    
(4/12): boost169-atomic-1.69.0-5.el8.x86_64.rpm                                                                                                     47 kB/s |  12 kB     00:00    
(5/12): boost169-chrono-1.69.0-5.el8.x86_64.rpm                                                                                                     88 kB/s |  25 kB     00:00    
(6/12): boost169-date-time-1.69.0-5.el8.x86_64.rpm                                                                                                  81 kB/s |  28 kB     00:00    
(7/12): boost169-filesystem-1.69.0-5.el8.x86_64.rpm                                                                                                 84 kB/s |  50 kB     00:00    
(8/12): boost169-program-options-1.69.0-5.el8.x86_64.rpm                                                                                           148 kB/s | 149 kB     00:01    
(9/12): snmp++-3.4.2-1.rhel8.x86_64.rpm                                                                                                            634 kB/s | 1.1 MB     00:01    
(10/12): boost169-regex-1.69.0-5.el8.x86_64.rpm                                                                                                    322 kB/s | 271 kB     00:00    
(11/12): boost169-system-1.69.0-5.el8.x86_64.rpm                                                                                                    61 kB/s |  12 kB     00:00    
(12/12): boost169-thread-1.69.0-5.el8.x86_64.rpm                                                                                                   341 kB/s |  58 kB     00:00    
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Total                                                                                                                                              987 kB/s | 3.9 MB     00:04     
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
  Running scriptlet: edb-pem-agent-9.2.0-1.el8.x86_64                                                                                                                          1/1 
  Preparing        :                                                                                                                                                           1/1 
  Installing       : boost169-system-1.69.0-5.el8.x86_64                                                                                                                      1/12 
  Running scriptlet: boost169-system-1.69.0-5.el8.x86_64                                                                                                                      1/12 
  Installing       : boost169-chrono-1.69.0-5.el8.x86_64                                                                                                                      2/12 
  Running scriptlet: boost169-chrono-1.69.0-5.el8.x86_64                                                                                                                      2/12 
  Installing       : boost169-filesystem-1.69.0-5.el8.x86_64                                                                                                                  3/12 
  Running scriptlet: boost169-filesystem-1.69.0-5.el8.x86_64                                                                                                                  3/12 
  Installing       : boost169-thread-1.69.0-5.el8.x86_64                                                                                                                      4/12 
  Running scriptlet: boost169-thread-1.69.0-5.el8.x86_64                                                                                                                      4/12 
  Installing       : boost169-regex-1.69.0-5.el8.x86_64                                                                                                                       5/12 
  Running scriptlet: boost169-regex-1.69.0-5.el8.x86_64                                                                                                                       5/12 
  Installing       : boost169-program-options-1.69.0-5.el8.x86_64                                                                                                             6/12 
  Running scriptlet: boost169-program-options-1.69.0-5.el8.x86_64                                                                                                             6/12 
  Installing       : boost169-date-time-1.69.0-5.el8.x86_64                                                                                                                   7/12 
  Running scriptlet: boost169-date-time-1.69.0-5.el8.x86_64                                                                                                                   7/12 
  Installing       : boost169-atomic-1.69.0-5.el8.x86_64                                                                                                                      8/12 
  Running scriptlet: boost169-atomic-1.69.0-5.el8.x86_64                                                                                                                      8/12 
  Installing       : snmp++-3.4.2-1.rhel8.x86_64                                                                                                                              9/12 
  Installing       : libcurl-pem-7.71.1-1.rhel8.x86_64                                                                                                                       10/12 
  Installing       : edb-as15-server-libs-15.3.0-1.el8.x86_64                                                                                                                11/12 
  Running scriptlet: edb-as15-server-libs-15.3.0-1.el8.x86_64                                                                                                                11/12 
  Running scriptlet: edb-pem-agent-9.2.0-1.el8.x86_64                                                                                                                        12/12 
  Installing       : edb-pem-agent-9.2.0-1.el8.x86_64                                                                                                                        12/12 
  Running scriptlet: edb-pem-agent-9.2.0-1.el8.x86_64                                                                                                                        12/12 
  Verifying        : edb-as15-server-libs-15.3.0-1.el8.x86_64                                                                                                                 1/12 
  Verifying        : edb-pem-agent-9.2.0-1.el8.x86_64                                                                                                                         2/12 
  Verifying        : libcurl-pem-7.71.1-1.rhel8.x86_64                                                                                                                        3/12 
  Verifying        : snmp++-3.4.2-1.rhel8.x86_64                                                                                                                              4/12 
  Verifying        : boost169-atomic-1.69.0-5.el8.x86_64                                                                                                                      5/12 
  Verifying        : boost169-chrono-1.69.0-5.el8.x86_64                                                                                                                      6/12 
  Verifying        : boost169-date-time-1.69.0-5.el8.x86_64                                                                                                                   7/12 
  Verifying        : boost169-filesystem-1.69.0-5.el8.x86_64                                                                                                                  8/12 
  Verifying        : boost169-program-options-1.69.0-5.el8.x86_64                                                                                                             9/12 
  Verifying        : boost169-regex-1.69.0-5.el8.x86_64                                                                                                                      10/12 
  Verifying        : boost169-system-1.69.0-5.el8.x86_64                                                                                                                     11/12 
  Verifying        : boost169-thread-1.69.0-5.el8.x86_64                                                                                                                     12/12 

Installed:
  boost169-atomic-1.69.0-5.el8.x86_64              boost169-chrono-1.69.0-5.el8.x86_64     boost169-date-time-1.69.0-5.el8.x86_64     boost169-filesystem-1.69.0-5.el8.x86_64    
  boost169-program-options-1.69.0-5.el8.x86_64     boost169-regex-1.69.0-5.el8.x86_64      boost169-system-1.69.0-5.el8.x86_64        boost169-thread-1.69.0-5.el8.x86_64        
  edb-as15-server-libs-15.3.0-1.el8.x86_64         edb-pem-agent-9.2.0-1.el8.x86_64        libcurl-pem-7.71.1-1.rhel8.x86_64          snmp++-3.4.2-1.rhel8.x86_64                

Complete!
[root@rocky88 ~]#

Una vez instalado, registramos nuestro servidor de base de datos en el PEM con la siguiente orden

[root@rocky88 ~]# export PEM_SERVER_PASSWORD=admin123
[root@rocky88 ~]# echo $PEM_MONITORED_SERVER_PASSWORD
admin123
[root@rocky88 ~]# /usr/edb/pem/agent/bin/pemworker --register-agent --pem-server 192.168.30.3 --pem-user enterprisedb --pem-port 5444 --display-name rocky88 -o agent_id=2
Postgres Enterprise Manager Agent registered successfully!

[root@rocky88 ~]#

Como se puede observar, de debe definir una variable de ambiente que contenga la clave del usuario administrador del PEM, en mi caso el usuario es enterprisedb y la clave de ese usuario es admin123

Una vez registrado obtenemos el mensaje de registro exitoso.

Arrancamos el servicio agent en nuestro servidor monitoreado

[root@rocky88 ~]# systemctl start pemagent
[root@rocky88 ~]#

Verificamos el estado del servicio recién iniciado…

[root@rocky88 ~]# systemctl status pemagent
● pemagent.service - Postgres Enterprise Manager Agent
   Loaded: loaded (/usr/lib/systemd/system/pemagent.service; disabled; vendor preset: disabled)
   Active: active (running) since Tue 2023-05-23 12:35:58 -05; 1s ago
  Process: 1955 ExecStart=/usr/edb/pem/agent/bin/pemagent -c /usr/edb/pem/agent/etc/agent.cfg (code=exited, status=0/SUCCESS)
 Main PID: 1956 (pemagent)
    Tasks: 5 (limit: 23208)
   Memory: 3.7M
   CGroup: /system.slice/pemagent.service
           ├─1956 /usr/edb/pem/agent/bin/pemagent -c /usr/edb/pem/agent/etc/agent.cfg
           ├─1957 /usr/edb/pem/agent/bin/pemworker -c /usr/edb/pem/agent/etc/agent.cfg --pid 1956
           └─1989 systemctl status edb-as-12.service

May 23 12:35:58 rocky88.unixpad.local systemd[1]: Starting Postgres Enterprise Manager Agent...
May 23 12:35:58 rocky88.unixpad.local systemd[1]: Started Postgres Enterprise Manager Agent.
[root@rocky88 ~]#

Por el momento es todo, deberíamos estar visualizando nuestro servidor en el dashboard del PEM, en mi caso el agente se llama rocky88