How To Use SNMP

Example for people who want to use SNMPv3 with authentication, and the configuration I used on a Cisco Router (c2600 series)

// the display is in memo3, edit1 has the IP address, edit3 has the OID value
 
procedure TForm1.Button3Click(Sender: TObject);
var
snmpv3 : tsnmpsend;
begin
  snmpv3 := tsnmpsend.Create;
  try
    memo3.Lines.Clear;
    SNMPv3.Query.Clear;
    SNMPv3.Query.Version := 3;
    SNMPv3.Query.Flags := AuthNoPriv;
    SNMPv3.Query.FlagReportable := True;
    SNMPv3.Query.AuthMode := AuthMD5;
    SNMPv3.Query.UserName := 'ariel';
    SNMPv3.Query.Password := 'pass';
    snmpv3.TargetHost := edit1.Text;
    snmpv3.Query.PDUType := PDUGetRequest;
    snmpv3.Query.MIBAdd(edit3.Text,'',ASN1_NULL);
    if snmpv3.SendRequest then
      begin
        memo3.Lines.Add(snmpv3.Reply.MIBGet(edit3.Text));
      end;
  finally
    snmpv3.Free;
  end;
end;

The router configuration for this was:

snmp-server view todo internet included
snmp-server group ASM v3 auth read todo
snmp-server user ariel ASM v3 auth md5 pass
public/howto/snmpsample.txt · Last modified: 2007/11/30 14:30 (external edit)
Driven by DokuWiki Recent changes RSS feed