Hi Everyone,
Perhaps someone can help me out here (note my SNMP knowledge currently is a
bit limited)
I am trying to send some system specific information via SNMP traps to a
SNMP server. From the examples, I found that I can create the client sending
the traps similar to the following:
snmpsend := TSNMPSend.Create;
snmpSend.TargetHost := '192.168.1.11'; //IP of SNMP server
snmpSend.TargetPort := '8000'; //Port of SNMP server
snmpSend.Query.Version:= 3;
snmpsend.Query.Community := 'public';
snmpsend.Query.MIBAdd('1','TEST TRAP', ASN1_OCTSTR);
snmpsend.Query.PDUType := PDUTrap;
if snmpsend.SendTrap then
Writeln('TRAP SENT');
The above seems to be executing correctly and I SendTrap is returning true.
Now for the SNMP server, I have some difficulty in receiving the trap that
was sent and think the server code might be wrong. I can also not find any
examples on how this is achieved, but gave it a go as follows:
snmpRecv := TSNMPSend.Create
snmpRecv.TargetPort := '8000';
repeat
if snmpRecv.RecvTrap then
begin
Writeln('Received Trap');
Writeln('snmpRecv.HostIP); //here, I am expecting the display the IP of
the client that sent the trap
Writeln('snmpRecv.Query.MIBGet('1')); //Here, I would expect to see the
value of the trap, ie: 'TEST TRAP'
end
else
Writeln('No Trap Received yet');
until false;
Can anyone perhaps point me into some direction as to why this is not
working.
Thanks in advance!!
W
------------------------------------------------------------------------------
_______________________________________________
synalist-public mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/synalist-public