I use sharpSnmp to make a SNMP agent (virtual SNMP machine) that communicates with monitoring software.
But my agent is not detected by Monitoring apps.
I can get the Message from monitoring software by this code, the incoming message from monitoring software (solarwinds) has an OID: "1.3.6.1.2.1.1.2.0" with null value. I tried to set it's value and reply by this code:
private void MessageToListener(object sender, EventArgs e)
{
int i = 0;
//Listener listen = sender as Listener;
MessageReceivedEventArgs ee = e as MessageReceivedEventArgs;
ISnmpMessage message = ee.Message;
int messageId = message.MessageId();
int requestId = message.RequestId();
OctetString userName = message.Parameters.UserName;
IList<Variable> List= new List<Variable>
{
new Variable(new ObjectIdentifier("1.3.6.1.2.1.1.2.0"), new OctetString("Shanghai"))
};
if (message.Version == VersionCode.V2)
{
Messenger.Set(VersionCode.V2, new IPEndPoint(IPAddress.Parse("192.168.52.10"), 161), userName, List,
10000);
}
}
but I get 'Timeout exception' at my agent side and 'Test Failed' at monitoring software side. Where is my mistake? anybody can help?