anchor.diff:        ValuesFrom "value"
       </Result>
     </Query>
  -  <Query "agents_down">
  +  <Query "<%= @dbname %>_<%= @type %>_down">
       Statement "select concat_ws('.', 'agents', replace(replace(a1.binary, '-agent', ''), 'neutron-', ''), 'down') as metric, count(a2.id) as value from agents a1 left outer join agents a2 on a1.id = a2.id and a1.admin_state_up=1 and timestampdiff(SECOND,a1.heartbeat_timestamp,utc_timestamp())><%= @downtime %> group by a1.binary;"
       MinVersion 50000
       <Result>
  
positive.code:   </Query>
  <% end %>
  <% if @type == 'agents' %>
    <Query "agents">
      Statement "select concat_ws('.', 'agents', replace(replace(a.binary, '-agent', ''), 'neutron-', ''), 'down', a.host) as metric, 1 as value from agents a where a.admin_state_up=1 and timestampdiff(SECOND,a.heartbeat_timestamp,utc_timestamp())><%= @downtime %> group by a.binary, a.host UNION select concat_ws('.', 'agents', replace(replace(a.binary, '-agent', ''), 'neutron-', ''), 'up', a.host) as metric, 0 as value from agents a where a.admin_state_up=1 and timestampdiff(SECOND,a.heartbeat_timestamp,utc_timestamp())<=<%= @downtime %> group by a.binary, a.host UNION select concat_ws('.', 'agents', replace(replace(a.binary, '-agent', ''), 'neutron-', ''), 'disabled', a.host) as metric, 2 as value from agents a where a.admin_state_up=0 group by a.binary, a.host;"
      MinVersion 50000
      <Result>
  
negative.code:     DriverOption "password" "<%= @password %>"
      DriverOption "dbname" "<%= @dbname %>"
      SelectDB "<%= @dbname %>"
      Query "<%= @dbname %>_<%= @type %>_disabled"
      Query "<%= @dbname %>_<%= @type %>_up"
      Query "<%= @dbname %>_<%= @type %>_down"
      Query "<%= @dbname %>_<%= @type %>"
    </Database>
  </Plugin>
  