Translations of this page:

Osmius

Osmius agent for PostGreSQL
Agent name: osm_ag_POSTGRES Agent code: POSTGRES
Subject: PostGre SQL data base server Osmius agent user manual
Date: 02/03/2010 Revision date:

General Information

This agent can monitor several parameters of PostGres database servers. It has been tested on different versions. However, we recommend checking its functionality before implanting it in a production environment.

PostGres agent has been developed using functionalities and enhancements of Osmius framework and ACE libraries, so it is necessary to install the ACE libraries for the proper deployment and operation of this Osmius agent. See chapter: installation.

In addition this agent uses PostGre development libreries, if you want to compile by yourself you need to install it previously. Take a look: prerequisites section

POSTGRES agent provides up to 4 basic events with configuration parameters to allow scaling of a very simple way.

All events are remote, so not intrusive. Monitoring is done through the network connection, by this reason you have to provide some connection information, see: connection info. Events are based on remote queries.

PostGres Instance

As a general rule each Osmius agent can monitor one instance type. If you are not familiar with these concepts check out the glossary. Each instance is individually defined in the configuration file (if you want further information go to agents and instances); depending on agent type is the instance type and depending on instance is the connection info.

CONNECTION_INFO

The connection information or connection_info is data that the agent needs to know to connect to the instance. (See more about the connection_info)

In PostGres Osmius agent the connection_info prototype would be:

CONNECTION_INFO= -u USER -p PASSWORD -d DATABASE [-a IP_ADDRESS] [-l PORT]

Replace the following:

  • USER: user name. Mandatory.
  • PASSWORD: password. Mandatory.
  • DATABASE: target database name. Mandatory.
  • IP_ADDRESS: hostname or IP Address. Default localhost. Optional.
  • PORT: PostGres listening port. Default 5432. Optional.

Examples:

CONECTION_INFO = -u usr01 -p pass01 -d db01
CONECTION_INFO = -u usr01 -p pass01 -d db01 -a 192.168.13.13
CONECTION_INFO = -u usr01 -p pass01 -d db01 -a 192.168.13.13 -l 2324

TYPE

The type defines the instance type to be monitored. Every declared instance must be associated with a type as you can see here

In this case:

TYPE= POSTGRES

Event summary table for PostGres

Here is briefly the capabilities of this agent, further down on this page each event is described in more detail.

EVENT DESCRIPTION c w a tseconds Extra parameters / Remarks
AVAILABL Availability. Returns version and host type 0 1 1 60 Silent mode ( -s) recommmended
PGNUMCON Current number of connections 0 50 60 300 Silent mode ( -s) recommmended
PGPRCCON Used percentage of maximum connections 0 90 95 300 Silent mode ( -s) recommmended
PGDATMBS Database size measured in MB 0 195 198 86400 Silent mode ( -s) recommmended

PostGres events

AVAILABL

The event AVAILABL checks the availability of the connection to the Postgres database. If there is availability returns 0, otherwise returns 1.

Return values:

VALUE MEANING
0 Available
1 NOT available

Recommended parameters:

Comparison type Direct. The higher value the higher severity (-c 0)
Monitoring interval 60 seconds –> depends on instance importance
Warning threshold 1
Alert threshold 1

Parameter setting example:

AVAILABL = -t 60 -c 0 -w 1 -a 1 -T "PostGres version and host type"

Remarks: The event text will show PostGres version.

PGNUMCON

The event PGNUMCON returns the number of current connections to the database.

Return values:

VALUE MEANING
-1 Error
X Current connections

Recommended parameters:

Comparison type Direct. The higher value the higher severity (-c 0)
Monitoring interval 300 seconds –> depends on instance importance
Warning threshold 50
Alert threshold 60

Parameter setting example:

PGNUMCON = -t 300 -c 0 -w 1 -a 1 -T "Connections"

Remarks: None

PGPRCCON

The event PGPRCCON returns the current percentage of maximum connections.

Return values:

VALUE MEANING
-1 Error
0-100 Connections percentage

Recommended parameters:

Comparison type Direct. The higher value the higher severity (-c 0)
Monitoring interval 300 seconds –> depends on instance importance
Warning threshold 90
Alert threshold 95

Parameter setting example:

PGPRCCON = -t 300 -c 0 -w 1 -a 1 -T "connections percentage"

Remarks: None

PGDATMBS

The event PGDATMBS gives the size of the database in MB.

Return values:

VALUE MEANING
-1 Error
X Database size in MB

Recommended parameters:

Comparison type Direct. The higher value the higher severity (-c 0)
Monitoring interval 86400 seconds –> depends on instance importance
Warning threshold 195
Alert threshold 198

Parameter setting example:

PGDATMBS = -t 86400 -c 0 -w 1 -a 1 -T "db MB"

Remarks: None

PostGres agent prerequisites

In order to compile, this agent requires a set of prerequisites, which are generic to compile any Osmius agent, you can see these prerequisites.

PostGre agent needs PostGre development libraries in order to compile. There is a lot of information about it outside.

You also needs database access.

Makefiles and compiling

  • Make Project Creator (MPC) is used by Osmius, so creating Makefiles is a trivial task. If you want to learn more about MPC and Osmius check out the section of Makefiles on Osmius.
  • For PostGres Osmius agent you can generate Makefile in this way:

Modify osm_ag_postgres.mpc:

// -*- MPC -*-
// $Id$
project(*Osmius) : aceexe, ace_openssl {
  exename = osm_ag_POSTGRES
  install = $(OSM_ROOT)/bin
  after  += ACE_SSL_lib
  libs   += ACE_SSL

// Postgress: Take a look at 
//   http://www.postgresql.org/docs/8.1/static/libpq-build.html
//   execute: pg_config
// Postgresql :: Linux  
  includes += /usr/include/postgresql  
//libpaths += <path_to_postgres_library>
  libs   += pq

  Source_Files {
   ./../../cm/osm_cfgmanager.cpp
   ./../../cm/osm_message.cpp
   ./../../cm/osm_reactor.cpp
   ./../../ag/osm_ag_insmanager.cpp
   ./../../ag/osm_ag_msgmanager.cpp
   ./../../ag/osm_agent_basic.cpp
   osm_ag_postgres.cpp
  }
  Header_Files {
   ./../../cm/osm_cfgmanager.h
   ./../../cm/osm_message.h
   ./../../cm/osm_reactor.h
   ./../../ag/osm_ag_insmanager.h
   ./../../ag/osm_ag_msgmanager.h
   ./../../ag/osm_agent_basic.h
   osm_ag_postgres.h
  }
}

From the agent directory using console or terminal.

$ACE_ROOT/bin/mpc.pl -type make osm_ag_postgres.mpc
  • Now that you have created the Makefile, agent compiling is extremely simple.
make -f Makefile.Osm_Ag_Postgres_Osmius

Binaries are automatically installed in the bin directory of OSM_ROOT base directory.

Running PostGres agent

PostGres agent have the same running features of the other Osmius agents. You can check it out int he section Start and Stop Agents.

To run PostGres agent without Osmius web console:

osm_ag_POSTGRES -c osm_ag_POSTGRES.ini -m MASTERAG -p 1950 -d [>> osm_ag_postgres.log]1)

Running in standalone mode

PostGres Osmius agent, like the others Osmius agents, allows the execution in standalone mode. This option may be particularly useful when developing a new agent or to perform specific agent tests.

Basically you have to add a new value, called SNDCMD, to Osmius agent configuration file agente de Osmius para PostGres (osm_ag_POSTGRES.ini) as shown here.

Then you have to run PostGres Osmius agent setting Master Agent communications port to zero, for example:

osm_ag_POSTGRES -c osm_ag_POSTGRES.ini -m 00000000 -p 0 -d

Tests list

Test performed to PostGres Osmius agent.

Date: 11/12/2009
Test Result Remarks
Creating an instance with all its events in silent mode OK N/A
Creating an instance with all its events with custom text OK N/A
Creating an instance with all its events but no custom text OK N/A
Declaration of 3 instances with all its events to 5 seconds and keep it
running for 48 hours
OK, processing 30 events per second N/A
Declare 2 instances, cause a disconnect and then reconnectNo se puede hacer esto en este agente N/A
Declare 1 instance and test each event OK N/A
Elimination of general parameter and check unbootable OK PORTCM deleted
Elimination of instance CONN_INFO and check unbootable OK N/A
1) Optional, to store agent messages in a file
 
en/agentes/postgres.txt · Last modified: 2012/12/05 19:01 by osmius
 
Recent changes RSS feed Creative Commons License Donate Powered by PHP Valid XHTML 1.0 Valid CSS Driven by DokuWiki