PostgreSQL Availability Plug-In Monitor
Purpose
Ensures your PostgreSQL databases are running.
Description
This plug-in monitor allows you to ensure that your PostgreSQL database is running. The monitor attempts to connect to your PostgreSQL database and run a test query. The response can then be compared to a string you specify.
Requirements
Monitoring station
up.time version – v4 or greater
Dependencies – None
Installation
Windows
- Install the downloaded plug-in monitor using loadpluginmonitor.exe
On the command line, run loadpluginmonitor.exe (found in the scripts directory), providing the absolute path to the downloaded plug-in monitor.
e.g.: loadpluginmonitor c:Program Filesuptime softwareuptime4scriptspostgresavailability_windows.zip
or scriptsloadpluginmonitor c:postgresavailability_windows.zip
Running loadpluginmonitor unarchives the plug-in monitor contents to the appropriate up.time /script and /xml directories (and if applicable, /agent and /lib directories), and will add the plug-in monitor to the up.time interface (specifically, the Advanced Monitors section of the Add Service Monitor page).
UNIX
- Install the downloaded plug-in monitor using loadpluginmonitor
On the command line, run loadpluginmonitor (found in the /scripts directory), providing the absolute path to the downloaded plug-in monitor.
e.g.: loadpluginmonitor/usr/local/uptime4/scripts/postgresavailability_unix.zip
or /scripts/loadpluginmonitor/user/local/postgresavailability_unix.zip
Running loadpluginmonitor unarchives the plug-in monitor contents into the appropriate up.time /script and /xml directories (and if applicable, /agent and /lib directories), and will add the plug-in monitor to the up.time interface (specifically, the Advanced Monitors section of the Add Service Monitor page).
Configuring the Monitor in up.time
The following configuration settings need to be set when creating a service instance based on this plug-in monitor:
- Script Name – the name and location (on the monitoring station) of the script that runs the JAR, which in turn connects to the PostgreSQL database and sends data back to the monitoring station
- Database Port – the port used to connect to the PostgreSQL database
- Database User – the user name used to connect to the PostgreSQL database
- Database Password – the password of the user name specified above
- Database Name – the name of the database you wish to connect to
- Database Query – the SQL query you wish to run on the database
- Match – a string you wish to compare against the return value of your database query above
CONFIGURATION EXAMPLE:
This configuration is used on a UNIX-based monitoring station. The plug-in monitor connects to a PostgreSQL database and performs a simple query. If the result returned from the database query exceeds one of the thresholds specified in the “Text to look for” field, or if the connection to the database fails, the appropriate alert notifications and actions are carried out.
- Script Name – scripts/PostgreSQL Availability/postgresbasic.sh
- Database Port – 5432
- Database User – postgresadmin
- Database Password – dbpassword
- Database Name – sample
- Database Query – select count(*) from customer
- Match – 6