1

i try write a agent with sample code snmpd and define custom Object . but when i use snmpwalk in other library like net-snmp , my agent not return custom Object with value

custom object

public TestObject(): base(new ObjectIdentifier("1.3.6.1.4.1.52222"))
{
}
public override ISnmpData Data
{
    get
    {
        return new Integer32(12345);
    }
    set
    {
        throw new AccessFailureException();
    }
}

my agent

var store = new ObjectStore();
store.Add(new SysDescr());
store.Add(new SysObjectId());
store.Add(new SysUpTime());
store.Add(new SysContact());
store.Add(new SysName());
store.Add(new SysLocation());
store.Add(new TestObject());

other code in my agent is like sample and not change result command line -> snmpwalk -v 2c -c public 127.0.0.1

SNMPv2-MIB::sysDescr.0 = STRING: #SNMP Agent on Microsoft Windows NT 6.2.9200.0
SNMPv2-MIB::sysObjectID.0 = OID: SNMPv2-SMI::internet
DISMAN-EVENT-MIB::sysUpTimeInstance = Timeticks: (17747798) 2 days, 1:17:57.98
SNMPv2-MIB::sysContact.0 = STRING: Taratech
SNMPv2-MIB::sysName.0 = STRING: DESKTOP-T5PVHIB
SNMPv2-MIB::sysLocation.0 = STRING:

As you can see, the result is not correct and value of TestObject not return Where is my code wrong?

Lex Li
  • 60,503
  • 9
  • 116
  • 147
d.borzouei
  • 171
  • 1
  • 1
  • 5
  • I don't think this has much to do with #SNMP yet, as our own `snmpwalk` command can query such custom objects. You have to refer to NET-SNMP reference to see how to use their command properly. – Lex Li Mar 07 '18 at 23:59

0 Answers0