在Delphi中使用SNMP

Yoa*_*iss 2 delphi snmp

将SNMP V2警报功能集成到现有Delphi软件中的最佳方法是什么?

有没有众所周知的Delphi库?是否更容易集成用其他语言构建的SNMP库?

谢谢!

And*_*eas 8

那么,您可以使用Indy-SNMP(随Delphi提供)组件.这是一个小例子(控制台),它返回主机的sysDescr:

    program snmptest;

    {$APPTYPE Console}

    uses
      SysUtils, IdBaseComponent, IdComponent, IdUDPBase, IdUDPClient, IdSNMP;

    var
      Snmp: TIdSNMP;
      Idx: Integer;

    begin
      Snmp := TIdSNMP.Create(nil);
      try
        Snmp.Query.Host := 'Hostname or IP'; //insert your host here...
        Snmp.Query.Community := 'public';
        Snmp.Query.PDUType := PDUGetRequest;
        Snmp.Query.MIBAdd('1.3.6.1.2.1.1.1.0','');

        if Snmp.SendQuery then
        begin
          WriteLn('Replies: ' + IntToStr(Snmp.Reply.ValueCount));
          for Idx := 0 to Snmp.Reply.ValueCount - 1 do
            WriteLn(Snmp.Reply.Value[0]);
        end;
      finally
        Snmp.Free;
      end;
    end. 
Run Code Online (Sandbox Code Playgroud)

还有更多的例子,如果你google"Delphi SNMP"..