Joshua, Yes that is correct. For Example I use 1.3.6.1.3 for the first part of each OID which means [iso.org.dod.internet.experimental]. The following parts of the OIDs are unique to my alarm data elements that I wish to manage. They are of the form .1.1.1.0 ; .1.1.2.0 ; .1.1.3.0 etc. So the first complete OID in my table is 1.3.6.1.3.1.1.1.0 .
You may wish to consider 1.3.6.1.2 for [iso.org.dod.internet.management] or if your company is registered, use their registered OID plus your unique element definition. In the SNMP server program I changed the handler to filter off the first part of the OID and select on the last part, just to simplify reading of the code. Here is a sample procedure TUDPSnmpDaemon.ProcessSnmpRequest(PDU: integer; var OID, Value: string; var valuetype: integer); var I : cardinal; s, SubOID: string; Pos : Cardinal; /////////////////////////////////////////////////////////////////// /// Get requests /////////////////////////////////////////////////////////////////// if PDU = PDUGetRequest then begin if StrStPosS(OID,'1.3.6.1.3.1.1.',Pos) then begin with AlmSys.AlmSysRecord do begin s := '1.3.6.1.3.1.1.'; I := 1; SubOID := ReplaceStringS(OID,s,'',1,I); if SubOID = '1.1.0' then //1st Alarm Status begin Value := AlarmState[0,0]+' '+AlarmState[1,0]; Valuetype := ASN1_OCTSTR; end; if SubOID = '1.2.0' then //2nd Alarm Status begin Value := AlarmState[0,1]+' '+AlarmState[1,1]; Valuetype := ASN1_OCTSTR; end; if SubOID = '1.3.0' then //3rd Alarm Status begin Value := AlarmState[0,2]+' '+AlarmState[1,2]; Valuetype := ASN1_OCTSTR; end; etc end; The StrStPosS and ReplaceStringS procedures are from TurboPower's Systools, but I'm sure you will see their function is to detect that my unique first part of the OID is in the OID offered and then filter it off for simplicity. You could put the whole OID in the "if" statements if you so desired. The values returned are derived from a record "AlmSys.AlarmRecord" held and filled elsewhere in the application. Then for setting values in your equipment you use a similar construct: /////////////////////////////////////////////////////////////////// /// Set requests ////////////////////////////////////////////////////////////////// if PDU = PDUSetRequest then begin if StrStPosS(OID,'1.3.6.1.4.1.1.',Pos) then begin s := '1.3.6.1.4.1.1.'; I := 1; SubOID := ReplaceStringS(OID,s,'',1,I); if SubOID = '1.1.0' then //Set EMail To List begin // Set EMail To List here AlmSys.EMailRecord.ToList := Value; end; if SubOID = '1.2.0' then //Set EMail To Address begin // Set EMail To Address here AlmSys.EMailRecord.ToAddress := Value; end; etc end; Hope you find this useful. Regards, John Hodgson -----Original Message----- From: Joshua Lim [mailto:joshua__...@hotmail.com] Sent: Wednesday, 26 May 2010 7:09 PM To: Ararat Synapse Subject: Re: [Synalist] Newbie - How to use snmpserv demo? Thanks John, that doc is really useful. From what I've read, it's better for the organization to define their own OID for that device, am I right? So we just create the SNMP server with an OID field that is configurable? Rgds, Joshua John Hodgson wrote: > Joshua, > I found the following white paper from DPS Telecom the most informative in > describing the structure of the SNMP OIDs. There is a clear set of examples > as to how the complete OID is constructed. It can easily be seen how > registered OIDs are formed for specific proprietary companies and products. > > http://www.dpstele.com/white-papers/snmp-mib/offer.php?m_row_id=1069673&mail > ing_id=265&link=E&uni=3048448be16836b7ec > > There is no need to create a Management Information Base (MIB) for simple > projects as this is usually a separate file supplied with SNMP enabled > devices to allow easy integration of the device into an existing major SNMP > Management System. > > I have used an extension of the SNMP demo to allow monitoring of a simple > alarm system that I use and it works just fine. There are a number of free > small and simple SNMP monitors that let you probe the information from your > SNMP server to ensure it is working properly. It gets fairly complicated > once you start trying to use full blown Network Management Tools to monitor > simple apps as there is too much overhead in the larger systems and I struck > problems with the subtle syntax differences between different MIB compilers. > > If you do not have too many parameters to monitor, do it by hand. > > I can supply you with some sample code if you wish. > > Regards, > John Hodgson > > -----Original Message----- > From: Joshua Lim [mailto:joshua__...@hotmail.com] > Sent: Saturday, 22 May 2010 6:48 PM > To: Ararat Synapse > Subject: [Synalist] Newbie - How to use snmpserv demo? > > Hi, > > I've been asked to build a snmp server on my application so that the IT > department can monitor the application, so I checked out snmpserv.exe. > I'm able to query the OID .1.3.6.1.2.1.1.1.0 using Snmputilg.exe, part > of Windows support tools - > http://www.microsoft.com/downloads/details.aspx?familyid=49ae8576-9bb9-4126- > 9761-ba8011fabf38&displaylang=en > > But now what's next, hope someone can help me with: > > 1. As I understand, .1.3.6.1.2.1.1.1.0. is just a demo OID, how do I > build my own OID? > 2. Under procedure TUDPSnmpDaemon.Execute;, there is code that reads > MIB, how do I create that? > > I did Google around on SNMP, but still quite confused as most articles > only explain the terminology in a textbook manner and do not deal > specifically on creating an SNMP server. > > Will appreciate any pointers. :) > > Rgds, > Joshua > > ---------------------------------------------------------------------------- > -- > > _______________________________________________ > synalist-public mailing list > synalist-public@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/synalist-public > > > ---------------------------------------------------------------------------- -- > > _______________________________________________ > synalist-public mailing list > synalist-public@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/synalist-public > > > ---------------------------------------------------------------------------- -- _______________________________________________ synalist-public mailing list synalist-public@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/synalist-public ------------------------------------------------------------------------------ _______________________________________________ synalist-public mailing list synalist-public@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/synalist-public