Oracle Enterprise Manager supports 3rd party plugins which can help you to extend its monitoring and manageability capabilities. There are already developers and companies specialized in plugin development. Blue Medora is one of them (and probably the most famous one). In this blog post, I’ll show you how we can use Blue Medora’s EM PostgreSQL plugin, which is part of their True Visibility Suite for Oracle. I’ll download and deploy the plugin on the OMS (management servers), then deploy the plugin on the agent(s) and at the end, I’ll add a PostgreSQL target to our Enterprise Manager system.
The PosgteSQL plugin is not available on Self-Update, so we need to download and register it manually to our Enterprise Manager. To download the trial version of the plugin, I go to their website, click “download trial”, and fill a form to request trial version. Blue Medora will see our form and send us an email with download link of the plugin. After I download the zip file to my OMS server (ie into the temp folder), I issue the following commands:
unzip bm.em.xpgs_220.127.116.11.0_2.0.3.zip -d postgre_plugin
emcli login -user=SYSMAN
emcli import_update -omslocal -file=/tmp/postgre_plugin/bm.em.xpgs_18.104.22.168.0_2.0.3.opar
Then I login to Enterprise Manager console, go to “Extensibility > Self Update” page. Click to the “plugins”, find PostgreSQL plugin in the list, select the plugin and “apply it” (it’s in the actions menu on the left side).
After I applied the plugin, it’s ready to deploy on OMS (we need to deploy it on OMS before we can deploy it on the agents). I go to “Extensibility > Plugins” page, find the PostgreSQL pluin in the database plugins, click “deploy on” and select “management servers”. It’s a very straightforward process. EM will check the plugin and its prerequisites and if everything is OK, I just click NEXT to reach the last page and click DEPLOY button to start deployment of plugin on the OMS.
After I deployed the plugin on OMS, I can start deploying the plugin on the agents. Blue Medora’s PostgreSQL plugin can monitor PostgreSQL databases remotely but I recommend you to do local monitoring. So I’ll deploy the plugin on the agent running on the same host with the PostgreSQL database.
To deploy on the agents, I click “deploy on” menu and then select “management agent”. It will show us the Plugin version, ask the target agents (hosts), do some prerequisite checks on the agents and then show us the review page. I click DEPLOY after reviewing it. We can monitor the status of the deployment operation in the Deployment Activities page.
After the plugin is deployed on the agent, now we need to use “Add Target Declaratively” to add PostgreSQL database targets. I go to “Add Targets Manually” page, click on “Add Target Declaratively”. Select the host (the on you already deployed the plugin), select the target type as “PostgreSQL Database”, click “Add” button.
The PostgreSQL plugin needs only a few information about the target database. We should give an unique name for the target, hostname of the database (localhost should be fine for local monitoring but do not forget to modify pg_hba.conf file to give permission to access the plugin), login credentials, and primary database. Primary database is the first database the plugin will show on the overview page. If you’re not sure about picking which database, you may enter “postgres”. Don’t forget to click “test connection” to see if the plugin can connect to the server. If it works, you can click OK to add the target.
This is the target home page of PostgreSQL database. It provides overall health of the databases. Some important indicators related with target status (such as indexes, triggers, number of connections, prepared transactions, autovacuum freeze), latest incidents, currently open sessions, replication status and background writer status are reported in this page. You may see the page almost empty right after you added the target. Please be patient and give some time to the plugin to populate all data it requires.
There are four tabs for each database. Let’s check each of them to see which information the plugin provides to us. In the “database” tab we will see a pie chart at the top left, showing the ratio between the tables and the indexes on the database. On the right side, there’s a chart showing statistics about the database such as database size, number of transactions, blocks reads vs hits, block read time vs write time, row access counts, deadlocks and conflicts. We can pick one of these statistics from the select box and the chart will be updated. At the bottom side, there’s a table showing current connections to the selected database.
In the “tables” tab, we see a pie chart showing the biggest tables of the database. On the right side, there’s a chart showing scan counts, rows fetched by scan type (very important statistics!), rows modified, live and dead rows (tuples), table maintenance, heap blocks, index blocks and toast blocks. On the bottom, there’s a grid report listing all the tables. We can sort these tables according to their names, schemas, types, number of rows, disk space, and accessed rows per hour. When we click on a table name, the statistic chart will be updated. There are really useful statistics about the tables so can find most actively used tables and see their workload characteristics.
In the “indices” tab, we can see the biggest indexes, most actively used indexes, how many rows (disk blocks) are fetched for each index.
The last tab is the “queries” tab. Be sure to enable pg_stat_statements extension on your PostgreSQL server to be able to use this tab. In the “queries” tab, we can see most executed queries and valuable statistics for each of these queries such as average execution time, number of rows returned/affected, call count, block read and write time, shared blocks.
The PostgreSQL plugin comes with more than 100 metrics. Using The Enterprise Manager target menu, we can check these metrics, set thresholds, manage incidents. We can also manage blackouts, use Information Publisher Reports to generate reports about PostgreSQL targets.
I found Blue Medora’s PostgreSQL plugin is really useful. It helps you to easily monitor your PostgreSQL server, and notice issues about your databases which you do not normally see (unless you’re an expert PostgreSQL DBA). So I recommend it to all Enteprise Manager admins managing PostgreSQL databases.