Skip to content

Commit

Permalink
Fix issue with PostgreSQL 10. Only count lines related to client
Browse files Browse the repository at this point in the history
connection as 'connections' by using new column backend_type filtering
for 'client connection'.
  • Loading branch information
shuehner committed Dec 13, 2018
1 parent 27477b8 commit 6ffb285
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion plugins/node.d/postgres_connections_.in
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ my $pg = Munin::Plugin::Pgsql->new(
LEFT JOIN
(SELECT CASE WHEN wait_event_type IS NOT NULL THEN 'waiting' WHEN state='idle' THEN 'idle' WHEN state LIKE 'idle in transaction%' THEN 'idletransaction' WHEN state='disabled' THEN 'unknown' WHEN query='<insufficient privilege>' THEN 'unknown' ELSE 'active' END AS mstate,
count(*) AS count
FROM pg_stat_activity WHERE pid != pg_backend_pid() %%FILTER%%
FROM pg_stat_activity WHERE pid != pg_backend_pid() AND backend_type = 'client connection' %%FILTER%%
GROUP BY CASE WHEN wait_event_type IS NOT NULL THEN 'waiting' WHEN state='idle' THEN 'idle' WHEN state LIKE 'idle in transaction%' THEN 'idletransaction' WHEN state='disabled' THEN 'unknown' WHEN query='<insufficient privilege>' THEN 'unknown' ELSE 'active' END
) AS tmp2
ON tmp.mstate=tmp2.mstate
Expand Down

0 comments on commit 6ffb285

Please sign in to comment.