mirror of
https://github.com/munin-monitoring/contrib.git
synced 2025-07-22 02:51:03 +00:00
Initial version
This commit is contained in:
parent
e3ecbdf911
commit
090a44055b
1 changed files with 57 additions and 0 deletions
57
plugins/other/postgresql_active_locks
Executable file
57
plugins/other/postgresql_active_locks
Executable file
|
@ -0,0 +1,57 @@
|
|||
#!/bin/bash
|
||||
#
|
||||
# Plugin to monitor PostgreSQL Locks
|
||||
#
|
||||
# Author:
|
||||
# Guilherme Augusto da Rocha Silva <gars.dba@gmail.com>
|
||||
#
|
||||
# Created:
|
||||
# 5th of november 2007
|
||||
#
|
||||
# Usage:
|
||||
# Place in /etc/munin/plugins/ (or link it there using ln -s)
|
||||
#
|
||||
# Parameters:
|
||||
# config (required)
|
||||
#
|
||||
# General info:
|
||||
# Require permission for database access and read (no writes are processed).
|
||||
# Recomended user is PostgreSQL database owner (default: postgres).
|
||||
#
|
||||
# Log info:
|
||||
#
|
||||
|
||||
dbserver='localhost'
|
||||
dbuser='postgres'
|
||||
|
||||
if [ "$1" = "config" ]; then
|
||||
echo 'graph_args --lower-limit 0'
|
||||
echo 'graph_category Postgresql'
|
||||
echo 'graph_info Shows active locks on database server.'
|
||||
echo 'graph_scale no'
|
||||
echo 'graph_title PostgreSQL Active Locks'
|
||||
echo 'graph_vlabel Number of active locks'
|
||||
echo 'AccessExclusive.label AccessExclusive'
|
||||
echo 'AccessExclusive.info Access Exclusive Lock.'
|
||||
echo 'AccessShare.label AccessShare'
|
||||
echo 'AccessShare.info Access Share Lock.'
|
||||
echo 'Exclusive.label Exclusive'
|
||||
echo 'Exclusive.info Exclusive Lock.'
|
||||
echo 'RowExclusive.label RowExclusive'
|
||||
echo 'RowExclusive.info Row Exclusive Lock.'
|
||||
echo 'RowShare.label RowShare'
|
||||
echo 'RowShare.info Row Share Lock.'
|
||||
echo 'Share.label Share'
|
||||
echo 'Share.info Share Lock.'
|
||||
echo 'ShareRowExclusive.label ShareRowExclusive'
|
||||
echo 'ShareRowExclusive.info Share Row Exclusive Lock.'
|
||||
echo 'ShareUpdateExclusive.label ShareUpdateExclusive'
|
||||
echo 'ShareUpdateExclusive.info Share Update Exclusive Lock.'
|
||||
exit 0
|
||||
fi
|
||||
|
||||
psql -h ${dbserver} -U ${dbuser} -tc "SELECT trim(mode, 'Lock'), COUNT(*) FROM pg_locks GROUP BY mode ORDER BY 1;" | while read name sep num
|
||||
do
|
||||
test -z "${name}" && continue
|
||||
echo ${name}'.value '${num}
|
||||
done
|
Loading…
Add table
Add a link
Reference in a new issue