Projet

Général

Profil

Paste
Télécharger au format
Statistiques
| Branche: | Révision:

root / plugins / postgresql / postgres_tuplesratio_ @ 8f7c72c2

Historique | Voir | Annoter | Télécharger (2,37 ko)

1 0b426019 Gilles
#!/usr/bin/perl
2
# -*- cperl -*-
3
#
4
# Copyright (C) 2013 Gilles Fauvie, OPENDBTEAM.com (INTEGER S.P.R.L)
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_tuplesratio_ - Plugin to monitor PostgreSQL live/dead tuples ratio.
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_tuplesratio_<databasename>.
31
To monitor all databases, link to postgres_tuplesratio_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
Gilles Fauvie <gfauvie@opendbteam.com>, OPENDBTEAM.com (INTEGER S.P.R.L)
45
46
=head1 COPYRIGHT/License.
47
48
Copyright (c) 2013 Gilles Fauvie, OPENDBTEAM.com (INTEGER S.P.R.L)
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 warnings;
58
use strict;
59
60
use Munin::Plugin::Pgsql;
61
62
my $pg = Munin::Plugin::Pgsql->new(
63
    basename => 'postgres_tuplesratio_',
64
    title    => 'PostgreSQL tuples ratio',
65
    info     => 'Ratio dead/live tuples of a database',
66
    vlabel   => 'Nbr',
67
    paramdatabase => 1,
68
    pivotquery => 1,
69
    basequery =>
70
	"select sum(n_live_tup) as livetup, sum(n_dead_tup) as deadtup from pg_stat_user_tables",
71
    configquery    => "values('livetup', 'livetup'), ('deadtup', 'deadtup')",
72
    suggestquery =>
73
        "SELECT datname FROM pg_database WHERE datallowconn AND NOT datistemplate AND NOT datname='postgres' UNION ALL SELECT 'ALL' ORDER BY 1 LIMIT 10",
74
    graphdraw => 'AREA',
75
    stack     => 1
76
);
77
78
$pg->Process();
79
exit(0);