Delphi-PRAXiS

Delphi-PRAXiS (https://www.delphipraxis.net/forum.php)
-   Netzwerke (https://www.delphipraxis.net/14-netzwerke/)
-   -   Delphi SNMP und Indy (https://www.delphipraxis.net/40972-snmp-und-indy.html)

Computerbabalulu 23. Feb 2005 23:41


SNMP und Indy
 
:hello: Hi

Kann mir jemand erklären wie man mit der SNMP Komponente von Indy arbeitet?
Ich habe schon gegoogelt, finde aber keine entsprechenden Beispiele.

Gruß Frank

Harry M. 23. Feb 2005 23:46

Re: SNMP und Indy
 
bitte schön heute selber erst zusammen geschraubt:
Delphi-Quellcode:
var
  SMTP_HOST : string = 'mail.gmx.net';
  POP3_HOST : string = 'pop.gmx.net';
  USERNAME : string = ''; // wichtig bei gmx die kundennr
  PASSWORD : string = '*****';
  FROM_ADRESS : string = 'email@gmx.de';
  TO_ADRESS : string = 'email@gmx.de';


function Tmain1.SendEmail(Recipient:string;CCList:string;sSubject:string;Body:TStringList):boolean;
begin
 idSMTP.Host  := SMTP_HOST;
 idSMTP.Username := USERNAME;
 idSMTP.Password := PASSWORD;
 idMessage.From.text := FROM_ADRESS;
 idMessage.Sender.text:= idMessage.From.text;

 idMessage.Recipients.EMailAddresses:= Recipient;
 idMessage.CCList.EMailAddresses := CCList;
 idMessage.Subject:=sSubject;

 idMessage.Body.Clear;
 idMessage.Body := Body;

 try
   idSMTP.Connect;
   idSMTP.Send(idMessage);
   idSMTP.Disconnect;
   result:=True;
   except on E : Exception do
     begin
       if idSMTP.connected then try idSMTP.disconnect; except end;
       result := false;
     end;
 end;
end;

{email senden } 
procedure TForm1.Button1Click(Sender: TObject);
begin
    IdPOP3.Host  := POP3_HOST;
    IdPOP3.Username := USERNAME;
    IdPOP3.Password := PASSWORD;
    IdPOP3.Connect(-1);
    if IdPOP3.Connected = TRUE then begin
      st := TStringList.Create;
      st.Text := eMailMemo.Lines.Text;
      Main1.SendEmail(TO_ADRESS, '', 'Betreff', st);
      st.Free;
      IdPOP3.Disconnect;
    end;

end;
AuthenticationType muß atLogin bei gmx und bei web.de none sein

gruß delphicus

Ultimator 24. Feb 2005 11:47

Re: SNMP und Indy
 
@Delphicus:
SNMP<>SMTP ;-)

Marcel Gascoyne 24. Feb 2005 11:52

Re: SNMP und Indy
 
@delphicus
Ich glaube er mein SNMP und nicht SMTP

Hier ein einfaches Beispiel für SNMP, liefert die sysDescr des Hosts:

Delphi-Quellcode:
program snmptest;

{$APPTYPE Console}

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

var
  Snmp: TIdSNMP;
  Idx: Integer;

begin
  Snmp := TIdSNMP.Create(nil);
  Snmp.Query.Host := 'Hostname oder IP';
  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;
 
  Snmp.Free;
end.
Gruß,
Marcel

Computerbabalulu 24. Feb 2005 15:00

Re: SNMP und Indy
 
Hi

@delphicus: Danke, aber ich meinte SNMP und nich SMTP! :wink:

@Marcel: Vielen Dank, werde ich mir mal ansehen. Kennst du vielleicht irgendwelche Tutorials oder weitere Beispiele bezüglich
SNMP und Delphi? Ich fange gerade erst damit an und habe leider noch keinen Plan.
Ich brauche es aber dringend für ein Hardware Monitoring.

Gruß Frank

Marcel Gascoyne 24. Feb 2005 16:24

Re: SNMP und Indy
 
Es gibt recht wenig Informationen über Indy und SNMP, evtl. schaust Du mal in die Borland Newsgroups, z.b. über Google Groups.

Hab es bisher auch nur über die OID's hinbekommen, da ich keine MIB's importieren konnte. Vielleciht weiss ja hier einer wie das geht ?!?

Gruß,
Marcel

Computerbabalulu 25. Feb 2005 11:45

Re: SNMP und Indy
 
Hallo Marcel

Habe leider noch nichts richtiges an Infos gefunden. Solltest du noch etwas bezüglich Delphi, SNMP und Indy finden, wäre ich dir dankbar wenn
du mir einen Link senden könntest.

:hi: Bis dahin vielen Dank!

Gruß Frank


Alle Zeitangaben in WEZ +1. Es ist jetzt 20:28 Uhr.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024 by Thomas Breitkreuz