SNMP How can I add additional OID to request?

334 Views Asked by At

I'm trying to query the CPU temperature of a Windows machine using SNMP and SharpNet. The example cope on the SharpNet website uses the following:

OctetString community = new OctetString("public");

AgentParameters param = new AgentParameters(community);

IpAddress agent = new SnmpSharpNet.IpAddress(ipaddress);

UdpTarget target = new UdpTarget((IPAddress)agent, 161, 2000, 1);

Pdu pdu = new Pdu(PduType.Get);

pdu.VbList.Add("1.3.6.1.2.1.1.1.0"); //sysDescr
pdu.VbList.Add("1.3.6.1.2.1.1.2.0"); //sysObjectID
pdu.VbList.Add("1.3.6.1.2.1.1.3.0"); //sysUpTime
pdu.VbList.Add("1.3.6.1.2.1.1.4.0"); //sysContact
pdu.VbList.Add("1.3.6.1.2.1.1.5.0"); //sysName

SnmpV1Packet result = (SnmpV1Packet)target.Request(pdu, param);

The target machine responds to the sample code above. According to my OID viewer the property I want to query should be 1.3.6.1.2.1.25.3.3.1.2 but when I add that to the pdu list I get this error: result.Pdu.MaxRepetitions' threw an exception of type 'SnmpSharpNet.SnmpInvalidPduTypeException

Why is this OID returning an error?

0

There are 0 best solutions below