<.header> {@page_title} <:subtitle>Manage remote agents for local SNMP polling <:actions> <.button phx-click={JS.show(to: "#new-agent-form")} variant="primary"> <.icon name="hero-plus" class="h-5 w-5" /> New Agent <%= if @agent_tokens == [] do %>
<.icon name="hero-server" class="mx-auto h-12 w-12 text-zinc-400 dark:text-zinc-600" />

No agents

Get started by creating your first remote agent.

<.button phx-click={JS.show(to: "#new-agent-form")} variant="primary"> <.icon name="hero-plus" class="h-5 w-5" /> New Agent
<% else %>
<.table id="agents-table" rows={@agent_tokens}> <:col :let={agent} label="Name">
{agent.name}
<%= if agent.metadata["version"] do %>
v{agent.metadata["version"]}
<% end %> <:col :let={agent} label="Status"> <% {status, label} = agent_status(agent) %> {label} <:col :let={agent} label="Last Seen">
{format_last_seen(agent.last_seen_at)}
<%= if agent.last_ip do %>
{agent.last_ip}
<% end %> <:col :let={agent} label="Metadata"> <%= if agent.metadata["hostname"] do %>
<.icon name="hero-computer-desktop" class="h-4 w-4 inline" /> {agent.metadata["hostname"]}
<% end %> <:col :let={agent} label="Created">
{Calendar.strftime(agent.inserted_at, "%b %d, %Y")}
<:action :let={agent}> <%= if agent.enabled do %> <% else %> Revoked <% end %>
<% end %> <%= if @show_token_modal && @new_token do %>

Agent Created Successfully

Copy this token now - it will never be shown again!

{@new_token.agent_token.name}

Docker Compose Example

version: '3.8'
services:
  towerops-agent:
    image: towerops/agent:latest
    restart: unless-stopped
    environment:
      - TOWEROPS_API_URL={url(@socket, ~p"/")}
      - TOWEROPS_AGENT_TOKEN={@new_token.token}
    volumes:
      - ./data:/data
<.button phx-click="close_token_modal" variant="primary"> I've Saved the Token
<% end %>