title: Grafana / Graphite - the time metric was in some state
body: <p>I have metric "monitor.status" with values 0 and 1. 0 indicating service down state and 1 - up state.</p>
  
  <p>I'd like to render downtime period in seconds in Single stat panel. How to get the time metric was in 0 state and render it?</p>
  
  <p>Example:</p>
  
  <pre>
  Value - Timestamp (just h:m to simplify)
  1 - 05:00
  1 - 05:05
  0 - 05:07
  0 - 05:09
  1 - 05:11
  0 - 05:16
  0 - 05:18
  
  Here metric was is "0" state for 4 minutes. This is the value I'd like to get.
  </pre>
  
  <p>Do you have any suggestions how to track downtime period correctly in graphite?</p>