.\" Automatically generated by Pod::Man 4.10 (Pod::Simple 3.35) .\" .\" Standard preamble: .\" ======================================================================== .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. .de Vb \" Begin verbatim text .ft CW .nf .ne \\$1 .. .de Ve \" End verbatim text .ft R .fi .. .\" Set up some character translations and predefined strings. \*(-- will .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left .\" double quote, and \*(R" will give a right double quote. \*(C+ will .\" give a nicer C++. Capital omega is used to do unbreakable dashes and .\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff, .\" nothing in troff, for use with C<>. .tr \(*W- .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p' .ie n \{\ . ds -- \(*W- . ds PI pi . if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch . if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch . ds L" "" . ds R" "" . ds C` "" . ds C' "" 'br\} .el\{\ . ds -- \|\(em\| . ds PI \(*p . ds L" `` . ds R" '' . ds C` . ds C' 'br\} .\" .\" Escape single quotes in literal strings from groff's Unicode transform. .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" .\" If the F register is >0, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .\" .\" Avoid warning from groff about undefined register 'F'. .de IX .. .nr rF 0 .if \n(.g .if rF .nr rF 1 .if (\n(rF:(\n(.g==0)) \{\ . if \nF \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . if !\nF==2 \{\ . nr % 0 . nr F 2 . \} . \} .\} .rr rF .\" .\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2). .\" Fear. Run. Save yourself. No user-serviceable parts. . \" fudge factors for nroff and troff .if n \{\ . ds #H 0 . ds #V .8m . ds #F .3m . ds #[ \f1 . ds #] \fP .\} .if t \{\ . ds #H ((1u-(\\\\n(.fu%2u))*.13m) . ds #V .6m . ds #F 0 . ds #[ \& . ds #] \& .\} . \" simple accents for nroff and troff .if n \{\ . ds ' \& . ds ` \& . ds ^ \& . ds , \& . ds ~ ~ . ds / .\} .if t \{\ . ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u" . ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u' . ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u' . ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u' . ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u' . ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u' .\} . \" troff and (daisy-wheel) nroff accents .ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V' .ds 8 \h'\*(#H'\(*b\h'-\*(#H' .ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#] .ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H' .ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u' .ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#] .ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#] .ds ae a\h'-(\w'a'u*4/10)'e .ds Ae A\h'-(\w'A'u*4/10)'E . \" corrections for vroff .if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u' .if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u' . \" for low resolution devices (crt and lpr) .if \n(.H>23 .if \n(.V>19 \ \{\ . ds : e . ds 8 ss . ds o a . ds d- d\h'-1'\(ga . ds D- D\h'-1'\(hy . ds th \o'bp' . ds Th \o'LP' . ds ae ae . ds Ae AE .\} .rm #[ #] #H #V #F C .\" ======================================================================== .\" .IX Title "Munin::Plugin::Pgsql 3pm" .TH Munin::Plugin::Pgsql 3pm "2021-03-08" "perl v5.28.1" "User Contributed Perl Documentation" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l .nh .SH "NAME" Munin::Plugin::Pgsql \- Base module for PostgreSQL plugins for Munin .SH "SYNOPSIS" .IX Header "SYNOPSIS" The Munin::Plugin::Pgsql module provides base functionality for all PostgreSQL Munin plugins, including common configuration parameters. .SH "CONFIGURATION" .IX Header "CONFIGURATION" All configuration is done through environment variables. .SH "ENVIRONMENT VARIABLES" .IX Header "ENVIRONMENT VARIABLES" All plugins based on Munin::Plugin::Pgsql accepts all the environment variables that libpq does. The most common ones used are: .PP .Vb 4 \& 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 .Ve .PP The plugins will by default connect to the 'template1' database, except for wildcard per-database plugins. This can be overridden using the \s-1PGDATABASE\s0 variable, but this is usually a bad idea. .SS "Example" .IX Subsection "Example" .Vb 4 \& [postgres_*] \& user postgres \& env.PGUSER postgres \& env.PGPORT 5433 .Ve .SH "WILDCARD MATCHING" .IX Header "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 \s-1ALL\s0 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. .SH "REQUIREMENTS" .IX Header "REQUIREMENTS" The module requires DBD::Pg to work. .SH "TODO" .IX Header "TODO" Support for using psql instead of DBD::Pg, to remove dependency. .SH "BUGS" .IX Header "BUGS" No known bugs at this point. .SH "SEE ALSO" .IX Header "SEE ALSO" DBD::Pg .SH "AUTHOR" .IX Header "AUTHOR" Magnus Hagander , Redpill Linpro \s-1AB\s0 .SH "COPYRIGHT/License." .IX Header "COPYRIGHT/License." Copyright (c) 2009 Magnus Hagander, Redpill Linpro \s-1AB\s0 .PP All rights reserved. This program is free software; you can redistribute it and/or modify it under the terms of the \s-1GNU\s0 General Public License as published by the Free Software Foundation; version 2 dated June, 1991. .SH "API DOCUMENTATION" .IX Header "API DOCUMENTATION" The following functions are available to plugins using this module. .SS "Initialization" .IX Subsection "Initialization" .Vb 5 \& use Munin::Plugin::Pgsql; \& my $pg = Munin::Plugin::Pgsql\->new( \& parameter=>value, \& parameter=>value \& ); .Ve .PP \fIParameters\fR .IX Subsection "Parameters" .PP .Vb 10 \& 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 \*(AqPostgreSQL\*(Aq. \& 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\*(Aqt 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 occurrences of \& the string %%FILTER%% will be replaced with this string, and \& for each occurrence 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 \*(Aqtemplate1\*(Aq. \& defaultdb Makes the plugin connect to the database specified in this \& parameter instead of \*(Aqtemplate1\*(Aq. \& 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\*(Aqs called with the result of the base query, \& and can post\-process the result and return a new resultset. \& postconfig A function that\*(Aqs called with the result of the config query, \& and can post\-process the result and return a new resultset. \& postautoconf A function that\*(Aqs called with the result of the autoconf query, \& and can post\-process the result and return a new resultset. \& postsuggest A function that\*(Aqs called with the result of the suggest query, \& and can post\-process the result and return a new resultset. .Ve .PP \fISpecifying queries\fR .IX Subsection "Specifying queries" .PP 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: [ \*(L"\s-1SELECT\s0 'default',... \s-1FROM ...\*(R",\s0 [ \*(L"8.3\*(R", \*(L"\s-1SELECT\s0 'query for 8.3 or earlier',... \s-1FROM ...\*(R",\s0 \*(L"8.1\*(R", \*(L"\s-1SELECT\s0 'query for 8.1 or earlier',... \s-1FROM ...\*(R"\s0 ] ] 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). .SS "Processing" .IX Subsection "Processing" .Vb 1 \& $pg\->Process(); \& \& This command executes the plugin. It will automatically parse the ARGV array \& for commands given by Munin. .Ve