<.header> {@page_title} <:subtitle>{t("Agent Details and Health")} <:actions> <.link navigate={~p"/agents/#{@agent_token.id}/edit"} class="inline-flex items-center gap-2 rounded-lg px-3.5 py-2.5 text-sm font-semibold shadow-sm focus:outline-none focus:ring-2 focus:ring-offset-2 disabled:opacity-50 disabled:cursor-not-allowed bg-blue-600 text-white hover:bg-blue-700 focus:ring-blue-500 dark:bg-blue-500 dark:hover:bg-blue-600" > <.icon name="hero-pencil" class="h-5 w-5" /> <.link navigate={~p"/agents"} class="inline-flex items-center gap-2 text-sm font-semibold text-gray-700 dark:text-gray-300 hover:text-gray-900 dark:hover:text-white" > <.icon name="hero-arrow-left" class="h-5 w-5" />

Debug Status: {if @agent_token.allow_remote_debug, do: "Enabled ✓", else: "Disabled"}

<%= if @agent_token.allow_remote_debug do %> {t("Verbose logging is enabled. All SNMP data and agent messages are being logged.")} <% else %> {t( "Verbose logging is disabled. Enable it in the agent edit page to troubleshoot issues." )} <% end %>

{t("View Debug Logs")}

{t("Production (kubectl):")}

kubectl logs -n towerops deployment/towerops --tail=100 | grep "agent_token_id: {@agent_token.id}"

{t("Development (tail):")}

tail -f _build/dev/lib/towerops/priv/log/dev.log | grep "{@agent_token.id}"

{t("What Gets Logged:")}

  • Agent connection/disconnection events
  • Job submissions (device IDs and job types)
  • SNMP discovery results (full OID maps)
  • Polling results (sensor readings, interface stats)
  • Error messages with full context
  • Ping submissions

Status

<% {status, label} = agent_status(@agent_token) %>
{label}
<.icon name="hero-signal" class="h-8 w-8 text-gray-400 dark:text-gray-500" />

Device

{length(@polling_targets)}

{@direct_assignments} direct

<.icon name="hero-server" class="h-8 w-8 text-gray-400 dark:text-gray-500" />

Last Seen

<.timestamp datetime={@agent_token.last_seen_at} timezone={@timezone} />

<%= if @agent_token.last_seen_at do %>

<.timestamp datetime={@agent_token.last_seen_at} timezone={@timezone} format="absolute" />

<% end %> <%= if @agent_token.last_ip do %>

{@agent_token.last_ip}

<% end %>
<.icon name="hero-clock" class="h-8 w-8 text-gray-400 dark:text-gray-500 flex-shrink-0" />

Uptime

<%= if @agent_token.metadata["uptime_seconds"] do %>

{format_uptime(@agent_token.metadata["uptime_seconds"])}

<% else %>

{t("Unknown")}

<% end %>
<.icon name="hero-clock" class="h-8 w-8 text-gray-400 dark:text-gray-500" />
<%= if @agent_token.metadata && map_size(@agent_token.metadata) > 0 do %>

{t("Agent Details")}

<%= if @agent_token.metadata["version"] do %>
Version
{format_agent_version(@agent_token.metadata["version"])}
<% end %> <%= if @agent_token.metadata["uptime_seconds"] do %>
Uptime
{format_uptime(@agent_token.metadata["uptime_seconds"])}
<% end %>
<% end %>

{t("Timestamps")}

Created
<.timestamp datetime={@agent_token.inserted_at} timezone={@timezone} />
Last Updated
<.timestamp datetime={@agent_token.updated_at} timezone={@timezone} />
{t("Last Seen (Heartbeat)")}
<.timestamp datetime={@agent_token.last_seen_at} timezone={@timezone} />
<%= if @agent_token.last_ip do %>
Last IP Address
{@agent_token.last_ip}
<% end %>

{t("Polling Targets")}

{t("Device that this agent is responsible for polling")}

<%= if @polling_targets == [] do %>
<.icon name="hero-server" class="mx-auto h-12 w-12 text-gray-400 dark:text-gray-500" />

{t("No devices assigned")}

{t("This agent is not currently polling any device.")}

<% else %>
<%= for device <- @polling_targets do %> <.link navigate={~p"/devices/#{device.id}"} class="block hover:bg-gray-50 dark:hover:bg-gray-800 transition-colors" >

{device.name}

<% {source, source_label} = assignment_source(device, @agent_token.id) %> {source_label}
<.icon name="hero-globe-alt" class="h-4 w-4" /> {device.ip_address} <%= if device.site do %> <.icon name="hero-building-office" class="h-4 w-4" /> {device.site.name} <% end %>
<.icon name="hero-chevron-right" class="h-5 w-5 text-gray-400 dark:text-gray-500" />
<% end %>
<% end %>