-->

SNMP V3 discovery fails using SnmpSharpNet

2019-08-21 02:29发布

问题:

I am having a issue with UdpTarget.Discovery(SecParam) in various servers (Linux variants) where SNMP is setup. In those servers where both V1 and V3 targets are defined the Discovery works and returns as true. Where the V1 target is not defined (i.e., v1 community string is not configured) and only V3 is defined, the UdpTarget.Discovery(SecParam) fails with the error message : Request has reached maximum retries.. The relevant part of code is

    IpAddress agent = new IpAddress(ip);
    UdpTarget target = new UdpTarget((IPAddress)agent, 161, 3000, 3);// Construct target
    SecureAgentParameters SecParam = new SecureAgentParameters();
    var checkDiscovery = target.Discovery(SecParam);

Can anyone please help explain (a) whether there is indeed a linkage between V3 and V1 for UdpTarget.Discovery method? (b) if No, What should be done to make it work?

Just wanted to add that using linux command line tools such as snmpwalk - i am able to walk a OID on these servers by providing the V3 credentials (auth and priv). But not able to achieve thru code as I am failing in the Discovery Step.