- Repository
- Munin (2.0)
- Last change
- 2018-04-07
- Family
- auto
- Capabilities
- Language
- Perl
- License
- PostgreSQL
- Authors
postgres_transactions_
Name
postgres_transactions_ - Plugin to monitor PostgreSQL transactions.
Configuration
Configuration is done through libpq environment variables, for example PGUSER, PGDATABASE, etc. For more information, see Munin::Plugin::Pgsql.
To monitor a specific database, link to postgres_transactions_<databasename>. To monitor all databases, link to postgres_transactions_ALL.
See Also
Magic Markers
#%# family=auto
#%# capabilities=autoconf suggest
Author
Magnus Hagander magnus@hagander.net, Redpill Linpro AB
Copyright/License.
Copyright (c) 2009 Magnus Hagander, Redpill Linpro AB
All rights reserved. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; version 2 dated June, 1991.
#!@@PERL@@
# -*- cperl -*-
#
# Copyright (C) 2009 Magnus Hagander, Redpill Linpro AB
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; version 2 dated June,
# 1991.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
# 02110-1301 USA.
=head1 NAME
postgres_transactions_ - Plugin to monitor PostgreSQL transactions.
=head1 CONFIGURATION
Configuration is done through libpq environment variables, for example
PGUSER, PGDATABASE, etc. For more information, see L<Munin::Plugin::Pgsql>.
To monitor a specific database, link to postgres_transactions_<databasename>.
To monitor all databases, link to postgres_transactions_ALL.
=head1 SEE ALSO
L<Munin::Plugin::Pgsql>
=head1 MAGIC MARKERS
#%# family=auto
#%# capabilities=autoconf suggest
=head1 AUTHOR
Magnus Hagander <magnus@hagander.net>, Redpill Linpro AB
=head1 COPYRIGHT/License.
Copyright (c) 2009 Magnus Hagander, Redpill Linpro AB
All rights reserved. This program is free software; you can
redistribute it and/or modify it under the terms of the GNU General
Public License as published by the Free Software Foundation; version 2
dated June, 1991.
=cut
use strict;
use warnings;
use Munin::Plugin::Pgsql;
my $pg = Munin::Plugin::Pgsql->new(
basename => 'postgres_transactions_',
title => 'PostgreSQL transactions',
info => 'Transactions per second',
vlabel => 'Trans / sec',
basequery =>
"SELECT 'commit',sum(pg_stat_get_db_xact_commit(oid)) FROM pg_database %%FILTER%%
UNION ALL
SELECT 'rollback',sum(pg_stat_get_db_xact_rollback(oid)) FROM pg_database %%FILTER%%",
wildcardfilter => "WHERE datname=?",
paramdatabase => 1,
configquery => [
"VALUES ('commit','Committed transactions'),('rollback','Rolled back transactions')",
[
8.1,
"SELECT 'commit','Committed transactions' UNION ALL SELECT 'rollback','Rolled back transactions'",
],
],
suggestquery =>
"SELECT datname FROM pg_database WHERE datallowconn AND NOT datistemplate AND NOT datname='postgres' UNION ALL SELECT 'ALL' ORDER BY 1 LIMIT 10",
stack => 1,
graphmin => 0,
graphdraw => 'AREA',
graphtype => 'DERIVE',
);
$pg->Process();