Skip to content

Commit 6c1da9a

Browse files
authored
Merge pull request #124 from nikolaev-rd/patch-1
Rename query to transaction
2 parents cbaec97 + adb01da commit 6c1da9a

File tree

2 files changed

+10
-10
lines changed

2 files changed

+10
-10
lines changed

README.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -220,7 +220,7 @@ Metrics: PostgreSQL
220220
'PostgreSQL locks: Locks from application': pgsql.pg_locks[sharerowexclusive]
221221
'PostgreSQL locks: Locks from application or some operation on system catalogs': pgsql.pg_locks[exclusive]
222222
'PostgreSQL locks: ALTER TABLE, DROP TABLE, TRUNCATE, REINDEX, CLUSTER, VACUUM FULL, LOCK TABLE': pgsql.pg_locks[accessexclusive]
223-
'PostgreSQL oldest query running time': pgsql.oldest[query_time]
223+
'PostgreSQL oldest transaction running time': pgsql.oldest[transaction_time]
224224
'PostgreSQL age of oldest xid': pgsql.oldest[xid_age]
225225
'PostgreSQL waits: Lightweight locks': pgsql.all_lock[lwlock]
226226
'PostgreSQL waits: Heavyweight locks': pgsql.all_lock[hwlock]

mamonsu/plugins/pgsql/oldest.py

+9-9
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ class Oldest(Plugin):
2828

2929
DEFAULT_CONFIG = {
3030
'max_xid_age': str(5000 * 60 * 60),
31-
'max_query_time': str(5 * 60 * 60)
31+
'max_transaction_time': str(5 * 60 * 60)
3232
}
3333

3434
def run(self, zbx):
@@ -40,13 +40,13 @@ def run(self, zbx):
4040
query = Pooler.query(self.OldestQuerySql)[0][0]
4141

4242
zbx.send('pgsql.oldest[xid_age]', xid)
43-
zbx.send('pgsql.oldest[query_time]', query)
43+
zbx.send('pgsql.oldest[transaction_time]', query)
4444

4545
def graphs(self, template):
4646
result = template.graph({
47-
'name': 'PostgreSQL oldest query running time',
47+
'name': 'PostgreSQL oldest transaction running time',
4848
'items': [{
49-
'key': 'pgsql.oldest[query_time]',
49+
'key': 'pgsql.oldest[transaction_time]',
5050
'color': '00CC00'
5151
}]
5252
})
@@ -65,8 +65,8 @@ def items(self, template):
6565
'name': 'PostgreSQL: age of oldest xid',
6666
'value_type': Plugin.VALUE_TYPE.numeric_unsigned
6767
}) + template.item({
68-
'key': 'pgsql.oldest[query_time]',
69-
'name': 'PostgreSQL: oldest query running time in sec',
68+
'key': 'pgsql.oldest[transaction_time]',
69+
'name': 'PostgreSQL: oldest transaction running time in sec',
7070
'units': Plugin.UNITS.s
7171
})
7272

@@ -76,7 +76,7 @@ def triggers(self, template):
7676
'expression': '{#TEMPLATE:pgsql.oldest[xid_age]'
7777
'.last()}>' + self.plugin_config('max_xid_age')
7878
}) + template.trigger({
79-
'name': 'PostgreSQL query running is too old on {HOSTNAME}',
80-
'expression': '{#TEMPLATE:pgsql.oldest[query_time]'
81-
'.last()}>' + self.plugin_config('max_query_time')
79+
'name': 'PostgreSQL transaction running is too old on {HOSTNAME}',
80+
'expression': '{#TEMPLATE:pgsql.oldest[transaction_time]'
81+
'.last()}>' + self.plugin_config('max_transaction_time')
8282
})

0 commit comments

Comments
 (0)