AnonSec Shell
Server IP : 85.193.89.191  /  Your IP : 13.59.221.42
Web Server : Apache
System : Linux 956367-cx40159.tmweb.ru 3.10.0-1160.105.1.el7.x86_64 #1 SMP Thu Dec 7 15:39:45 UTC 2023 x86_64
User : bitrix ( 600)
PHP Version : 8.1.27
Disable Function : NONE
MySQL : OFF  |  cURL : OFF  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : ON  |  Pkexec : ON
Directory :  /usr/share/munin/plugins/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ HOME ]     

Current File : /usr/share/munin/plugins/postgres_cache_
#!/usr/bin/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_cache_ - Plugin to monitor the PostgreSQL Buffer Cache Activity.

=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_cache_<databasename>.
To monitor all databases, link to postgres_cache_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_cache_',
    title    => 'PostgreSQL buffer cache',
    info     => 'Buffer cache activity',
    vlabel   => 'Buffers / second',
    basequery =>
        "SELECT sum(blks_read) AS blks_read,sum(blks_hit) AS blks_hit FROM pg_stat_database %%FILTER%%",
    paramdatabase  => 1,
    pivotquery     => 1,
    wildcardfilter => " WHERE datname=?",
    configquery    => [
        "VALUES ('blks_read','Buffers read'),('blks_hit','Buffers hit')", [
            8.1,
            "SELECT 'blks_read','Buffers read' UNION ALL SELECT 'blks_hit','Buffers hit'",
        ],
    ],
    suggestquery =>
        "SELECT datname FROM pg_database WHERE datallowconn AND NOT datistemplate AND NOT datname='postgres' UNION ALL SELECT 'ALL' ORDER BY 1 LIMIT 10",
    graphtype => 'DERIVE',
    graphmin  => 0,
);

$pg->Process();

Anon7 - 2022
AnonSec Team