{{template "head" "Agents"}}
{{template "nav" "agents"}}

<h2 class="section-title">Agent Metrics</h2>

{{if .Agents.Available}}
<div class="grid">
  <div class="card">
    <h3>Registered Agents</h3>
    <div class="value">{{.Agents.RegisteredTotal}}</div>
    <div class="sub">
      {{if .Agents.ExporterUp}}<span class="badge badge-ok">exporter up</span>
      {{else}}<span class="badge badge-err">exporter down</span>{{end}}
    </div>
  </div>

  <div class="card">
    <h3>Queue Pending</h3>
    <div class="value">{{.Agents.QueuePending}}</div>
    <div class="sub">Tasks waiting for agents</div>
  </div>

  <div class="card">
    <h3>Tasks Completed</h3>
    <div class="value" style="color:var(--green)">{{.Agents.TasksCompleted}}</div>
    <div class="sub">Total successful</div>
  </div>

  <div class="card">
    <h3>Tasks Failed</h3>
    <div class="value" style="color:var(--red)">{{.Agents.TasksFailed}}</div>
    <div class="sub">Total failures</div>
  </div>
</div>

<div class="grid">
  <div class="card">
    <h3>Capabilities</h3>
    <div class="value">{{.Agents.Capabilities}}</div>
    <div class="sub">Registered capabilities</div>
  </div>

  <div class="card">
    <h3>Heartbeat Age</h3>
    <div class="value">{{pct .Agents.HeartbeatAge}}s</div>
    <div class="sub">Time since last heartbeat</div>
  </div>
</div>
{{else}}
<div class="card empty">
  <p>Agent metrics not available. The Prometheus agent exporter may be offline.</p>
  <p style="margin-top:.5rem;font-size:.8125rem;color:var(--muted)">Expected at: <code>localhost:9402/metrics</code></p>
</div>
{{end}}

{{template "footer"}}
