<.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"> <.link navigate={~p"/orgs/#{@current_organization.slug}/agents/#{agent.id}"} class="font-medium text-blue-600 hover:text-blue-700 dark:text-blue-400 dark:hover:text-blue-300" > {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="Equipment"> <% counts = Map.get(@equipment_counts, agent.id, %{direct: 0, total: 0}) %>
{counts.total} total
{counts.direct} direct <%= if counts.total > counts.direct do %> ยท {counts.total - counts.direct} inherited <% end %>
<:col :let={agent} label="Last Seen">
{format_last_seen(agent.last_seen_at)}
<%= if agent.last_seen_at do %>
{format_datetime(agent.last_seen_at)}
<% end %> <%= 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 Setup Instructions

Use the token and Docker Compose configuration below to deploy this agent.

{@new_token.agent_token.name}

Docker Compose Example

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