damienstuart / trapex

An SNMP Trap forwarder/relay
MIT License
11 stars 2 forks source link

Store received traps for answering an SNMP GetRequest later? #47

Open C-Duv opened 2 years ago

C-Duv commented 2 years ago

Hello,

Is it possible (or planned) for Trapex to store the SNMP traps it receives and serve them when receiving an SNMP GetRequest?

My goal is to monitor a device (an SNMP agent) from an SNMP Manager that supports sending GetRequest but cannot reach the device directory (not on the same network, device behind NAT/firewall).

My idea would be the following setup:

  1. Both Trapex and Manager can reach each other (both are publicly accessible via Internet).
  2. The device can contact Trapex (it has Internet access).
  3. The device sends it's SNMP traps to Trapex.
  4. Trapex keeps the received values (overwriting any previous value)
  5. The Manager (periodically) asks Trapex for values by sending it an SNMP GetRequest.
  6. Trapex answers with an SNMP GetResponse populated with the values it had stored in 4.

It's a workaround for the NAT issue by transforming impossible GetRequest (pull) into traps (push) + GetResponse without modifying the Manager.

(Note: inspiration for this workflow is from the Prometheus Pushgateway)

keruzu commented 2 years ago

You’re talking about RMON-like functionality, which will allow you to proxy metrics. SNMP traps are different objects in a MIB, and are like events. Do a Google search for RMON and that should be what you’re looking for.