4
# Copyright (C) 2009 Magnus Hagander, Redpill Linpro AB
6
# This program is free software; you can redistribute it and/or
7
# modify it under the terms of the GNU General Public License
8
# as published by the Free Software Foundation; version 2 dated June,
11
# This program is distributed in the hope that it will be useful,
12
# but WITHOUT ANY WARRANTY; without even the implied warranty of
13
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
# GNU General Public License for more details.
16
# You should have received a copy of the GNU General Public License
17
# along with this program; if not, write to the Free Software
18
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
23
postgres_size_ - Plugin to monitor PostgreSQL database size.
27
Configuration is done through libpq environment variables, for example
28
PGUSER, PGDATABASE, etc. For more information, see L<Munin::Plugin::Pgsql>.
30
To monitor a specific database, link to postgres_size_<databasename>.
31
To monitor all databases, link to postgres_size_ALL.
35
L<Munin::Plugin::Pgsql>
40
#%# capabilities=autoconf suggest
44
Magnus Hagander <magnus@hagander.net>, Redpill Linpro AB
46
=head1 COPYRIGHT/License.
48
Copyright (c) 2009 Magnus Hagander, Redpill Linpro AB
50
All rights reserved. This program is free software; you can
51
redistribute it and/or modify it under the terms of the GNU General
52
Public License as published by the Free Software Foundation; version 2
60
use Munin::Plugin::Pgsql;
62
my $pg = Munin::Plugin::Pgsql->new(
63
basename => 'postgres_size_',
64
title => 'PostgreSQL database size',
65
info => 'Size of database',
68
"SELECT datname,pg_database_size(oid) FROM pg_database %%FILTER%% ORDER BY 1",
69
wildcardfilter => "WHERE datname=?",
70
configquery => "SELECT datname,datname FROM pg_database %%FILTER%% ORDER BY 1",
72
"SELECT datname FROM pg_database WHERE datallowconn AND NOT datistemplate AND NOT datname='postgres' UNION ALL SELECT 'ALL' ORDER BY 1 LIMIT 10",