title: monitoring number of postgresql connections
body: <p>I'd like to monitor on my Zabbix server the number of concurrent PostgreSQL connections, so I've created a cron job that outputs the COUNT of rows on the pg_stat_activity to a file, that will be read by zabbix once a minute.</p>
  
  <p>My problem is that I might have a scenario where I get a COUNT of, say, 10, then have a quick peak of 50 connections, get back to 10, where I do the COUNT again.
    In this case the peak would not be noticed.</p>
  
  <p>I've wondered about some counter being inc/dec each connection/disconnection, but failed to think how to do this.
    Also I could do the COUNT on a higher frequency and keep an average per minute, but this not solve the problem.</p>
  
  <p>Any thougts in that matter?</p>
  
  <p>Thanks,
  Gabriel</p>