~ubuntu-branches/ubuntu/lucid/munin/lucid

« back to all changes in this revision

Viewing changes to plugins/node.d/postgres_size_.in

  • Committer: Bazaar Package Importer
  • Author(s): Holger Levsen, Stig Sandbeck Mathisen, Tom Feiner
  • Date: 2010-01-14 12:10:51 UTC
  • mfrom: (8.1.13 sid)
  • Revision ID: james.westby@ubuntu.com-20100114121051-6xovy6hqfh1wrl0u
Tags: 1.4.3-2
[ Stig Sandbeck Mathisen ]
* Add versioned dependency for librrds-perl.
  If used with librrds-perl 1.2 or older, the font path is wrong.

[ Tom Feiner ]
* Update watch file.
* Add patch from munin ticket #828, to suppress "occasional" unknown 
  states to avoid alerts. Thanks to Steve Wilson for the patch!
* Removed asterisks from NEWS.Debian and rewrite as non bulleted list, as
  advised by the developers reference.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#!@@PERL@@
 
2
# -*- cperl -*-
 
3
#
 
4
# Copyright (C) 2009 Magnus Hagander, Redpill Linpro AB
 
5
#
 
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,
 
9
# 1991.
 
10
#
 
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.
 
15
#
 
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
 
19
# 02110-1301 USA.
 
20
 
 
21
=head1 NAME
 
22
 
 
23
postgres_size_ - Plugin to monitor PostgreSQL database size.
 
24
 
 
25
=head1 CONFIGURATION
 
26
 
 
27
Configuration is done through libpq environment variables, for example
 
28
PGUSER, PGDATABASE, etc. For more information, see L<Munin::Plugin::Pgsql>.
 
29
 
 
30
To monitor a specific database, link to postgres_size_<databasename>.
 
31
To monitor all databases, link to postgres_size_ALL.
 
32
 
 
33
=head1 SEE ALSO
 
34
 
 
35
L<Munin::Plugin::Pgsql>
 
36
 
 
37
=head1 MAGIC MARKERS
 
38
 
 
39
 #%# family=auto
 
40
 #%# capabilities=autoconf suggest
 
41
 
 
42
=head1 AUTHOR
 
43
 
 
44
Magnus Hagander <magnus@hagander.net>, Redpill Linpro AB
 
45
 
 
46
=head1 COPYRIGHT/License.
 
47
 
 
48
Copyright (c) 2009 Magnus Hagander, Redpill Linpro AB
 
49
 
 
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
 
53
dated June, 1991.
 
54
 
 
55
=cut
 
56
 
 
57
use strict;
 
58
use warnings;
 
59
 
 
60
use Munin::Plugin::Pgsql;
 
61
 
 
62
my $pg = Munin::Plugin::Pgsql->new(
 
63
    basename => 'postgres_size_',
 
64
    title    => 'PostgreSQL database size',
 
65
    info     => 'Size of database',
 
66
    vlabel   => 'Size',
 
67
    basequery =>
 
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",
 
71
    suggestquery =>
 
72
        "SELECT datname FROM pg_database WHERE datallowconn AND NOT datistemplate AND NOT datname='postgres' UNION ALL SELECT 'ALL' ORDER BY 1 LIMIT 10",
 
73
    graphdraw => 'AREA',
 
74
    stack     => 1,
 
75
    base      => 1024
 
76
);
 
77
 
 
78
$pg->Process();
 
79
exit(0);
 
80