0

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?

B Minster
  • 191
  • 2
  • 12
  • You will not get an answer unless you show your EXACT code, and the EXACT error. It is likely because 1.3.6.1.2.1.25.3.3.1.2 does not specify a instance of a MIB object. hrProcessorLoad is a tabular object, so you need to specify the row of the object. If all of that is gibberish to you, you need to learn about SNMP, eg. google "snmp tabular object". – Gambit Support Oct 21 '19 at 14:18
  • @GambitSupport This is the exact error. At line 10 I added in `pdu.VbList.Add("1.3.6.1.2.1.25.3.3.1.2");` – B Minster Oct 21 '19 at 14:53

0 Answers0