Skip site navigation (1)Skip section navigation (2)

FreeBSD Manual Pages

  
 
  

home | help
Munin::Plugin::Pgsql(3User Contributed Perl DocumentatiMunin::Plugin::Pgsql(3)

NAME
       Munin::Plugin::Pgsql - Base module for PostgreSQL plugins for Munin

SYNOPSIS
       The Munin::Plugin::Pgsql	module provides	base functionality for all
       PostgreSQL Munin	plugins, including common configuration	parameters.

CONFIGURATION
       All configuration is done through environment variables.

ENVIRONMENT VARIABLES
       All plugins based on Munin::Plugin::Pgsql accepts all the environment
       variables that libpq does. The most common ones used are:

	PGHOST	    hostname to	connect	to, or path to Unix socket
	PGPORT	    port number	to connect to
	PGUSER	    username to	connect	as
	PGPASSWORD  password to	connect	with, if a password is required

       The plugins will	by default connect to the 'template1' database,	except
       for wildcard per-database plugins. This can be overridden using the
       PGDATABASE variable, but	this is	usually	a bad idea.

   Example
	[postgres_*]
	   user	postgres
	   env.PGUSER postgres
	   env.PGPORT 5433

WILDCARD MATCHING
       Wildcard	plugins	based on this module will match	on whatever type of
       object specifies	for a filter, usually a	database. If the object	name
       ALL is used (for	example, a symlink to postgres_connections_ALL), the
       filter will not be applied, and the plugin behaves like a non-wildcard
       one.

REQUIREMENTS
       The module requires DBD::Pg to work.

TODO
       Support for using psql instead of DBD::Pg, to remove dependency.

BUGS
       No known	bugs at	this point.

SEE ALSO
       DBD::Pg

AUTHOR
       Magnus Hagander <magnus@hagander.net>, Redpill Linpro AB

COPYRIGHT/License.
       Copyright (c) 2009 Magnus Hagander, Redpill Linpro AB

       All rights reserved. This program is free software; you can
       redistribute it and/or modify it	under the terms	of the GNU General
       Public License as published by the Free Software	Foundation; version 2
       dated June, 1991.

API DOCUMENTATION
       The following functions are available to	plugins	using this module.

   Initialization
	use Munin::Plugin::Pgsql;
	my $pg = Munin::Plugin::Pgsql->new(
	   parameter=>value,
	   parameter=>value
	);

       Parameters

	minversion     Minimum PostgreSQL version required, formatted like 8.2.	If the
		       database	is an older version than this, the plugin will exit
		       with an error.
	category       The category for	this plugin. Copied directly to	the config
		       output. Default 'PostgreSQL'.
	title	       The title for this plugin. Copied directly to the config	output.
	info	       The info	for this plugin. Copied	directly to the	config output.
	vlabel	       The vertical label for the graph. Copied	directly to the	config
		       output.
	basename       For wildcard plugins, this is the base name of the plugin,
		       including the trailing underscore.
	basequery      SQL query run to	get the	plugin values. The query should	return
		       two columns, one	being the name of the counter and the second
		       being the current value for the counter.
	pivotquery     Set to 1	to indicate that the query in basequery	returns	a single
		       row, with one field for each counter. The name of the counter is
		       taken from the returned column name, and	the value from the
		       first row in the	result.
	configquery    SQL query run to	generate the configuration information for the
		       plugin. The query should	return at least	two columns, which are
		       the name	of the counter and the label of	the counter. If
		       a third column is present, it will be used as the info
		       parameter.
	suggestquery   SQL query to run	to generate the	list of	suggestions for	a
		       wildcard	plugin.	Don't forget to	include	ALL if the plugin
		       supports	aggregate statistics.
	autoconfquery  SQL query to run	as the last step of "autoconf",	to determine
		       if the plugin should be run on this machine. Must return	a single
		       row, two	columns	columns. The first one is a boolean field
		       representing yes	or no, the second one a	reason for "no".
	graphdraw      The draw	parameter for the graph. The default is	LINE1.
	graphtype      The type	parameter for the graph. The default is	GAUGE.
	graphperiod    The period for the graph. Copied	directly to the	config output.
	graphmin       The min parameter for the graph.	The default is no minimum.
	graphmax       The max parameter for the graph.	The default is no maximum.
	stack	       If set to 1, all	counters except	the first one will be written
		       with a draw type	of STACK.
	base	       Used for	graph_args --base. Default is 1000, set	to 1024	when
		       returning sizes in Kb for example.
	wildcardfilter The SQL to substitute for when a	wildcard plugin	is run against
		       a specific entity, for example a	database. All occurrances of
		       the string %%FILTER%% will be replaced with this	string,	and
		       for each	occurance a parameter with the value of	the filtering
		       condition will be added to the DBI statement.
	paramdatabase  Makes the plugin	connect	to the database	in the first parameter
		       (wildcard plugins only) instead of 'template1'.
	defaultdb      Makes the plugin	connect	to the database	specified in this
		       parameter instead of 'template1'.
	extraconfig    This string is copied directly into the configuration output
		       when the	plugin is run in config	mode, allowing low-level
		       customization.
	postprocess    A function that's called	with the result	of the base query,
		       and can post-process the	result and return a new	resultset.
	postconfig     A function that's called	with the result	of the config query,
		       and can post-process the	result and return a new	resultset.
	postautoconf   A function that's called	with the result	of the autoconf	query,
		       and can post-process the	result and return a new	resultset.
	postsuggest    A function that's called	with the result	of the suggest query,
		       and can post-process the	result and return a new	resultset.

       Specifying queries

       Queries specified in one	of the parameters above	can take one of	two
       forms.  The easiest one is a simple string, which will then always be
       executed, regardless of server version. The other form is an array,
       looking like this:
	[
	 "SELECT 'default',... FROM ...",
	 [
	   "8.3", "SELECT 'query for 8.3 or earlier',... FROM ...",
	   "8.1", "SELECT 'query for 8.1 or earlier',... FROM ..."
	 ]
	] This array is	parsed from top	to bottom, so the entries must be in
       order of	version	number.	The *last* value found where the version
       specified is higher than	or equal to the	version	of the server will be
       used (yes, it counts backwards).

   Processing
	$pg->Process();

	This command executes the plugin. It will automatically	parse the ARGV array
	for commands given by Munin.

perl v5.24.1			  2017-07-02	       Munin::Plugin::Pgsql(3)

NAME | SYNOPSIS | CONFIGURATION | ENVIRONMENT VARIABLES | WILDCARD MATCHING | REQUIREMENTS | TODO | BUGS | SEE ALSO | AUTHOR | COPYRIGHT/License. | API DOCUMENTATION

Want to link to this manual page? Use this URL:
<https://www.freebsd.org/cgi/man.cgi?query=Munin::Plugin::Pgsql&sektion=3&manpath=FreeBSD+12.1-RELEASE+and+Ports>

home | help