Improve error logging for SNMP result validation failures

Add detailed error logging to show specific validation error type and
message when SNMP results fail validation. Also handle base64 decode
failures separately.

This will help diagnose validation issues introduced by recent strict
protobuf validation changes (commit 8044a6d1).
This commit is contained in:
Graham McIntire 2026-02-06 10:36:37 -06:00 committed by Graham McIntire
parent 0a978746e1
commit a4dd7210d8
No known key found for this signature in database

View file

@ -254,10 +254,19 @@ defmodule ToweropsWeb.AgentChannel do
{:noreply, socket}
else
{:error, {type, message}} ->
Logger.error("Invalid SNMP result from agent",
Logger.error("Invalid SNMP result from agent: #{type} - #{message}",
agent_token_id: socket.assigns.agent_token_id,
error_type: type,
error_message: message
error_message: message,
binary_size: byte_size(binary_b64)
)
{:noreply, socket}
{:error, :base64_decode_failed} ->
Logger.error("Failed to decode SNMP result (invalid base64)",
agent_token_id: socket.assigns.agent_token_id,
binary_size: byte_size(binary_b64)
)
{:noreply, socket}