If you followed the first, second and the third post the current ppas infrastructure consists of a primary database, a hot standby database and a backup and recovery server.
Now we will add the monitoring server on another host so that the system overview looks like this:
server | ip address | purpose |
ppas | 192.168.56.243 | ppas database cluster |
ppasstandby | 192.168.56.244 | ppas hot standby database |
ppasbart | 192.168.56.245 | backup and recovery server |
ppasem | 192.168.56.246 | ppas enterprise manager |
On the ppasem host we will now install postgres enterprise manager to monitor our postgres infrastructure. As with ppas you’ll need to install java before you start:
yum install java And as with the installer for ppas there are several ways to get pem installed on the system:
[root@ppaspem tmp]# chmod u+x pem_server-5.0.0-2-linux-x64.run [root@ppaspem tmp]# ./pem_server-5.0.0-2-linux-x64.run --help Postgres Enterprise Manager Server 5.0.0-2 Usage: --help Display the list of valid options --version Display product information --unattendedmodeui unattendedmodeui Unattended Mode UI Default: minimal Allowed: none minimal minimalWithDialogs --optionfile optionfile Installation option file Default: --debuglevel debuglevel Debug information level of verbosity Default: 2 Allowed: 0 1 2 3 4 ...
We’ll go with the GUI mode for this demo. Basically it is just clicking next, next, next and everything should go fine. A lot of screenshots will follow:
[root@ppaspem tmp]# ./pem_server-5.0.0-2-linux-x64.run [root@ppaspem tmp]# systemctl list-unit-files | grep fire firewalld.service enabled [root@ppaspem tmp]# systemctl stop firewalld.service [root@ppaspem tmp]# systemctl disable firewalld.service rm '/etc/systemd/system/dbus-org.fedoraproject.FirewallD1.service' rm '/etc/systemd/system/basic.target.wants/firewalld.service' [root@ppaspem tmp]#
Once pem is installed adjust the httpd.conf to match the server’s IP-Address:
[root@ppaspem tmp]# grep 192.168.56.246 /opt/PostgreSQL/EnterpriseDB-ApachePHP/apache/conf/httpd.conf Listen 192.168.56.246:8080 ServerName 192.168.56.246:8080
Then do a restart:
service EnterpriseDBApachePhp restart
Now you should be able to check the http connection:
For interacting with the PEM there is the pem client. This client can be installed on any Linux or Windows host. I’ll do it on my linux box:
localhost:~/Downloads$ chmod u+x pem_client-5.0.0-2-linux-x64.run
localhost:~/Downloads$ ./pem_client-5.0.0-2-linux-x64.run
localhost:~/Downloads$ sudo ./pem_client-5.0.0-2-linux-x64.run
A shortcut in your Windows Start-Menu or you Linux Desktop should be available from now on:
One the client is started you can connect to the PEM server:
If the connection can be established you see the dashboard:
As we want to have at least the primary database monitored we will need to install pem agent on the primary host. Before we start the pem agent installation we need to allow connection to the postgres database on the pem host. To do this I’ll add all my postgres hosts (primary,standby,bart) to the pg_hba.conf file on the pem server:
-bash-4.2$ tail -3 data/pg_hba.conf host all postgres 192.168.56.243/32 md5 host all postgres 192.168.56.244/32 md5 host all postgres 192.168.56.245/32 md5
Remember to reload postgres for this changes to take effect:
-bash-4.2$ pg_ctl -D data/ reload server signaled
Ready to install:
[root@ppas tmp]# ls pem_agent-5.0.0-2-linux-x64.run primary_base_backup [root@ppas tmp]# chmod u+x pem_agent-5.0.0-2-linux-x64.run [root@ppas tmp]# ./pem_agent-5.0.0-2-linux-x64.run
So now that the pem agent is installed on the primary database host we can add the database to pem. Remember to put the host from where you start the pem client into the pg_hba.conf file on the primary database server (otherwise you will not be able to connect):
-bash-4.2$ tail -1 data/pg_hba.conf host all enterprisedb 192.168.56.1/24 md5
Start the pem client and just add the database and create the binding for the pem agent:
Mission complete. Have fun with the Postgres Enterprise Manager. I might be a good idea to add the standby database, too. Btw.: There is a web client for PEM, too, but this requires a product key: