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):
3232 'select public.mamonsu_count_autovacuum()'
3333 ),
3434 '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 "
3838 " from public.pg_buffercache" ,
3939 'select size, twice_used, dirty from public.mamonsu_buffer_cache()'
4040 ),
Original file line number Diff line number Diff line change 77class PgBufferCache (Plugin ):
88 AgentPluginType = 'pg'
99 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 " \
1212 "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 " \
1414 "from public.pg_buffercache;" # for zabbix
1515 query = [query_agent_size , query_agent_twice_used , query_agent_dirty ]
1616 Items = [
Original file line number Diff line number Diff line change 9595CREATE OR REPLACE FUNCTION public.mamonsu_buffer_cache()
9696RETURNS TABLE(SIZE BIGINT, TWICE_USED BIGINT, DIRTY BIGINT) AS $$
9797SELECT
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)
101101FROM public.pg_buffercache
102102$$ LANGUAGE SQL SECURITY DEFINER;
103103
You can’t perform that action at this time.
0 commit comments