Infrastructure at your Service

Daniel Westermann

getting started with postgres plus advanced server (4) – setting up the monitoring server

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:
[[email protected] tmp]# chmod u+x pem_server-5.0.0-2-linux-x64.run
[[email protected] 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:

[[email protected] tmp]# ./pem_server-5.0.0-2-linux-x64.run
 [[email protected]pem tmp]# systemctl list-unit-files | grep fire
 firewalld.service enabled
 [[email protected] tmp]# systemctl stop firewalld.service
 [[email protected] tmp]# systemctl disable firewalld.service
 rm '/etc/systemd/system/dbus-org.fedoraproject.FirewallD1.service'
 rm '/etc/systemd/system/basic.target.wants/firewalld.service'
 [[email protected] tmp]#

alt alt alt alt alt alt alt alt alt alt alt alt alt alt alt alt alt alt alt alt alt alt alt alt alt alt alt alt alt alt
Once pem is installed adjust the httpd.conf to match the server’s IP-Address:

[[email protected] 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:
alt
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

alt alt alt alt alt alt
A shortcut in your Windows Start-Menu or you Linux Desktop should be available from now on:
alt
One the client is started you can connect to the PEM server:
altalt alt
If the connection can be established you see the dashboard:
alt
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:

[[email protected] tmp]# ls
pem_agent-5.0.0-2-linux-x64.run  primary_base_backup
[[email protected] tmp]# chmod u+x pem_agent-5.0.0-2-linux-x64.run
[[email protected] tmp]# ./pem_agent-5.0.0-2-linux-x64.run 

alt alt alt alt alt alt alt alt
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:
alt alt alt alt alt
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:
altalt

One Comment

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Daniel Westermann
Daniel Westermann

Principal Consultant & Technology Leader Open Infrastructure