File tree Expand file tree Collapse file tree 3 files changed +9
-9
lines changed Expand file tree Collapse file tree 3 files changed +9
-9
lines changed Original file line number Diff line number Diff line change @@ -32,9 +32,9 @@ class Pool(object):
32
32
'select public.mamonsu_count_autovacuum()'
33
33
),
34
34
'buffer_cache' : (
35
- "select sum(1) * 8 * 1024 as size, "
36
- " sum(case when usagecount > 1 then 1 else 0 end) * 8 * 1024 as twice_used, "
37
- " sum(case isdirty when true then 1 else 0 end) * 8 * 1024 as dirty "
35
+ "select sum(1) * (current_setting('block_size')::int8) as size, "
36
+ " sum(case when usagecount > 1 then 1 else 0 end) * (current_setting('block_size')::int8) as twice_used, "
37
+ " sum(case isdirty when true then 1 else 0 end) * (current_setting('block_size')::int8) as dirty "
38
38
" from public.pg_buffercache" ,
39
39
'select size, twice_used, dirty from public.mamonsu_buffer_cache()'
40
40
),
Original file line number Diff line number Diff line change 7
7
class PgBufferCache (Plugin ):
8
8
AgentPluginType = 'pg'
9
9
key = 'pgsql.buffers{0}'
10
- query_agent_size = "select sum(1) * 8 * 1024 as size from public.pg_buffercache;" # for zabbix
11
- query_agent_twice_used = "select sum(case when usagecount > 1 then 1 else 0 end) * 8 * 1024 as twice_used " \
10
+ query_agent_size = "select sum(1) * (current_setting('block_size')::int8) as size from public.pg_buffercache;" # for zabbix
11
+ query_agent_twice_used = "select sum(case when usagecount > 1 then 1 else 0 end) * (current_setting('block_size')::int8) as twice_used " \
12
12
"from public.pg_buffercache;" # for zabbix
13
- query_agent_dirty = "select sum(case isdirty when true then 1 else 0 end) * 8 * 1024 as dirty " \
13
+ query_agent_dirty = "select sum(case isdirty when true then 1 else 0 end) * (current_setting('block_size')::int8) as dirty " \
14
14
"from public.pg_buffercache;" # for zabbix
15
15
query = [query_agent_size , query_agent_twice_used , query_agent_dirty ]
16
16
Items = [
Original file line number Diff line number Diff line change 95
95
CREATE OR REPLACE FUNCTION public.mamonsu_buffer_cache()
96
96
RETURNS TABLE(SIZE BIGINT, TWICE_USED BIGINT, DIRTY BIGINT) AS $$
97
97
SELECT
98
- SUM(1) * 8 * 1024 ,
99
- SUM(CASE WHEN usagecount > 1 THEN 1 ELSE 0 END) * 8 * 1024 ,
100
- SUM(CASE isdirty WHEN true THEN 1 ELSE 0 END) * 8 * 1024
98
+ SUM(1) * (current_setting('block_size')::int8) ,
99
+ SUM(CASE WHEN usagecount > 1 THEN 1 ELSE 0 END) * (current_setting('block_size')::int8) ,
100
+ SUM(CASE isdirty WHEN true THEN 1 ELSE 0 END) * (current_setting('block_size')::int8)
101
101
FROM public.pg_buffercache
102
102
$$ LANGUAGE SQL SECURITY DEFINER;
103
103
You can’t perform that action at this time.
0 commit comments