diff --git a/lib/towerops_web/channels/agent_channel.ex b/lib/towerops_web/channels/agent_channel.ex index 1cf7ce68..9543d6b8 100644 --- a/lib/towerops_web/channels/agent_channel.ex +++ b/lib/towerops_web/channels/agent_channel.ex @@ -1163,6 +1163,28 @@ defmodule ToweropsWeb.AgentChannel do process_polling_result(device, result, socket) end + defp process_job_result(device, %{job_type: :PING} = result, socket) do + # Backward compatibility: older agents send PING results as SnmpResult instead of MonitoringCheck + # Newer agents should use the "monitoring_check" event instead + Logger.warning("Agent sent PING result as SnmpResult (deprecated). Agent should be upgraded.", + agent_token_id: socket.assigns.agent_token_id, + device_id: device.id, + job_id: result.job_id + ) + + # PING jobs sent as SnmpResult have empty oid_values + # If we receive a result (not an error), assume success + check = %{ + device_id: device.id, + status: "success", + # Unknown - older agents don't send this + response_time_ms: 0.0, + timestamp: result.timestamp + } + + store_monitoring_check(check, socket) + end + defp process_discovery_result(device, result, socket) do Logger.info("Discovery results received from agent for #{device.name}, processing data")