Hi Everyone,
Well, some many hours later and it seems I have figured this out - so I will
share this for future reference:
On the client side, I have for example the following code:
snmpSend.TargetHost := 'localhost';
snmpSend.TargetPort := '8006';
snmpSend.Query.Version:= SNMP_V1;
snmpSend.Query.PDUType := PDUTrap;
snmpsend.Query.MIBAdd('2','THIS IS A TEST MESSAGE', ASN1_OCTSTR);
if snmpsend.SendTrap then
Writeln('TRAP SENT!!')
else
Writeln('TRAP FAILED....');
Now on the server side thread, it seems the following will do the trick:
SNMPServer.TargetPort := '8006';
repeat
if SNMPServer.RecvTrap then
begin
Writeln('Trap Received!!');
Writeln('Count : ', SNMPServer.Reply.SNMPMibList.Count);
Writeln('MIB : ',
TSNMPMib(SNMPServer.Reply.SNMPMibList[0]).Value); //returns "THIS IS A TEST
MESSAGE"
Writeln('OID : ',
TSNMPMib(SNMPServer.Reply.SNMPMibList[0]).OID); //returns "2.0"
end
else
begin
Writeln('No Trap received');
end;
until false;
The above seems to be working fine - hopefully this might be of some use /
helpfull to someone in the future!
Kind Regards,
W
On Thu, Jul 9, 2009 at 7:43 AM, Werner Hauptfleisch <[email protected]
> wrote:
> Hi Lukas / Synalist,
>
> I do not know of this item has fallen of the list or if it has been
> received, but I am still stuck with the SNMP trap data not being received.
> Is there perhaps a solution to the item mentioned below?
>
> Thank you and Regards,
>
> W
>
>
> On Wed, Jul 1, 2009 at 11:33 AM, Werner Hauptfleisch <
> [email protected]> wrote:
>
>> Hi Lukas / Synalist,
>>
>> I have been playing around with the SNMPTraps and am afraid I am not
>> receiving anything in the application receiving the traps, yet on the client
>> side it appears that the MIB is indeed added. (Note that this is in FPC and
>> Lazarus). I created a simple application to act as a client, and the SNMP
>> code is as follows:
>>
>> snmpSend.Query.Clear;
>> snmpSend.TargetHost := '192.168.1.19';
>> snmpSend.TargetPort := '8006';
>> snmpsend.Query.MIBAdd('1','12', ASN1_INT);
>> Writeln(snmpSend.Query.MIBCount); //this returns 1
>> Writeln(snmpSend.Query.MIBGet('1')); //this returns 12
>> if snmpsend.SendTrap then
>> Writeln('TRAP SENT!!') //this is executed to the trap is sent
>> else
>> Writeln('TRAP FAILED....');
>>
>> -------------------------------------------
>> Then on the server side I have
>>
>> snmpRecv.TargetPort := '8006';
>> repeat
>> if snmpRecv.RecvTrap then
>> begin
>> Writeln('Trap received');
>> Writeln(snmpRecv.HostIP); //the client IP is displayed here
>> Writeln(snmpRecv.MIBCount); //this remains 0
>> Writeln(snmpRecv.MIBGet('1')); //this returns 0
>> end
>> else
>> Writeln('No Trap received');
>> until false;
>>
>> -----------------------------------------
>>
>> Am I missing something obvious here which would be the cause of my MIB
>> value not going to the server?
>>
>> Many thanks and Regards!
>>
>>
>> W
>>
>> On Tue, Jun 30, 2009 at 4:39 PM, Lukas Gebauer <[email protected]> wrote:
>>>
>>>> > I now receive the trap, but only the HostIP information is available.
>>>> > As for the rest, MIBGet values are empty and MIBCount returns '0'. How
>>>> > do I retrieve the information that was set in MIBAdd that was called
>>>> > in the client, in the server side application?
>>>>
>>>> And you are assigning some MIB information in TRAP sender simulator?
>>>> :-)
>>>>
>>>>
>>>> --
>>>> Lukas Gebauer.
>>>>
>>>> E-mail: [email protected]
>>>> http://synapse.ararat.cz/ - Ararat Synapse - TCP/IP Lib.
>>>>
>>>>
>>>>
>>>> ------------------------------------------------------------------------------
>>>> _______________________________________________
>>>> synalist-public mailing list
>>>> [email protected]
>>>> https://lists.sourceforge.net/lists/listinfo/synalist-public
>>>>
>>>
>>>
>>
>
------------------------------------------------------------------------------
Enter the BlackBerry Developer Challenge
This is your chance to win up to $100,000 in prizes! For a limited time,
vendors submitting new applications to BlackBerry App World(TM) will have
the opportunity to enter the BlackBerry Developer Challenge. See full prize
details at: http://p.sf.net/sfu/Challenge
_______________________________________________
synalist-public mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/synalist-public