Monday, 15 September 2014

c++builder - Snmp agent implementation in c++ builder plus indy -



c++builder - Snmp agent implementation in c++ builder plus indy -

i have c++ application uses indy components tcp communications. need implement snmp agent (?) in order respond requests application's state via snmp. decided utilize indy components task too. maybe there standart way implement this?

snmp component values works pretty well. couldn't find illustration how homecoming values application via snmp.

as advised remy lebeau i've started implementing sendtrap.

void __fastcall tmainform::btsendtrapclick(tobject *sender) { unicodestring myenterprise = "1.5.5.5.5.5.5.5"; unicodestring eventtype = "1.5.5.5.5.5.5.5.1"; unicodestring eventdistance = "1.5.5.5.5.5.5.5.2"; tidsnmp * idsnmp = 0; tsnmpinfo * infosnmp = 0; idsnmp = new tidsnmp(null); infosnmp = new tsnmpinfo(idsnmp); idsnmp->host = edhost->text; idsnmp->community = "public"; infosnmp->host = edhost->text; infosnmp->community = "public"; infosnmp->enterprise = myenterprise; infosnmp->gentrap = 6; // i've met such values infosnmp->spectrap = 1; // somewhere in inet infosnmp->mibadd(eventtype,"ftcritical"); infosnmp->mibadd(eventdistance,"2.357"); idsnmp->sendtrap(); delete idsnmp; }

but when run application there no udp activity in system. when run this

idsnmp->quicksend(sysdescr, "public", edhost->text, val);

wireshark shows 192.168.100.21 192.168.100.19 snmp 82 get-request 1.3.6.1.2.1.1.3.0

but when idsnmp->sendtrap() wireshark sees nil (filter wireshark udp portrange 161-162 in both cases)

i'll glad see remarks code or maybe working illustration of sendtrap :)

indy not have snmp server component. allow apps request snmp values app, have implement own snmp server, such using tidudpserver , onudpread event , parse snmp requests manually.

another alternative have external apps register app, , app utilize tidsnmp.sendtrap() force status updates registered apps when needed.

c++builder snmp indy

No comments:

Post a Comment