public string SNMPmodel(string ip)
{
try
{
OctetString community = new OctetString("public");
AgentParameters param = new AgentParameters(community);
param.Version = SnmpVersion.Ver1;
IpAddress agent = new IpAddress(ip);//IP address
UdpTarget target = new UdpTarget((System.Net.IPAddress)agent, 161, 2000, 1);
Pdu pdu = new Pdu(PduType.Get);
pdu.VbList.Add("1.3.6.1.2.1.25.3.2.1.3.1"); // Модель
SnmpV1Packet result = (SnmpV1Packet)target.Request(pdu, param);
if (result != null)
{
if (result.Pdu.ErrorStatus != 0)
{
ret = null;
}
else
{
ret = (result.Pdu.VbList[0].Value.ToString());//Модель
}
target.Close();
}
}
catch (Exception)
{
}
return ret;
}
Для работы вам понадобится библиотека:SnmpSharpNet.dll
0.00 (0%) 0 votes











