View Javadoc

1   /**
2    * This file is part of GoldenGate Project (named also GoldenGate or GG).
3    * 
4    * Copyright 2009, Frederic Bregier, and individual contributors by the @author
5    * tags. See the COPYRIGHT.txt in the distribution for a full listing of
6    * individual contributors.
7    * 
8    * All GoldenGate Project is free software: you can redistribute it and/or
9    * modify it under the terms of the GNU General Public License as published by
10   * the Free Software Foundation, either version 3 of the License, or (at your
11   * option) any later version.
12   * 
13   * GoldenGate is distributed in the hope that it will be useful, but WITHOUT ANY
14   * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
15   * A PARTICULAR PURPOSE. See the GNU General Public License for more details.
16   * 
17   * You should have received a copy of the GNU General Public License along with
18   * GoldenGate . If not, see <http://www.gnu.org/licenses/>.
19   */
20  package goldengate.ftp.exec.snmp;
21  
22  import org.snmp4j.agent.DuplicateRegistrationException;
23  import org.snmp4j.agent.MOScope;
24  import org.snmp4j.agent.MOServer;
25  import org.snmp4j.agent.mo.MOAccessImpl;
26  import org.snmp4j.agent.mo.snmp.SNMPv2MIB;
27  import org.snmp4j.agent.mo.snmp.SysUpTime;
28  import org.snmp4j.mp.SnmpConstants;
29  import org.snmp4j.smi.Integer32;
30  import org.snmp4j.smi.OID;
31  import org.snmp4j.smi.OctetString;
32  import org.snmp4j.smi.SMIConstants;
33  import org.snmp4j.smi.TimeTicks;
34  import org.snmp4j.smi.VariableBinding;
35  
36  import goldengate.common.command.ReplyCode;
37  import goldengate.common.logging.GgInternalLogger;
38  import goldengate.common.logging.GgInternalLoggerFactory;
39  import goldengate.ftp.exec.config.FileBasedConfiguration;
40  import goldengate.ftp.exec.database.data.DbTransferLog;
41  import goldengate.ftp.exec.utils.Version;
42  import goldengate.snmp.GgSnmpAgent;
43  import goldengate.snmp.interf.GgInterfaceMib;
44  import goldengate.snmp.utils.GgEntry;
45  import goldengate.snmp.utils.GgMORow;
46  import goldengate.snmp.utils.GgMOScalar;
47  import goldengate.snmp.utils.GgUptime;
48  import goldengate.snmp.utils.MemoryGauge32;
49  import goldengate.snmp.utils.MemoryGauge32.MemoryType;
50  
51  /**
52   * FTP Private MIB implementation
53   * 
54   * @author Frederic Bregier
55   * 
56   */
57  public class FtpPrivateMib implements GgInterfaceMib {
58      /**
59       * Internal Logger
60       */
61      private static GgInternalLogger logger = GgInternalLoggerFactory
62              .getLogger(FtpPrivateMib.class);
63  
64      public static final String SnmpName = "GoldenGate FTP Exec SNMP";
65  
66      public static final int SnmpPrivateId = 66666;
67  
68      public static final int SnmpFtpId = 21;
69  
70      public static final String SnmpDefaultAuthor = "Frederic Bregier";
71  
72      public static final String SnmpVersion = "GoldenGate Ftp Exec " +
73              Version.ID;
74  
75      public static final String SnmpDefaultLocalization = "Paris, France";
76  
77      public static final int SnmpService = 72;
78  
79      /**
80       * SnmpConstants.sysObjectID
81       */
82      public OID ggObjectId = null; // will be smiPrivateCode.typeGoldenGate
83  
84      /**
85       * SnmpConstants.sysUpTime
86       */
87      public SysUpTime upTime = null;
88  
89      /**
90       * need to add ".port" like "6666" Only in TCP (no UDP supported for
91       * GoldenGate)
92       * 
93       * example: rootEnterpriseMib+"66666"+".1.1.4.";
94       */
95      public String applicationProtocolBase = null;
96  
97      /**
98       * will be = new OID(applicationProtocolBase+port);
99       */
100     public OID applicationProtocol = null;
101 
102     /**
103      * root OID in String
104      */
105     public String srootOIDGoldenGate;
106 
107     /**
108      * root OID
109      */
110     public OID rootOIDGoldenGate;
111 
112     /**
113      * Used in Notify
114      */
115     public OID rootOIDGoldenGateNotif;
116 
117     /**
118      * Used in Notify Start or Shutdown
119      */
120     public OID rootOIDGoldenGateNotifStartOrShutdown;
121 
122     /**
123      * Info static part
124      */
125     public OID rootOIDGoldenGateInfo;
126 
127     /**
128      * Info Row access
129      */
130     public GgMORow rowInfo;
131 
132     /**
133      * Global dynamic part
134      */
135     public OID rootOIDGoldenGateGlobal;
136 
137     /**
138      * Global Row access
139      */
140     public GgMORow rowGlobal;
141 
142     /**
143      * Uptime OID
144      */
145     public OID rootOIDGoldenGateGlobalUptime;
146 
147     /**
148      * Corresponding UpTime in Mib
149      */
150     public GgMOScalar scalarUptime = null;
151 
152     /**
153      * Detailed dynamic part
154      */
155     public OID rootOIDGoldenGateDetailed;
156 
157     /**
158      * Detailed Row access
159      */
160     public GgMORow rowDetailed;
161 
162     /**
163      * Error dynamic part
164      */
165     public OID rootOIDGoldenGateError;
166 
167     /**
168      * Error Row access
169      */
170     public GgMORow rowError;
171 
172     /**
173      * New SNMPV2 MIB
174      */
175     public SNMPv2MIB snmpv2;
176 
177     /**
178      * Corresponding agent
179      */
180     public GgSnmpAgent agent;
181 
182     /**
183      * 
184      * @param port
185      *            port used by FTP server
186      */
187     public FtpPrivateMib(int port) {
188         srootOIDGoldenGate = rootEnterpriseMib.toString() + "." +
189                 SnmpPrivateId + "." + SnmpFtpId;
190         applicationProtocolBase = srootOIDGoldenGate + ".1.1.4.";
191         ggObjectId = new OID(srootOIDGoldenGate);
192         applicationProtocol = new OID(applicationProtocolBase + port);
193         rootOIDGoldenGate = new OID(srootOIDGoldenGate);
194         rootOIDGoldenGateInfo = new OID(srootOIDGoldenGate + ".1");
195         rootOIDGoldenGateGlobal = new OID(srootOIDGoldenGate + ".2");
196         rootOIDGoldenGateGlobalUptime = new OID(
197                 rootOIDGoldenGateGlobal.toString() + "." +
198                         goldenGateGlobalValuesIndex.applUptime.getOID() + ".0");
199         rootOIDGoldenGateDetailed = new OID(srootOIDGoldenGate + ".3");
200         rootOIDGoldenGateError = new OID(srootOIDGoldenGate + ".4");
201         rootOIDGoldenGateNotif = new OID(srootOIDGoldenGate + ".5.1");
202         rootOIDGoldenGateNotifStartOrShutdown = new OID(srootOIDGoldenGate +
203                 ".5.1.1.1");
204     }
205 
206     /**
207      * Unregister and Register again the SNMPv2MIB with System adapted to this
208      * Mib
209      * 
210      * @throws DuplicateRegistrationException
211      */
212     protected void agentRegisterSystem() throws DuplicateRegistrationException {
213         // Since BaseAgent registers some mibs by default we need to unregister
214         // one before we register our own sysDescr. Normally you would
215         // override that method and register the mibs that you need
216 
217         agent.unregisterManagedObject(agent.getSnmpv2MIB());
218 
219         // Register a system description, use one from you product environment
220         // to test with
221         snmpv2 = new SNMPv2MIB(new OctetString(SnmpName), ggObjectId,
222                 new Integer32(SnmpService));
223         snmpv2.setContact(new OctetString(SnmpDefaultAuthor));
224         snmpv2.setLocation(new OctetString(SnmpDefaultLocalization));
225         snmpv2.setName(new OctetString(SnmpVersion));
226         snmpv2.registerMOs(agent.getServer(), null);
227         if (logger.isDebugEnabled()) {
228             logger.debug("SNMPV2: " + snmpv2.getContact() + ":" +
229                     snmpv2.getDescr() + ":" + snmpv2.getLocation() + ":" +
230                     snmpv2.getName() + ":" + snmpv2.getObjectID() + ":" +
231                     snmpv2.getServices() + ":" + snmpv2.getUpTime());
232         }
233         // Save UpTime reference since used everywhere
234         upTime = snmpv2.getSysUpTime();
235     }
236 
237     /**
238      * Register this MIB
239      * 
240      * @throws DuplicateRegistrationException
241      */
242     protected void agentRegisterGoldenGateMib()
243             throws DuplicateRegistrationException {
244         logger.debug("registerGGMib");
245         // register Static info
246         rowInfo = new GgMORow(this, rootOIDGoldenGateInfo,
247                 goldenGateDefinition, MibLevel.staticInfo.ordinal());
248         rowInfo.setValue(goldenGateDefinitionIndex.applName.ordinal(),
249                 "GoldenGate OpenR66");
250         rowInfo.setValue(goldenGateDefinitionIndex.applServerName.ordinal(),
251                 FileBasedConfiguration.fileBasedConfiguration.HOST_ID);
252         rowInfo.setValue(goldenGateDefinitionIndex.applVersion.ordinal(),
253                 Version.ID);
254         rowInfo.setValue(goldenGateDefinitionIndex.applDescription.ordinal(),
255                 "GoldenGate OpenR66: File Transfer Monitor");
256         rowInfo.setValue(goldenGateDefinitionIndex.applURL.ordinal(),
257                 "http://openr66.free.fr");
258         rowInfo.setValue(
259                 goldenGateDefinitionIndex.applApplicationProtocol.ordinal(),
260                 applicationProtocol);
261 
262         rowInfo.registerMOs(agent.getServer(), null);
263         // register General info
264         rowGlobal = new GgMORow(this, rootOIDGoldenGateGlobal,
265                 goldenGateGlobalValues, MibLevel.globalInfo.ordinal());
266         GgMOScalar memoryScalar = rowGlobal.row[goldenGateGlobalValuesIndex.memoryTotal
267                 .ordinal()];
268         memoryScalar.setValue(new MemoryGauge32(MemoryType.TotalMemory));
269         memoryScalar = rowGlobal.row[goldenGateGlobalValuesIndex.memoryFree
270                 .ordinal()];
271         memoryScalar.setValue(new MemoryGauge32(MemoryType.FreeMemory));
272         memoryScalar = rowGlobal.row[goldenGateGlobalValuesIndex.memoryUsed
273                 .ordinal()];
274         memoryScalar.setValue(new MemoryGauge32(MemoryType.UsedMemory));
275         rowGlobal.registerMOs(agent.getServer(), null);
276         // setup UpTime to SysUpTime and change status
277         scalarUptime = rowGlobal.row[goldenGateGlobalValuesIndex.applUptime
278                 .ordinal()];
279         scalarUptime.setValue(new GgUptime(upTime));
280         changeStatus(OperStatus.restarting);
281         changeStatus(OperStatus.up);
282         // register Detailed info
283         rowDetailed = new GgMORow(this, rootOIDGoldenGateDetailed,
284                 goldenGateDetailedValues, MibLevel.detailedInfo.ordinal());
285         rowDetailed.registerMOs(agent.getServer(), null);
286         // register Error info
287         rowError = new GgMORow(this, rootOIDGoldenGateError,
288                 goldenGateErrorValues, MibLevel.errorInfo.ordinal());
289         rowError.registerMOs(agent.getServer(), null);
290     }
291 
292     /**
293      * Unregister this MIB
294      */
295     protected void agentUnregisterMibs() {
296         logger.debug("UnRegisterGoldenGate");
297         rowInfo.unregisterMOs(agent.getServer(), agent.getDefaultContext());
298         rowGlobal.unregisterMOs(agent.getServer(), agent.getDefaultContext());
299         rowDetailed.unregisterMOs(agent.getServer(), agent.getDefaultContext());
300         rowError.unregisterMOs(agent.getServer(), agent.getDefaultContext());
301     }
302 
303     /*
304      * (non-Javadoc)
305      * 
306      * @see org.snmp4j.agent.MOGroup#registerMOs(org.snmp4j.agent.MOServer,
307      * org.snmp4j.smi.OctetString)
308      */
309     @Override
310     public void registerMOs(MOServer arg0, OctetString arg1)
311             throws DuplicateRegistrationException {
312         agentRegisterSystem();
313         agentRegisterGoldenGateMib();
314     }
315 
316     /*
317      * (non-Javadoc)
318      * 
319      * @see org.snmp4j.agent.MOGroup#unregisterMOs(org.snmp4j.agent.MOServer,
320      * org.snmp4j.smi.OctetString)
321      */
322     @Override
323     public void unregisterMOs(MOServer arg0, OctetString arg1) {
324         agentUnregisterMibs();
325     }
326 
327     /*
328      * (non-Javadoc)
329      * 
330      * @see
331      * goldengate.snmp.interf.GgInterfaceMib#setAgent(goldengate.snmp.GgSnmpAgent
332      * )
333      */
334     @Override
335     public void setAgent(GgSnmpAgent agent) {
336         this.agent = agent;
337     }
338 
339     /*
340      * (non-Javadoc)
341      * 
342      * @see goldengate.snmp.interf.GgInterfaceMib#getBaseOidStartOrShutdown()
343      */
344     @Override
345     public OID getBaseOidStartOrShutdown() {
346         return rootOIDGoldenGateNotifStartOrShutdown;
347     }
348 
349     /*
350      * (non-Javadoc)
351      * 
352      * @see goldengate.snmp.interf.GgInterfaceMib#getSNMPv2MIB()
353      */
354     @Override
355     public SNMPv2MIB getSNMPv2MIB() {
356         return snmpv2;
357     }
358 
359     /*
360      * (non-Javadoc)
361      * 
362      * @see
363      * goldengate.snmp.interf.GgInterfaceMib#updateServices(goldengate.snmp.
364      * utils.GgMOScalar)
365      */
366     @Override
367     public void updateServices(GgMOScalar scalar) {
368     }
369 
370     /*
371      * (non-Javadoc)
372      * 
373      * @see
374      * goldengate.snmp.interf.GgInterfaceMib#updateServices(org.snmp4j.agent
375      * .MOScope)
376      */
377     @Override
378     public void updateServices(MOScope range) {
379     }
380 
381     /**
382      * Change the status and the LastChange Timeticks
383      * 
384      * @param status
385      */
386     public void changeStatus(OperStatus status) {
387         GgMOScalar statusScalar = rowGlobal.row[goldenGateGlobalValuesIndex.applOperStatus
388                 .ordinal()];
389         Integer32 var = (Integer32) statusScalar.getValue();
390         if (var.getValue() != status.status) {
391             var.setValue(status.status);
392             GgMOScalar lastTimeScalar = rowGlobal.row[goldenGateGlobalValuesIndex.applLastChange
393                     .ordinal()];
394             TimeTicks time = (TimeTicks) lastTimeScalar.getValue();
395             time.setValue(upTime.get().getValue());
396         }
397     }
398 
399     /**
400      * Send a notification (trap or inform) for Shutdown event
401      * 
402      * @param message
403      * @param message2
404      */
405     public void notifyStartStop(String message, String message2) {
406         if (!TrapLevel.StartStop.isLevelValid(agent.trapLevel)) return;
407         notify(NotificationElements.TrapShutdown, message, message2);
408     }
409 
410     /**
411      * Send a notification (trap or inform) for Error event
412      * 
413      * @param message
414      * @param message2
415      */
416     public void notifyError(String message, String message2) {
417         if (!TrapLevel.Alert.isLevelValid(agent.trapLevel)) return;
418         notify(NotificationElements.TrapError, message, message2);
419     }
420 
421     /**
422      * Send a notification (trap or inform) for Server Overloaded event
423      * 
424      * @param message
425      * @param message2
426      */
427     public void notifyOverloaded(String message, String message2) {
428         if (!TrapLevel.Warning.isLevelValid(agent.trapLevel)) return;
429         notify(NotificationElements.TrapOverloaded, message, message2);
430     }
431 
432     /**
433      * Send a notification (trap or inform) for Warning event
434      * 
435      * @param message
436      * @param message2
437      */
438     public void notifyWarning(String message, String message2) {
439         if (!TrapLevel.Warning.isLevelValid(agent.trapLevel)) return;
440         notify(NotificationElements.TrapWarning, message, message2);
441     }
442 
443     /**
444      * Send a notification (trap or inform) for Warning/Error event on a single
445      * Transfer Task
446      * 
447      * @param message
448      * @param runner
449      */
450     public void notifyInfoTask(String message, DbTransferLog runner) {
451         if (!TrapLevel.All.isLevelValid(agent.trapLevel)) return;
452         if (logger.isDebugEnabled())
453             logger.debug("Notify: " + NotificationElements.InfoTask + ":" +
454                     message + ":" + runner);
455         long delay = (runner.getStart().getTime() - agent.getUptimeSystemTime()) / 10;
456         if (delay < 0) delay = 0;
457         agent.getNotificationOriginator().notify(
458                 new OctetString("public"),
459                 NotificationElements.InfoTask.getOID(rootOIDGoldenGateNotif),
460                 new VariableBinding[] {
461                         new VariableBinding(NotificationElements.InfoTask
462                                 .getOID(rootOIDGoldenGateNotif, 1),
463                                 new OctetString(NotificationElements.InfoTask
464                                         .name())),
465                         new VariableBinding(NotificationElements.InfoTask
466                                 .getOID(rootOIDGoldenGateNotif, 1),
467                                 new OctetString(message)),
468                         // Start of Task
469                         new VariableBinding(
470                                 NotificationElements.InfoTask
471                                         .getOID(rootOIDGoldenGateNotif,
472                                                 NotificationTasks.filenameInfo
473                                                         .getOID()),
474                                 new OctetString(runner.getFilename())),
475                         new VariableBinding(NotificationElements.InfoTask
476                                 .getOID(rootOIDGoldenGateNotif,
477                                         NotificationTasks.modeTransInfo
478                                                 .getOID()), 
479                                 new OctetString(runner.getMode())),
480                         new VariableBinding(NotificationElements.InfoTask
481                                 .getOID(rootOIDGoldenGateNotif,
482                                         NotificationTasks.startTransInfo
483                                                 .getOID()),
484                                 new TimeTicks(delay)),
485                         new VariableBinding(NotificationElements.InfoTask
486                                 .getOID(rootOIDGoldenGateNotif,
487                                         NotificationTasks.infoStatusInfo
488                                                 .getOID()), new OctetString(
489                                 runner.getErrorInfo().getMesg())),
490                         new VariableBinding(NotificationElements.InfoTask
491                                 .getOID(rootOIDGoldenGateNotif,
492                                         NotificationTasks.userIdInfo
493                                                 .getOID()), new OctetString(
494                                 runner.getUser())),
495                         new VariableBinding(NotificationElements.InfoTask
496                                 .getOID(rootOIDGoldenGateNotif,
497                                         NotificationTasks.accountId
498                                                 .getOID()), new OctetString(
499                                 runner.getAccount())),
500                         new VariableBinding(NotificationElements.InfoTask
501                                 .getOID(rootOIDGoldenGateNotif,
502                                         NotificationTasks.specialIdInfo
503                                                 .getOID()), new OctetString("" +
504                                 runner.getSpecialId())),
505                         // End of Task
506                         new VariableBinding(SnmpConstants.sysDescr, snmpv2
507                                 .getDescr()),
508                         new VariableBinding(SnmpConstants.sysObjectID, snmpv2
509                                 .getObjectID()),
510                         new VariableBinding(SnmpConstants.sysContact, snmpv2
511                                 .getContact()),
512                         new VariableBinding(SnmpConstants.sysName, snmpv2
513                                 .getName()),
514                         new VariableBinding(SnmpConstants.sysLocation, snmpv2
515                                 .getLocation()) });
516     }
517 
518     /**
519      * Trap/Notification
520      * 
521      * @param element
522      * @param message
523      * @param message2
524      */
525     private void notify(NotificationElements element, String message,
526             String message2) {
527         if (logger.isDebugEnabled())
528             logger.debug("Notify: " + element + ":" + message + ":" + message2);
529         agent.getNotificationOriginator().notify(
530                 new OctetString("public"),
531                 element.getOID(rootOIDGoldenGateNotif),
532                 new VariableBinding[] {
533                         new VariableBinding(element.getOID(
534                                 rootOIDGoldenGateNotif, 1), new OctetString(
535                                 element.name())),
536                         new VariableBinding(element.getOID(
537                                 rootOIDGoldenGateNotif, 1), new OctetString(
538                                 message)),
539                         new VariableBinding(element.getOID(
540                                 rootOIDGoldenGateNotif, 1), new OctetString(
541                                 message2)),
542                         new VariableBinding(SnmpConstants.sysDescr, snmpv2
543                                 .getDescr()),
544                         new VariableBinding(SnmpConstants.sysObjectID, snmpv2
545                                 .getObjectID()),
546                         new VariableBinding(SnmpConstants.sysContact, snmpv2
547                                 .getContact()),
548                         new VariableBinding(SnmpConstants.sysName, snmpv2
549                                 .getName()),
550                         new VariableBinding(SnmpConstants.sysLocation, snmpv2
551                                 .getLocation()) });
552     }
553 
554     /**
555      * MIB entry levels
556      * 
557      * @author Frederic Bregier
558      * 
559      */
560     public static enum MibLevel {
561         staticInfo, globalInfo, detailedInfo, errorInfo, trapInfo
562     }
563 
564     // From now the MIB definition
565     /**
566      * Notification Elements
567      * 
568      * @author Frederic Bregier
569      * 
570      */
571     public static enum NotificationElements {
572         TrapShutdown(1),
573         TrapError(2),
574         TrapWarning(3),
575         TrapOverloaded(4),
576         InfoTask(5);
577 
578         public int[] oid;
579 
580         private NotificationElements(int oid) {
581             this.oid = new int[] {
582                 oid };
583         }
584 
585         public OID getOID(OID oidBase) {
586             return new OID(oidBase.getValue(), this.oid);
587         }
588 
589         public OID getOID(OID oidBase, int rank) {
590             int[] ids = new int[] {
591                     this.oid[0], rank };
592             return new OID(oidBase.getValue(), ids);
593         }
594     }
595 
596     /**
597      * Notification for a task trap
598      * 
599      * @author Frederic Bregier
600      * 
601      */
602     public static enum NotificationTasks {
603         filenameInfo, modeTransInfo, startTransInfo, infoStatusInfo, userIdInfo, 
604         accountId, specialIdInfo;
605 
606         public int getOID() {
607             return this.ordinal() + 1;
608         }
609     }
610 
611     /**
612      * Definition part
613      * 
614      * @author Frederic Bregier
615      * 
616      */
617     public static enum goldenGateDefinitionIndex {
618         applName,
619         applServerName,
620         applVersion,
621         applDescription,
622         applURL,
623         applApplicationProtocol;
624 
625         public int getOID() {
626             return this.ordinal() + 1;
627         }
628     }
629 
630     /**
631      * Definition part
632      */
633     public static GgEntry[] goldenGateDefinition = {
634             // applName
635             new GgEntry(SMIConstants.SYNTAX_OCTET_STRING,
636                     MOAccessImpl.ACCESS_READ_ONLY),
637             // applServerName
638             new GgEntry(SMIConstants.SYNTAX_OCTET_STRING,
639                     MOAccessImpl.ACCESS_READ_ONLY),
640             // applVersion
641             new GgEntry(SMIConstants.SYNTAX_OCTET_STRING,
642                     MOAccessImpl.ACCESS_READ_ONLY),
643             // applDescription
644             new GgEntry(SMIConstants.SYNTAX_OCTET_STRING,
645                     MOAccessImpl.ACCESS_READ_ONLY),
646             // applURL
647             new GgEntry(SMIConstants.SYNTAX_OCTET_STRING,
648                     MOAccessImpl.ACCESS_READ_ONLY),
649             // applApplicationProtocol
650             new GgEntry(SMIConstants.SYNTAX_OBJECT_IDENTIFIER,
651                     MOAccessImpl.ACCESS_READ_ONLY) };
652 
653     /**
654      * Global part
655      * 
656      * @author Frederic Bregier
657      * 
658      */
659     public static enum goldenGateGlobalValuesIndex {
660         applUptime,
661         applOperStatus,
662         applLastChange,
663         applInboundAssociations,
664         applOutboundAssociations,
665         applAccumInboundAssociations,
666         applAccumOutboundAssociations,
667         applLastInboundActivity,
668         applLastOutboundActivity,
669         applRejectedInboundAssociations,
670         applFailedOutboundAssociations,
671         applInboundBandwidthKBS,
672         applOutboundBandwidthKBS,
673         nbInfoUnknown,
674         nbInfoNotUpdated,
675         nbInfoInterrupted,
676         nbInfoToSubmit,
677         nbInfoError,
678         nbInfoRunning,
679         nbInfoDone,
680         nbAllTransfer,
681         memoryTotal,
682         memoryFree,
683         memoryUsed,
684         nbThreads,
685         nbNetworkConnection;
686 
687         public int getOID() {
688             return this.ordinal() + 1;
689         }
690     }
691 
692     /**
693      * Global part
694      */
695     public static GgEntry[] goldenGateGlobalValues = {
696             // applUptime
697             new GgEntry(SMIConstants.SYNTAX_TIMETICKS,
698                     MOAccessImpl.ACCESS_READ_ONLY),
699             // applOperStatus
700             new GgEntry(SMIConstants.SYNTAX_INTEGER,
701                     MOAccessImpl.ACCESS_READ_ONLY),
702             // applLastChange
703             new GgEntry(SMIConstants.SYNTAX_TIMETICKS,
704                     MOAccessImpl.ACCESS_READ_ONLY),
705             // applInboundAssociations
706             new GgEntry(SMIConstants.SYNTAX_GAUGE32,
707                     MOAccessImpl.ACCESS_READ_ONLY),
708             // applOutboundAssociations
709             new GgEntry(SMIConstants.SYNTAX_GAUGE32,
710                     MOAccessImpl.ACCESS_READ_ONLY),
711             // applAccumInboundAssociations
712             new GgEntry(SMIConstants.SYNTAX_COUNTER32,
713                     MOAccessImpl.ACCESS_READ_ONLY),
714             // applAccumOutboundAssociations
715             new GgEntry(SMIConstants.SYNTAX_COUNTER32,
716                     MOAccessImpl.ACCESS_READ_ONLY),
717             // applLastInboundActivity
718             new GgEntry(SMIConstants.SYNTAX_TIMETICKS,
719                     MOAccessImpl.ACCESS_READ_ONLY),
720             // applLastOutboundActivity
721             new GgEntry(SMIConstants.SYNTAX_TIMETICKS,
722                     MOAccessImpl.ACCESS_READ_ONLY),
723             // applRejectedInboundAssociations
724             new GgEntry(SMIConstants.SYNTAX_COUNTER32,
725                     MOAccessImpl.ACCESS_READ_ONLY),
726             // applFailedOutboundAssociations
727             new GgEntry(SMIConstants.SYNTAX_COUNTER32,
728                     MOAccessImpl.ACCESS_READ_ONLY),
729             // Bandwidth
730             // applInboundBandwidthKBS
731             new GgEntry(SMIConstants.SYNTAX_GAUGE32,
732                     MOAccessImpl.ACCESS_READ_ONLY),
733             // applOutboundBandwidthKBS
734             new GgEntry(SMIConstants.SYNTAX_GAUGE32,
735                     MOAccessImpl.ACCESS_READ_ONLY),
736             // Overall status including past, future and current transfers
737             // nbInfoUnknown
738             new GgEntry(SMIConstants.SYNTAX_GAUGE32,
739                     MOAccessImpl.ACCESS_READ_ONLY),
740             // nbInfoNotUpdated
741             new GgEntry(SMIConstants.SYNTAX_GAUGE32,
742                     MOAccessImpl.ACCESS_READ_ONLY),
743             // nbInfoInterrupted
744             new GgEntry(SMIConstants.SYNTAX_GAUGE32,
745                     MOAccessImpl.ACCESS_READ_ONLY),
746             // nbInfoToSubmit
747             new GgEntry(SMIConstants.SYNTAX_GAUGE32,
748                     MOAccessImpl.ACCESS_READ_ONLY),
749             // nbInfoError
750             new GgEntry(SMIConstants.SYNTAX_GAUGE32,
751                     MOAccessImpl.ACCESS_READ_ONLY),
752             // nbInfoRunning
753             new GgEntry(SMIConstants.SYNTAX_GAUGE32,
754                     MOAccessImpl.ACCESS_READ_ONLY),
755             // nbInfoDone
756             new GgEntry(SMIConstants.SYNTAX_GAUGE32,
757                     MOAccessImpl.ACCESS_READ_ONLY),
758             // Current situation of all transfers, running or not
759             // nbAllTransfer
760             new GgEntry(SMIConstants.SYNTAX_GAUGE32,
761                     MOAccessImpl.ACCESS_READ_ONLY),
762             // memoryTotal
763             new GgEntry(SMIConstants.SYNTAX_GAUGE32,
764                     MOAccessImpl.ACCESS_READ_ONLY),
765             // memoryFree
766             new GgEntry(SMIConstants.SYNTAX_GAUGE32,
767                     MOAccessImpl.ACCESS_READ_ONLY),
768             // memoryUsed
769             new GgEntry(SMIConstants.SYNTAX_GAUGE32,
770                     MOAccessImpl.ACCESS_READ_ONLY),
771             // nbThreads
772             new GgEntry(SMIConstants.SYNTAX_GAUGE32,
773                     MOAccessImpl.ACCESS_READ_ONLY),
774             // nbNetworkConnection
775             new GgEntry(SMIConstants.SYNTAX_GAUGE32,
776                     MOAccessImpl.ACCESS_READ_ONLY) };
777 
778     /**
779      * Detailed part
780      * 
781      * @author Frederic Bregier
782      * 
783      */
784     public static enum goldenGateDetailedValuesIndex {
785         reply_000(ReplyCode.REPLY_000_SPECIAL_NOSTATUS),
786         reply_110(ReplyCode.REPLY_110_RESTART_MARKER_REPLY),
787         reply_120(ReplyCode.REPLY_120_SERVICE_READY_IN_NNN_MINUTES),
788         reply_125(ReplyCode.REPLY_125_DATA_CONNECTION_ALREADY_OPEN),
789         reply_150(ReplyCode.REPLY_150_FILE_STATUS_OKAY),
790         reply_200(ReplyCode.REPLY_200_COMMAND_OKAY),
791         reply_202(ReplyCode.REPLY_202_COMMAND_NOT_IMPLEMENTED),
792         reply_211(ReplyCode.REPLY_211_SYSTEM_STATUS_REPLY),
793         reply_212(ReplyCode.REPLY_212_DIRECTORY_STATUS),
794         reply_213(ReplyCode.REPLY_213_FILE_STATUS),
795         reply_214(ReplyCode.REPLY_214_HELP_MESSAGE),
796         reply_215(ReplyCode.REPLY_215_NAME_SYSTEM_TYPE),
797         reply_220(ReplyCode.REPLY_220_SERVICE_READY),
798         reply_221(ReplyCode.REPLY_221_CLOSING_CONTROL_CONNECTION),
799         reply_225(ReplyCode.REPLY_225_DATA_CONNECTION_OPEN_NO_TRANSFER_IN_PROGRESS),
800         reply_226(ReplyCode.REPLY_226_CLOSING_DATA_CONNECTION),
801         reply_227(ReplyCode.REPLY_227_ENTERING_PASSIVE_MODE),
802         reply_229(ReplyCode.REPLY_229_ENTERING_PASSIVE_MODE),
803         reply_230(ReplyCode.REPLY_230_USER_LOGGED_IN),
804         reply_250(ReplyCode.REPLY_250_REQUESTED_FILE_ACTION_OKAY),
805         reply_257(ReplyCode.REPLY_257_PATHNAME_CREATED),
806         reply_331(ReplyCode.REPLY_331_USER_NAME_OKAY_NEED_PASSWORD),
807         reply_332(ReplyCode.REPLY_332_NEED_ACCOUNT_FOR_LOGIN),
808         reply_350(ReplyCode.REPLY_350_REQUESTED_FILE_ACTION_PENDING_FURTHER_INFORMATION);
809 
810         public ReplyCode code;
811         
812         private goldenGateDetailedValuesIndex(ReplyCode code) {
813             this.code = code;
814         }
815         public int getOID() {
816             return this.ordinal() + 1;
817         }
818     }
819 
820     /**
821      * Detailed part
822      */
823     public static GgEntry[] goldenGateDetailedValues = {
824             // reply_000,
825         new GgEntry(SMIConstants.SYNTAX_GAUGE32,
826                 MOAccessImpl.ACCESS_READ_ONLY),
827             // reply_110,
828         new GgEntry(SMIConstants.SYNTAX_GAUGE32,
829                 MOAccessImpl.ACCESS_READ_ONLY),
830             // reply_120,
831         new GgEntry(SMIConstants.SYNTAX_GAUGE32,
832                 MOAccessImpl.ACCESS_READ_ONLY),
833             // reply_125,
834         new GgEntry(SMIConstants.SYNTAX_GAUGE32,
835                 MOAccessImpl.ACCESS_READ_ONLY),
836             // reply_150,
837         new GgEntry(SMIConstants.SYNTAX_GAUGE32,
838                 MOAccessImpl.ACCESS_READ_ONLY),
839             // reply_200,
840         new GgEntry(SMIConstants.SYNTAX_GAUGE32,
841                 MOAccessImpl.ACCESS_READ_ONLY),
842             // reply_202,
843         new GgEntry(SMIConstants.SYNTAX_GAUGE32,
844                 MOAccessImpl.ACCESS_READ_ONLY),
845             // reply_211,
846         new GgEntry(SMIConstants.SYNTAX_GAUGE32,
847                 MOAccessImpl.ACCESS_READ_ONLY),
848             // reply_212,
849         new GgEntry(SMIConstants.SYNTAX_GAUGE32,
850                 MOAccessImpl.ACCESS_READ_ONLY),
851             // reply_213,
852         new GgEntry(SMIConstants.SYNTAX_GAUGE32,
853                 MOAccessImpl.ACCESS_READ_ONLY),
854             // reply_214,
855         new GgEntry(SMIConstants.SYNTAX_GAUGE32,
856                 MOAccessImpl.ACCESS_READ_ONLY),
857             // reply_215,
858         new GgEntry(SMIConstants.SYNTAX_GAUGE32,
859                 MOAccessImpl.ACCESS_READ_ONLY),
860             // reply_220,
861         new GgEntry(SMIConstants.SYNTAX_GAUGE32,
862                 MOAccessImpl.ACCESS_READ_ONLY),
863             // reply_221,
864         new GgEntry(SMIConstants.SYNTAX_GAUGE32,
865                 MOAccessImpl.ACCESS_READ_ONLY),
866             // reply_225,
867         new GgEntry(SMIConstants.SYNTAX_GAUGE32,
868                 MOAccessImpl.ACCESS_READ_ONLY),
869             // reply_226,
870         new GgEntry(SMIConstants.SYNTAX_GAUGE32,
871                 MOAccessImpl.ACCESS_READ_ONLY),
872             // reply_227,
873         new GgEntry(SMIConstants.SYNTAX_GAUGE32,
874                 MOAccessImpl.ACCESS_READ_ONLY),
875             // reply_229,
876         new GgEntry(SMIConstants.SYNTAX_GAUGE32,
877                 MOAccessImpl.ACCESS_READ_ONLY),
878             // reply_230,
879         new GgEntry(SMIConstants.SYNTAX_GAUGE32,
880                 MOAccessImpl.ACCESS_READ_ONLY),
881             // reply_250,
882         new GgEntry(SMIConstants.SYNTAX_GAUGE32,
883                 MOAccessImpl.ACCESS_READ_ONLY),
884             // reply_257,
885         new GgEntry(SMIConstants.SYNTAX_GAUGE32,
886                 MOAccessImpl.ACCESS_READ_ONLY),
887             // reply_331,
888         new GgEntry(SMIConstants.SYNTAX_GAUGE32,
889                 MOAccessImpl.ACCESS_READ_ONLY),
890             // reply_332,
891         new GgEntry(SMIConstants.SYNTAX_GAUGE32,
892                 MOAccessImpl.ACCESS_READ_ONLY),
893             // reply_350;
894         new GgEntry(SMIConstants.SYNTAX_GAUGE32,
895                 MOAccessImpl.ACCESS_READ_ONLY) };
896 
897     /**
898      * Error part
899      * 
900      * @author Frederic Bregier
901      * 
902      */
903     public static enum goldenGateErrorValuesIndex {
904         reply_421(ReplyCode.REPLY_421_SERVICE_NOT_AVAILABLE_CLOSING_CONTROL_CONNECTION),
905         reply_425(ReplyCode.REPLY_425_CANT_OPEN_DATA_CONNECTION),
906         reply_426(ReplyCode.REPLY_426_CONNECTION_CLOSED_TRANSFER_ABORTED),
907         reply_450(ReplyCode.REPLY_450_REQUESTED_FILE_ACTION_NOT_TAKEN),
908         reply_451(ReplyCode.REPLY_451_REQUESTED_ACTION_ABORTED),
909         reply_452(ReplyCode.REPLY_452_REQUESTED_ACTION_NOT_TAKEN),
910         reply_500(ReplyCode.REPLY_500_SYNTAX_ERROR_COMMAND_UNRECOGNIZED),
911         reply_501(ReplyCode.REPLY_501_SYNTAX_ERROR_IN_PARAMETERS_OR_ARGUMENTS),
912         reply_502(ReplyCode.REPLY_502_COMMAND_NOT_IMPLEMENTED),
913         reply_503(ReplyCode.REPLY_503_BAD_SEQUENCE_OF_COMMANDS),
914         reply_504(ReplyCode.REPLY_504_COMMAND_NOT_IMPLEMENTED_FOR_THAT_PARAMETER),
915         reply_522(ReplyCode.REPLY_522_EXTENDED_PORT_FAILURE_UNKNOWN_NETWORK_PROTOCOL),
916         reply_530(ReplyCode.REPLY_530_NOT_LOGGED_IN),
917         reply_532(ReplyCode.REPLY_532_NEED_ACCOUNT_FOR_STORING_FILES),
918         reply_550(ReplyCode.REPLY_550_REQUESTED_ACTION_NOT_TAKEN),
919         reply_551(ReplyCode.REPLY_551_REQUESTED_ACTION_ABORTED_PAGE_TYPE_UNKNOWN),
920         reply_552(ReplyCode.REPLY_552_REQUESTED_FILE_ACTION_ABORTED_EXCEEDED_STORAGE),
921         reply_553(ReplyCode.REPLY_553_REQUESTED_ACTION_NOT_TAKEN_FILE_NAME_NOT_ALLOWED);
922 
923         public ReplyCode code;
924         
925         private goldenGateErrorValuesIndex(ReplyCode code) {
926             this.code = code;
927         }
928 
929         public int getOID() {
930             return this.ordinal() + 1;
931         }
932     }
933 
934     /**
935      * Error part
936      */
937     public static GgEntry[] goldenGateErrorValues = {
938         // reply_421,
939             new GgEntry(SMIConstants.SYNTAX_GAUGE32,
940                     MOAccessImpl.ACCESS_READ_ONLY),
941         // reply_425,
942             new GgEntry(SMIConstants.SYNTAX_GAUGE32,
943                     MOAccessImpl.ACCESS_READ_ONLY),
944         // reply_426,
945             new GgEntry(SMIConstants.SYNTAX_GAUGE32,
946                     MOAccessImpl.ACCESS_READ_ONLY),
947         // reply_450,
948             new GgEntry(SMIConstants.SYNTAX_GAUGE32,
949                     MOAccessImpl.ACCESS_READ_ONLY),
950         // reply_451,
951             new GgEntry(SMIConstants.SYNTAX_GAUGE32,
952                     MOAccessImpl.ACCESS_READ_ONLY),
953         // reply_452,
954             new GgEntry(SMIConstants.SYNTAX_GAUGE32,
955                     MOAccessImpl.ACCESS_READ_ONLY),
956         // reply_500,
957             new GgEntry(SMIConstants.SYNTAX_GAUGE32,
958                     MOAccessImpl.ACCESS_READ_ONLY),
959         // reply_501,
960             new GgEntry(SMIConstants.SYNTAX_GAUGE32,
961                     MOAccessImpl.ACCESS_READ_ONLY),
962         // reply_502,
963             new GgEntry(SMIConstants.SYNTAX_GAUGE32,
964                     MOAccessImpl.ACCESS_READ_ONLY),
965         // reply_503,
966             new GgEntry(SMIConstants.SYNTAX_GAUGE32,
967                     MOAccessImpl.ACCESS_READ_ONLY),
968         // reply_504,
969             new GgEntry(SMIConstants.SYNTAX_GAUGE32,
970                     MOAccessImpl.ACCESS_READ_ONLY),
971         // reply_522,
972             new GgEntry(SMIConstants.SYNTAX_GAUGE32,
973                     MOAccessImpl.ACCESS_READ_ONLY),
974         // reply_530,
975             new GgEntry(SMIConstants.SYNTAX_GAUGE32,
976                     MOAccessImpl.ACCESS_READ_ONLY),
977         // reply_532,
978             new GgEntry(SMIConstants.SYNTAX_GAUGE32,
979                     MOAccessImpl.ACCESS_READ_ONLY),
980         // reply_550,
981             new GgEntry(SMIConstants.SYNTAX_GAUGE32,
982                     MOAccessImpl.ACCESS_READ_ONLY),
983         // reply_551,
984             new GgEntry(SMIConstants.SYNTAX_GAUGE32,
985                     MOAccessImpl.ACCESS_READ_ONLY),
986         // reply_552,
987             new GgEntry(SMIConstants.SYNTAX_GAUGE32,
988                     MOAccessImpl.ACCESS_READ_ONLY),
989         // reply_553;
990             new GgEntry(SMIConstants.SYNTAX_GAUGE32,
991                     MOAccessImpl.ACCESS_READ_ONLY) };
992 
993     /**
994      * Oper Status (as defined in Net Application SNMP)
995      * 
996      * @author Frederic Bregier
997      * 
998      */
999     public static enum OperStatus {
1000         up(1), down(2), halted(3), congested(4), restarting(5), quiescing(6);
1001 
1002         public int status;
1003 
1004         private OperStatus(int status) {
1005             this.status = status;
1006         }
1007     }
1008 
1009 }