1Munin::Plugin::Pgsql(3)User Contributed Perl DocumentatioMnunin::Plugin::Pgsql(3)
2
3
4

NAME

6       Munin::Plugin::Pgsql - Base module for PostgreSQL plugins for Munin
7

SYNOPSIS

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

CONFIGURATION

13       All configuration is done through environment variables.
14

ENVIRONMENT VARIABLES

16       All plugins based on Munin::Plugin::Pgsql accepts all the environment
17       variables that libpq does. The most common ones used are:
18
19        PGHOST      hostname to connect to, or path to Unix socket
20        PGPORT      port number to connect to
21        PGUSER      username to connect as
22        PGPASSWORD  password to connect with, if a password is required
23
24       The plugins will always connect to the 'template1' database, except for
25       wildcard per-database plugins.
26
27   Example
28        [postgres_*]
29           user postgres
30           env.PGUSER postgres
31           env.PGPORT 5433
32

WILDCARD MATCHING

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

REQUIREMENTS

41       The module requires DBD::Pg to work.
42

TODO

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

BUGS

47       No known bugs at this point.
48

SEE ALSO

50       DBD::Pg
51

AUTHOR

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

COPYRIGHT/License.

56       Copyright (c) 2009 Magnus Hagander, Redpill Linpro AB
57
58       All rights reserved. This program is free software; you can
59       redistribute it and/or modify it under the terms of the GNU General
60       Public License as published by the Free Software Foundation; version 2
61       dated June, 1991.
62

API DOCUMENTATION

64       The following functions are available to plugins using this module.
65
66   Initialization
67        use Munin::Plugin::Pgsql;
68        my $pg = Munin::Plugin::Pgsql->new(
69           parameter=>value,
70           parameter=>value
71        );
72
73       Parameters
74
75        minversion     Minimum PostgreSQL version required, formatted like 8.2. If the
76                       database is an older version than this, the plugin will exit
77                       with an error.
78        title          The title for this plugin. Copied directly to the config output.
79        info           The info for this plugin. Copied directly to the config output.
80        vlabel         The vertical label for the graph. Copied directly to the config
81                       output.
82        basename       For wildcard plugins, this is the base name of the plugin,
83                       including the trailing underscore.
84        basequery      SQL query run to get the plugin values. The query should return
85                       two columns, one being the name of the counter and the second
86                       being the current value for the counter.
87        pivotquery     Set to 1 to indicate that the query in basequery returns a single
88                       row, with one field for each counter. The name of the counter is
89                       taken from the returned column name, and the value from the
90                       first row in the result.
91        configquery    SQL query run to generate the configuration information for the
92                       plugin. The query should return at least two columns, which are
93                       the name of the counter and the label of the counter. If
94                       a third column is present, it will be used as the info
95                       parameter.
96        suggestquery   SQL query to run to generate the list of suggestions for a
97                       wildcard plugin. Don't forget to include ALL if the plugin
98                       supports aggregate statistics.
99        graphdraw      The draw parameter for the graph. The default is LINE1.
100        graphtype      The type parameter for the graph. The default is GAUGE.
101        graphperiod    The period for the graph. Copied directly to the config output.
102        graphmin       The min parameter for the graph. The default is no minimum.
103        graphmax       The max parameter for the graph. The default is no maximum.
104        stack          If set to 1, all counters except the first one will be written
105                       with a draw type of STACK.
106        base           Used for graph_args --base. Default is 1000, set to 1024 when
107                       returning sizes in Kb for example.
108        wildcardfilter The SQL to substitute for when a wildcard plugin is run against
109                       a specific entity, for example a database. All occurrances of
110                       the string %%FILTER%% will be replaced with this string, and
111                       for each occurance a parameter with the value of the filtering
112                       condition will be added to the DBI statement.
113        paramdatabase  Makes the plugin connect to the database in the first parameter
114                       (wildcard plugins only) instead of 'postgres'.
115        extraconfig    This string is copied directly into the configuration output
116                       when the plugin is run in config mode, allowing low-level
117                       customization.
118
119       Specifying queries
120
121       Queries specified in one of the parameters above can take one of two
122       forms.  The easiest one is a simple string, which will then always be
123       executed, regardless of server version. The other form is an array,
124       looking like this:
125        [
126         "SELECT 'default',... FROM ...",
127         [
128           "8.3", "SELECT 'query for 8.3 or earlier',... FROM ...",
129           "8.1", "SELECT 'query for 8.1 or earlier',... FROM ..."
130         ]
131        ] This array is parsed from top to bottom, so the entires must be in
132       order of version number. The *last* value found where the version
133       specified is higher than or equal to the version of the server will be
134       used (yes, it counts backwards).
135
136   Processing
137        $pg->Process();
138
139        This command executes the plugin. It will automatically parse the ARGV array
140        for commands given by Munin.
141
142
143
144perl v5.12.2                      2010-12-05           Munin::Plugin::Pgsql(3)
Impressum