root / plugins / postgresql / postgresql_transactions @ 97ab640b
Historique | Voir | Annoter | Télécharger (1,29 ko)
| 1 | 98df7ce7 | Guilherme Augusto da Rocha Silva | #!/bin/bash |
|---|---|---|---|
| 2 | # |
||
| 3 | # Plugin to monitor PostgreSQL Commits and Rollbacks in Transactions |
||
| 4 | # |
||
| 5 | # Author: |
||
| 6 | # Guilherme Augusto da Rocha Silva <gars.dba@gmail.com> |
||
| 7 | # |
||
| 8 | # Created: |
||
| 9 | # 9th of november 2007 |
||
| 10 | # |
||
| 11 | # Usage: |
||
| 12 | # Place in /etc/munin/plugins/ (or link it there using ln -s) |
||
| 13 | # |
||
| 14 | # Parameters: |
||
| 15 | # config (required) |
||
| 16 | # |
||
| 17 | # General info: |
||
| 18 | # Require permission for database access and read (no writes are processed). |
||
| 19 | fba800ae | Veres Lajos | # Recommended user is PostgreSQL database owner (default: postgres). |
| 20 | 98df7ce7 | Guilherme Augusto da Rocha Silva | # |
| 21 | # Log info: |
||
| 22 | # |
||
| 23 | |||
| 24 | dbserver='localhost' |
||
| 25 | dbuser='postgres' |
||
| 26 | |||
| 27 | if [ "$1" = "config" ]; then |
||
| 28 | echo 'graph_args --base 1000 --lower-limit 0' |
||
| 29 | 29bdf34e | dipohl | echo 'graph_category db' |
| 30 | 98df7ce7 | Guilherme Augusto da Rocha Silva | echo 'graph_info Shows summarized commits and rollbacks in transactions on the PostgreSQL Server.' |
| 31 | echo 'graph_title PostgreSQL Transactions' |
||
| 32 | echo 'graph_vlabel Number of Commits and Rollbacks' |
||
| 33 | |||
| 34 | echo 'commits.label commits' |
||
| 35 | echo 'commits.min 0' |
||
| 36 | 97ab640b | André de Kock | echo 'commits.type COUNTER' |
| 37 | 98df7ce7 | Guilherme Augusto da Rocha Silva | echo 'commits.info Number of transaction commits.' |
| 38 | |||
| 39 | echo 'rollbacks.label rollbacks' |
||
| 40 | echo 'rollbacks.min 0' |
||
| 41 | 97ab640b | André de Kock | echo 'rollbacks.type COUNTER' |
| 42 | 98df7ce7 | Guilherme Augusto da Rocha Silva | echo 'rollbacks.info Number of transaction rollbacks.' |
| 43 | exit 0 |
||
| 44 | fi |
||
| 45 | 89898512 | André de Kock | psql -h ${dbserver} -U ${dbuser} -tc "SELECT 'commits.value '||SUM(xact_commit)::TEXT||E'\nrollbacks.value '||SUM(xact_rollback)::TEXT FROM pg_stat_database;" --no-align |
