etingof / snmpfwd

SNMP Proxy Forwarder
http://snmplabs.com/snmpfwd/
BSD 2-Clause "Simplified" License
67 stars 18 forks source link

Multiplexing clients #44

Closed xaled1 closed 4 years ago

xaled1 commented 4 years ago

Hi,

I was able to run server and client side of snmpfwd and now want to realize the final configuration. It should be one central server and two clients on two hosts. Two clients are connected to two identical applications with the same oids. Now I want to map the same OIDs at the hosts to different OIDs at the server. This way it would be possible to query the server for different OIDs and get the response from the right host. I got the idea of trunks so far, but not sure how to get the mapping between the trunks and OIDs going.

etingof commented 4 years ago

Good progress so far!

However it seems the scenario you have in mind would need some tweaking. I just checked the code - neither per-OID matching nor request OID rewriting is currently implemented. But it can be done and it would be a good feature!

Meanwhile, can you use something other than request OID as a routing condition?

xaled1 commented 4 years ago

I'm glad I was able to describe my scenario in a meaningful way and that you found the use case interesting. I could use two server instances on different ports on same host and have each instance talk to one client only but that would be an ugly workaround. This is what I could think of at the moment.

etingof commented 4 years ago

You do not need to server instances for that. Instead you can have a single server listening on two distinct ports (or NICs), then routing incoming requests based on the transport endpoint ID that received this query.

The other way would be to use different SNMP community or SNMPv3 context names.

Either way you'd end up with one server instance talking to a pair of clients.

But you are right - routing based on PDU context and rewriting it on the fly would be way more usable!

xaled1 commented 4 years ago

Routing based on snmp community or cotext name would be the good interim solution. Thank you for the idea! In the final configuration I want to have two servers on different hosts under the same dns name for failover reasons. I did not look in to it in details yet but I assume it should be possible for clients to talk to multiple servers.

etingof commented 4 years ago

It is indeed possible to connect many clients to many servers via trunks and vice versa.

xaled1 commented 4 years ago

Great, I will start with community or context solution first and will migrate to OID routing once it will become available. Thank you.

xaled1 commented 4 years ago

One more thing - is it possible for client to run some shell/perl/python script based on requested OID and return the stdout from script as OID value? Something like in nagios nrpe?