Révision 17f78427
Whitespace cleanup
- remove trailing whitespace
- remove empty lines at the end of files
| plugins/postgresql/slony_lag_time | ||
|---|---|---|
| 1 | 1 |
#!/bin/bash |
| 2 | 2 |
# |
| 3 |
# plugin to monitor difference between st_last_event_ts and st_last_received_ts
|
|
| 3 |
# plugin to monitor difference between st_last_event_ts and st_last_received_ts |
|
| 4 | 4 |
# in sl_status table (based on slony_ and slony_lag_) |
| 5 | 5 |
# |
| 6 | 6 |
# http://blog.endpoint.com/2009/07/slony-slstatus-and-diagnosing.html |
| ... | ... | |
| 14 | 14 |
# st_last_received_event_ts: the timestamp on the sl_event in that pair |
| 15 | 15 |
# st_lag_num_events: difference between st_last_event and st_last_received |
| 16 | 16 |
# st_lag_time: difference between st_last_event_ts and st_last_received_ts |
| 17 |
#
|
|
| 17 |
# |
|
| 18 | 18 |
# |
| 19 | 19 |
# Configuration variables: |
| 20 | 20 |
# |
| ... | ... | |
| 54 | 54 |
echo "graph_title Slony lag time for ${PGDATABASE}"
|
| 55 | 55 |
echo "graph_vlabel \${graph_period}"
|
| 56 | 56 |
|
| 57 |
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
|
|
| 57 |
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
|
|
| 58 | 58 |
do |
| 59 | 59 |
test -z "${node_id}" && continue
|
| 60 | 60 |
echo "${node_id}.label ${host}"
|
| ... | ... | |
| 68 | 68 |
fi |
| 69 | 69 |
|
| 70 | 70 |
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
|
| 71 |
do
|
|
| 71 |
do |
|
| 72 | 72 |
test -z "${node_id}" && continue
|
| 73 | 73 |
echo "${node_id}.value ${time}"
|
| 74 | 74 |
done |
Formats disponibles : Unified diff