Install OPM

Install OPM (Open PostgreSQL Monitoring) – A free software suite designed to help you manage your PostgreSQL servers. It’s a flexible tool that will follow the activity of each instance. It can gather stats, display dashboards and send warnings when something goes wrong. The long-term goal of the project is to provide similar features to those of Oracle Grid Control or SQL Server Management Studio.

To install OPM, you need

  • a PostgreSQL 9.3+ cluster,
  • standard compiling tools,
  • nagios and
  • pg_config

The PostgreSQL cluster and Nagios can be installed either on same server or different servers.


Click here to see Nagios Installation Guide

Install OPM Core

Run below commands as root user to install and configure opm-core:

admin1 is the user you will be using to log on to the OPM user interface.


To install wh_nagios module run below commands as root user:

Then, create a crontab that will process incoming data and dispatch them.

This crontab can belong to any user, as long as it can connect to the PostgreSQL opm database with any PostgreSQL role. To allow a PostgreSQL role to import data in a warehouse, you need to call public.grant_dispatch. For instance, if the PostgreSQL role is user1 and the warehouse is wh_nagios:

Nagios & nagios_dispatcher

The dispatcher nagios_dispatcher is aimed to dispatch perfdata from Nagios files to the wh_nagios warehouse. nagios_dispatcher requires the DBD::Pg perl module.

Now you need to setup Nagios to create its perfdata files that nagios_dispatcher will poll and consume. As user root, create the required command file and destination folder:

Then, in Nagios main configuration file (nagios.cfg), append following parameters accordingly:

and then create the dispatcher configuration file:

Now, If your operating system uses inittab , add following line at the end of the /etc/inittab file:

Reload the /etc/inittab file:

And, if your operating system uses upstart , create the file /etc/init/nagios_dispatcher.conf, with following content:

And start the job:

User interface

The default user interface is based on the web framework Mojolicious. You need to install:

  • Perl (5.10 or above)
  • Mojolicious (4.63 or above, less than 5.0)
  • Mojolicious::Plugin::I18N (version 0.9)
  • DBD::Pg perl module
  • PostgreSQL (9.3 or above)
  • A CGI/Perl webserver

You can install Mojolicious using CPAN or your Linux distribution package system if available. Here is an example with CPAN:

To install the UI plugin wh_nagios (or any other UI plugin), from your opm directory as user root:

Then, on OPM database side, you need to create an opm user for the UI:

Finally, in the directory /usr/local/src/opm/opm-core/ui, copy the opm.conf-dist file to opm.conf, and edit it to suit our needs, for instance:

This user is only needed for the connection between the UI and the database. You only have to use it in the opm.conf file

To test the web user interface quickly, you can use either morbo or hypnotoad, both installed with Mojolicious. Example with Morbo:

Using hypnotoad, which suit better for production:

Removing -f”/code> makes it daemonize.

Configure PostgreSql services with Nagios:

Sample Postgresql command:

Sample Postgresql Service:

Install OPM

Note: OPM heavily depends on Nagios so you ought to be comfortable with nagios services and commands. To monitor postgreSql database, you need to install and configure check_postgres plugin from bucardo.

Reference: NRPE_PostgreSQL_check
monitor postgresql with nagios
Install and configure nagios for postgresql PPAS on linux

Your comments/suggestions will be highly appreciated.

Share this post

Leave a comment

Your email address will not be published.