title: Graph historical program status data in M/Monit
body: <p>I would like to use monit and M/Monit to monitor our Postgresql database. Setting it up to monitor the Postgresql process is simple enough. The next most important thing for us to monitor is the number of connections. </p>
  
  <h1>Current solution</h1>
  
  <p>I can write a bash script that will query the number of connections. The script will exit with a status code equal to the number of connections. I can call this script from Monit using </p>
  
  <pre><code>check program pg-replication-lag with path /tmp/count-connections.sh
      if status &gt; 45 then alert
  </code></pre>
  
  <p>This will alert if more than 45 connections are consumed. </p>
  
  <h1>Problem</h1>
  
  <p>While getting alerts in such situations is very important, we would also like to visualize the number of connections over time. M/Monit has some great graphs of systems variables like RAM, CPU, etc..., but I do not see any way of graphing a <code>check program</code> status value in M/Monit, but I hope that I am just overlooking it.</p>
  
  <p>Is it possible to graph arbitrary data collected by <code>check program</code>? Can anyone think of a better way to collect this data and visualize it in M/Monit?</p>
  
  <p>PS: Though I used the number of connections as an example here, there is other numeric data that we would like to plot over time as well (e.g. replication lag).</p>