Zitat von Robert Wolfe <[EMAIL PROTECTED]>:

> Good morning, folks!
>
> I am in desperate need of an SNMP unit that will let me pull information
> from an APC PDU via SNMP for some network monitoring software I need to
> write.  I currently use Synapse, however, and the program I have
> currently seems to connect to the PDU via SNMP, but it fails to retrieve
> any data.
>
> Any suggestions would be greatlfully appreciated!

This works:

procedure MiniSNMPTest;
var
  OIDSysName: String;
  aSNMPSend: TSNMPSend;
  i: Integer;
  CurMIB: TSNMPMib;
begin
  aSNMPSend := TSNMPSend.Create;
  aSNMPSend.Query.Clear;
  aSNMPSend.Query.Community := 'public';
  aSNMPSend.Query.PDUType := PDUGetRequest;
  aSNMPSend.TargetHost := '192.168.0.1';
  OIDSysName:='1.3.6.1.2.1.1.5.0'; // system.sysName.0
  aSNMPSend.Query.MIBAdd(OIDSysName, '', ASN1_NULL);
  if aSNMPSend.SendRequest then begin
    for i:=0 to aSNMPSend.Reply.MIBCount-1 do begin
      CurMIB:=aSNMPSend.Reply.MIBByIndex(i);
      if CurMIB.OID=OIDSysName then
        writeln('Decription: ',CurMIB.Value);
    end;
  end else begin
    writeln('SNMP failed');
  end;
  aSNMPSend.Free;
end;


Mattias

_______________________________________________
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal

Reply via email to