Topic: Work with SNMP devices (exm: monitoring printers on the network)
To work with SNMP devices (monitoring printers on the network)
version 5.3 and above
procedure Form1_Button1_OnClick (Sender: TObject; var Cancel: boolean);
var
SNMP: TIdSNMP;
i, idx: integer;
begin
Form1.Memo1.Clear;
SNMP := TIdSNMP.Create(nil);
SNMP.Query.Host := Form1.Edit1.Text;
SNMP.Query.Port := 161;
SNMP.ReceiveTimeout := 5000;
SNMP.Query.Community := 'public';
SNMP.Query.PDUType := PDUGetRequest;
SNMP.Query.MIBAdd(Form1.Edit2.Text,'');
try
if SNMP.SendQuery then
for i := 0 to SNMP.Reply.ValueCount - 1 do
begin
Form1.Memo1.Lines.Add ('Replies: ' + IntToStr(SNMP.Reply.ValueCount));
for idx := 0 to SNMP.Reply.ValueCount - 1 do Form1.Memo1.Lines.Add(SNMP.Reply.Value[idx]);
end else Form1.Memo1.Text := 'Failed';
finally
Application.ProcessMessages;
SNMP.Free;
end;
end;
Project:
http://myvisualdatabase.com/forum/misc. … download=1
Dmitry.