mirror of
https://github.com/munin-monitoring/contrib.git
synced 2025-09-19 00:53:19 +00:00
Whitespace cleanup
* remove trailing whitespace * remove empty lines at the end of files
This commit is contained in:
parent
ef851f0c34
commit
17f784270a
604 changed files with 2927 additions and 2945 deletions
|
@ -31,7 +31,7 @@ my $plugin_title = ($db_pool) ? $plugin_suffix." ".$pool_name : $pool_name;
|
|||
if (!$pool_name)
|
||||
{
|
||||
print "Cannot get pool name\n";
|
||||
exit 1;
|
||||
exit 1;
|
||||
}
|
||||
|
||||
# command line arguments for autconf and config
|
||||
|
@ -164,7 +164,7 @@ if (defined($ARGV[0]))
|
|||
}
|
||||
|
||||
# connect to data
|
||||
my $dbh = DBI->connect("DBI:Pg:dbname=$db_name;host=$db_host;port=$db_port", $db_user, $db_pass)
|
||||
my $dbh = DBI->connect("DBI:Pg:dbname=$db_name;host=$db_host;port=$db_port", $db_user, $db_pass)
|
||||
or die ("Cannot connect to database");
|
||||
# go trough each set and get the data
|
||||
foreach my $get ('pools', 'stats')
|
||||
|
@ -256,7 +256,7 @@ another example, where different pgbouncers (and so munin plugins) connecting to
|
|||
env.pgbouncer_port 6542
|
||||
env.pgbouncer_host localhost
|
||||
env.pgbouncer_pool dbname
|
||||
|
||||
|
||||
[pgbouncer_webmain]
|
||||
env.pgbouncer_pass barfoo
|
||||
env.pgbouncer_user bar
|
||||
|
@ -276,7 +276,7 @@ This graph will show the average bytes sent and received by the pgbouncer for th
|
|||
|
||||
=head2 Average connections
|
||||
|
||||
This graph will show the average amount of connections to the pgbouncer for this pool
|
||||
This graph will show the average amount of connections to the pgbouncer for this pool
|
||||
|
||||
=head2 Average query time
|
||||
|
||||
|
|
|
@ -28,8 +28,8 @@
|
|||
# This should, however, be given through autoconf and suggest.
|
||||
#
|
||||
# If required, give username, password and/or Postgresql server
|
||||
# host through environment variables.
|
||||
#
|
||||
# host through environment variables.
|
||||
#
|
||||
# You must also activate Postgresql statistics. See
|
||||
# http://www.postgresql.org/docs/7.4/interactive/monitoring-stats.html
|
||||
# for how to enable this. Specifically, the following lines must
|
||||
|
@ -46,11 +46,11 @@
|
|||
# Config variables:
|
||||
#
|
||||
# dbhost - Which database server to use. Defaults to
|
||||
# 'localhost'.
|
||||
# 'localhost'.
|
||||
# dbuser - A Postgresql user account with read permission to
|
||||
# the given database. Defaults to
|
||||
# 'postgres'. Anyway, Munin must be told which user
|
||||
# this plugin should be run as.
|
||||
# this plugin should be run as.
|
||||
# dbpass - The corresponding password, if
|
||||
# applicable. Default to undef. Remember that
|
||||
# pg_hba.conf must be configured accordingly.
|
||||
|
@ -128,7 +128,7 @@ if ($configure) {
|
|||
graph_title Postgres data reads from $dbname
|
||||
graph_args --base 1000
|
||||
graph_vlabel Blocks read per \${graph_period}
|
||||
graph_category db
|
||||
graph_category db
|
||||
graph_info Shows number of blocks read from disk and from memory
|
||||
from_disk.label Read from disk
|
||||
from_disk.info Read from disk
|
||||
|
|
|
@ -14,7 +14,7 @@ cat << EOF
|
|||
graph_title Postgres queries2 on $db
|
||||
graph_args --base 1000
|
||||
graph_vlabel Queries per \${graph_period}
|
||||
graph_category db
|
||||
graph_category db
|
||||
graph_info Shows number of select, insert, update and delete queries
|
||||
sel_seq.label s_selects
|
||||
sel_seq.info Sequential selects on all tables
|
||||
|
@ -47,7 +47,7 @@ deletes.min 0
|
|||
EOF
|
||||
else
|
||||
psql -At $db << EOF
|
||||
select
|
||||
select
|
||||
'sel_seq.value ' || SUM(seq_scan) || E'\n' ||
|
||||
'sel_seq_rows.value ' || SUM(seq_tup_read) || E'\n' ||
|
||||
'sel_idx.value ' || SUM(idx_scan) || E'\n' ||
|
||||
|
@ -57,7 +57,7 @@ select
|
|||
'deletes.value ' || SUM(n_tup_del)
|
||||
from pg_stat_all_tables;
|
||||
EOF
|
||||
|
||||
|
||||
# my $sql = "SELECT SUM(seq_scan),SUM(seq_tup_read), ";
|
||||
# $sql .= "SUM(idx_scan),SUM(idx_tup_fetch), ";
|
||||
# $sql .= "SUM(n_tup_ins),SUM(n_tup_upd),SUM(n_tup_del) ";
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
#!/usr/bin/env perl
|
||||
|
||||
# postgres_queries3: see stats on number of rows
|
||||
# postgres_queries3: see stats on number of rows
|
||||
# read, inserted, updated and deleted on a per table basis
|
||||
#
|
||||
# Author:
|
||||
|
@ -27,10 +27,10 @@
|
|||
# On debian systems install libipc-run3-perl
|
||||
#
|
||||
# Log info:
|
||||
# 20140701 - Initial
|
||||
# 20140924 -
|
||||
# 20140701 - Initial
|
||||
# 20140924 -
|
||||
# -ignore internal pg tables
|
||||
# -missing stuff in config
|
||||
# -missing stuff in config
|
||||
|
||||
|
||||
use strict;
|
||||
|
@ -40,7 +40,7 @@ use IPC::Run3 qw( run3 );
|
|||
my %values;
|
||||
|
||||
my $query = \<<EOF;
|
||||
select
|
||||
select
|
||||
'sel_seq.value ' || SUM(seq_scan) || E'\n' ||
|
||||
'sel_seq_rows.value ' || SUM(seq_tup_read) || E'\n' ||
|
||||
'sel_idx.value ' || SUM(idx_scan) || E'\n' ||
|
||||
|
@ -60,7 +60,7 @@ if( defined $ARGV[0] and $ARGV[0] eq "config" ){
|
|||
print qq/graph_title Postgres All Queries
|
||||
graph_args --base 1000 -l 0 -r
|
||||
graph_vlabel Queries per \${graph_period}
|
||||
graph_category db
|
||||
graph_category db
|
||||
graph_info Shows number of select, insert, update and delete queries
|
||||
sel_seq.label s_selects
|
||||
sel_seq.info Sequential selects on all tables
|
||||
|
@ -110,7 +110,7 @@ foreach my $db (@dbs){
|
|||
my($key, $value) = split(/ /, $line);
|
||||
$values{$key} += $value;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -66,7 +66,7 @@ my $pg = Munin::Plugin::Pgsql->new(
|
|||
vlabel => 'Size',
|
||||
paramdatabase => 1,
|
||||
basequery => "SELECT CASE WHEN relkind = 'r' OR relkind = 't' THEN 'db_detail_data' WHEN relkind = 'i' THEN 'db_detail_index' WHEN relkind = 'v' THEN 'db_detail_view' WHEN relkind = 'S' THEN 'db_detail_sequence' ELSE 'db_detail_other' END AS state,
|
||||
SUM(relpages::bigint * 8 * 1024) AS size
|
||||
SUM(relpages::bigint * 8 * 1024) AS size
|
||||
FROM pg_class pg, pg_namespace pgn WHERE pg.relnamespace = pgn.oid AND pgn.nspname NOT IN ('information_schema', 'pg_catalog') GROUP BY state",
|
||||
configquery => [
|
||||
"VALUES ('db_detail_data','Data size'),('db_detail_index','Index size'),('db_detail_sequence','Sequence size'),('db_detail_view','View size'),('db_detail_other','Other size')",
|
||||
|
|
|
@ -105,17 +105,17 @@ _EOM
|
|||
my $metadatabase_pages = 0;
|
||||
my $metadatabase_indexes = 0;
|
||||
my @names = $dbh->tables;
|
||||
|
||||
|
||||
# Find relfilenode and relpages from the given table
|
||||
my $q_ind = "SELECT relkind, relfilenode, relpages FROM pg_class
|
||||
WHERE relname = ?
|
||||
UNION
|
||||
SELECT relkind, relfilenode, relpages FROM pg_class
|
||||
WHERE relfilenode IN (SELECT indexrelid FROM pg_index
|
||||
WHERE relfilenode IN (SELECT indexrelid FROM pg_index
|
||||
WHERE indrelid IN (SELECT relfilenode FROM pg_class
|
||||
WHERE relname = ?))";
|
||||
my $sth = $dbh->prepare ($q_ind) or die $dbh->errstr;
|
||||
|
||||
|
||||
# Iterate over the tables in the database
|
||||
foreach my $table (@names) {
|
||||
my $meta = 1;
|
||||
|
@ -127,7 +127,7 @@ _EOM
|
|||
# "public" tables are the user data
|
||||
$meta = 0 if $table =~ /^public\./;
|
||||
$table =~ s/^.*\.//;
|
||||
|
||||
|
||||
# Call the query with $table twice for each side of the UNION
|
||||
$sth->execute ($table, $table) or die $dbh->errstr;
|
||||
while (my ($relkind, $relfilenode, $relpages) = $sth->fetchrow_array) {
|
||||
|
@ -139,8 +139,8 @@ _EOM
|
|||
$metatable_indexes += $relpages if $meta == 1;
|
||||
}
|
||||
# Define the query
|
||||
my $q2 = "SELECT SUM(relpages)
|
||||
FROM pg_class
|
||||
my $q2 = "SELECT SUM(relpages)
|
||||
FROM pg_class
|
||||
WHERE relname IN (?, ?)";
|
||||
my $sth2 = $dbh->prepare ($q2);
|
||||
$sth2->execute ("pg_toast_${relfilenode}",
|
||||
|
@ -159,7 +159,7 @@ _EOM
|
|||
$database_indexes += $table_indexes;
|
||||
$metadatabase_pages += $metatable_pages;
|
||||
$metadatabase_indexes += $metatable_indexes;
|
||||
}
|
||||
}
|
||||
$sth->finish;
|
||||
$dbh->disconnect;
|
||||
print "size\.value " . $database_pages * 8192 . "\n";
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
# st_last_received_event_ts: the timestamp on the sl_event in that pair
|
||||
# st_lag_num_events: difference between st_last_event and st_last_received
|
||||
# st_lag_time: difference between st_last_event_ts and st_last_received_ts
|
||||
#
|
||||
#
|
||||
#
|
||||
# Configuration variables:
|
||||
#
|
||||
|
@ -54,7 +54,7 @@ if [ "$1" = "config" ]; then
|
|||
echo "graph_title Slony lag events for ${PGDATABASE}"
|
||||
echo 'graph_vlabel event'
|
||||
|
||||
psql -h ${PGHOST} -d ${PGDATABASE} -U ${PGUSER} -tc "SELECT no_id,regexp_replace(pa_conninfo, '.*host=(.*?) .*$', '\\1') FROM ${PGSCHEMA}.sl_node JOIN ${PGSCHEMA}.sl_path ON (pa_server=no_id) WHERE pa_client=${PGSCHEMA}.getlocalnodeid('${PGSCHEMA}'::name);" | while read node_id sep host
|
||||
psql -h ${PGHOST} -d ${PGDATABASE} -U ${PGUSER} -tc "SELECT no_id,regexp_replace(pa_conninfo, '.*host=(.*?) .*$', '\\1') FROM ${PGSCHEMA}.sl_node JOIN ${PGSCHEMA}.sl_path ON (pa_server=no_id) WHERE pa_client=${PGSCHEMA}.getlocalnodeid('${PGSCHEMA}'::name);" | while read node_id sep host
|
||||
do
|
||||
test -z "${node_id}" && continue
|
||||
echo "${node_id}.label ${host}"
|
||||
|
@ -68,7 +68,7 @@ if [ "$1" = "config" ]; then
|
|||
fi
|
||||
|
||||
psql -h ${PGHOST} -d ${PGDATABASE} -U ${PGUSER} -tc "SELECT st_received, st_lag_num_events FROM ${PGSCHEMA}.sl_status ORDER BY 1;" | while read node_id sep event
|
||||
do
|
||||
do
|
||||
test -z "${node_id}" && continue
|
||||
echo "${node_id}.value ${event}"
|
||||
done
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
#!/bin/bash
|
||||
#
|
||||
# plugin to monitor difference between st_last_event_ts and st_last_received_ts
|
||||
# plugin to monitor difference between st_last_event_ts and st_last_received_ts
|
||||
# in sl_status table (based on slony_ and slony_lag_)
|
||||
#
|
||||
# http://blog.endpoint.com/2009/07/slony-slstatus-and-diagnosing.html
|
||||
|
@ -14,7 +14,7 @@
|
|||
# st_last_received_event_ts: the timestamp on the sl_event in that pair
|
||||
# st_lag_num_events: difference between st_last_event and st_last_received
|
||||
# st_lag_time: difference between st_last_event_ts and st_last_received_ts
|
||||
#
|
||||
#
|
||||
#
|
||||
# Configuration variables:
|
||||
#
|
||||
|
@ -54,7 +54,7 @@ if [ "$1" = "config" ]; then
|
|||
echo "graph_title Slony lag time for ${PGDATABASE}"
|
||||
echo "graph_vlabel \${graph_period}"
|
||||
|
||||
psql -h ${PGHOST} -d ${PGDATABASE} -U ${PGUSER} -tc "SELECT no_id,regexp_replace(pa_conninfo, '.*host=(.*?) .*$', '\\\\1') FROM ${PGSCHEMA}.sl_node JOIN ${PGSCHEMA}.sl_path ON (pa_server=no_id) WHERE pa_client=${PGSCHEMA}.getlocalnodeid('${PGSCHEMA}'::name);" | while read node_id sep host
|
||||
psql -h ${PGHOST} -d ${PGDATABASE} -U ${PGUSER} -tc "SELECT no_id,regexp_replace(pa_conninfo, '.*host=(.*?) .*$', '\\\\1') FROM ${PGSCHEMA}.sl_node JOIN ${PGSCHEMA}.sl_path ON (pa_server=no_id) WHERE pa_client=${PGSCHEMA}.getlocalnodeid('${PGSCHEMA}'::name);" | while read node_id sep host
|
||||
do
|
||||
test -z "${node_id}" && continue
|
||||
echo "${node_id}.label ${host}"
|
||||
|
@ -68,7 +68,7 @@ if [ "$1" = "config" ]; then
|
|||
fi
|
||||
|
||||
psql -h ${PGHOST} -d ${PGDATABASE} -U ${PGUSER} -tc "SELECT st_received, extract(epoch FROM st_lag_time)::integer FROM ${PGSCHEMA}.sl_status ORDER BY 1;" | while read node_id sep time
|
||||
do
|
||||
do
|
||||
test -z "${node_id}" && continue
|
||||
echo "${node_id}.value ${time}"
|
||||
done
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
#!/bin/bash
|
||||
#
|
||||
# plugin to monitor difference between st_last_event_ts and st_last_received_ts
|
||||
# plugin to monitor difference between st_last_event_ts and st_last_received_ts
|
||||
# in sl_status table (based on slony_ and slony_lag_)
|
||||
#
|
||||
# http://blog.endpoint.com/2009/07/slony-slstatus-and-diagnosing.html
|
||||
|
@ -14,7 +14,7 @@
|
|||
# st_last_received_event_ts: the timestamp on the sl_event in that pair
|
||||
# st_lag_num_events: difference between st_last_event and st_last_received
|
||||
# st_lag_time: difference between st_last_event_ts and st_last_received_ts
|
||||
#
|
||||
#
|
||||
#
|
||||
# Configuration variables:
|
||||
#
|
||||
|
@ -54,7 +54,7 @@ if [ "$1" = "config" ]; then
|
|||
echo "graph_title Slony lag time for ${PGDATABASE}"
|
||||
echo "graph_vlabel \${graph_period}"
|
||||
|
||||
psql -h ${PGHOST} -d ${PGDATABASE} -U ${PGUSER} -tc "SELECT no_id,regexp_replace(pa_conninfo, '.*host=(.*?) .*$', '\\1') FROM ${PGSCHEMA}.sl_node JOIN ${PGSCHEMA}.sl_path ON (pa_server=no_id) WHERE pa_client=${PGSCHEMA}.getlocalnodeid('${PGSCHEMA}'::name);" | while read node_id sep host
|
||||
psql -h ${PGHOST} -d ${PGDATABASE} -U ${PGUSER} -tc "SELECT no_id,regexp_replace(pa_conninfo, '.*host=(.*?) .*$', '\\1') FROM ${PGSCHEMA}.sl_node JOIN ${PGSCHEMA}.sl_path ON (pa_server=no_id) WHERE pa_client=${PGSCHEMA}.getlocalnodeid('${PGSCHEMA}'::name);" | while read node_id sep host
|
||||
do
|
||||
test -z "${node_id}" && continue
|
||||
echo "${node_id}.label ${host}"
|
||||
|
@ -68,7 +68,7 @@ if [ "$1" = "config" ]; then
|
|||
fi
|
||||
|
||||
psql -h ${PGHOST} -d ${PGDATABASE} -U ${PGUSER} -tc "SELECT st_received, extract(epoch FROM st_lag_time)::integer FROM ${PGSCHEMA}.sl_status ORDER BY 1;" | while read node_id sep time
|
||||
do
|
||||
do
|
||||
test -z "${node_id}" && continue
|
||||
echo "${node_id}.value ${time}"
|
||||
done
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue