We could have the metacat daemon polling and logging information like database connections, and slow queries
with variations on queries to pg_stat_activity in Postgresql:
SELECT client_addr, client_start, query_start, query FROM pg_stat_activity WHERE datname = 'hypot_dm_dev' and state='active' ;
we could then report connection counts to Landscape and long-running queries.
Or perhaps
'select client_addr, count(*) from pg_stat_activity WHERE datname = 'hypot_dm_dev' group by client_addr;'
Sample of getting this from psql:
dune_metadata_prd=> select client_addr, count(*) from pg_stat_activity WHERE datname = 'dune_metadata_prd' group by client_addr;
client_addr | count
-----------------+-------
131.225.67.132 | 4
131.225.67.133 | 4
131.225.67.247 | 1
131.225.108.42 | 1
131.225.240.229 | 4
131.225.240.230 | 4
dune_metadata_prd=> select client_addr, count(*) from pg_stat_activity WHERE datname = 'dune_metadata_prd' and state='active' group by client_addr;
client_addr | count
----------------+-------
131.225.67.247 | 1
Note that we always see ourselves in the results (dunegpvm02 = 131.225.67.247 in this example), and so we should
not count our connection in the results...
We could have the metacat daemon polling and logging information like database connections, and slow queries
with variations on queries to
pg_stat_activityin Postgresql:SELECT client_addr, client_start, query_start, query FROM pg_stat_activity WHERE datname = 'hypot_dm_dev' and state='active' ;we could then report connection counts to Landscape and long-running queries.
Or perhaps
'select client_addr, count(*) from pg_stat_activity WHERE datname = 'hypot_dm_dev' group by client_addr;'
Sample of getting this from psql:
Note that we always see ourselves in the results (dunegpvm02 = 131.225.67.247 in this example), and so we should
not count our connection in the results...