Esempio n. 1
0
  synchronized HashMap getLabels() {
    if (labelsCache == null) {
      labelsCache = new HashMap();
      if (getProperty(pValueLabels).length() > 0) {
        String as[] = TextUtils.split(getProperty(pValueLabels), ",");
        for (int i = 0; i < as.length; i++) {
          String s1 = as[i];
          String s2 = getNameFromIndex(i);
          labelsCache.add(s2, s1.trim());
        }

      } else {
        for (int j = 0; j < maxNumberOfMatches; j++) {
          String s = getNameFromIndex(j);
          labelsCache.add(s, s);
        }
      }
      ArrayList array = getProperties();
      Enumeration enumeration = (Enumeration) array.iterator();
      do {
        if (!enumeration.hasMoreElements()) {
          break;
        }
        StringProperty stringproperty = (StringProperty) enumeration.nextElement();
        if (stringproperty.isThreshold() && stringproperty.getName().indexOf("value") < 0) {
          labelsCache.add(stringproperty.getLabel(), stringproperty.getLabel());
        }
      } while (true);
    }
    return labelsCache;
  }
 public String verify(
     StringProperty stringproperty, String s, HTTPRequest httprequest, HashMap hashmap) {
   if (stringproperty == getPDuration()) {
     long l = Long.parseLong(s);
     if (s.trim().length() == 0) {
       hashmap.put(stringproperty, stringproperty.getLabel() + " missing");
     } else if (l <= 0L) {
       hashmap.put(
           stringproperty,
           stringproperty.getLabel() + " duration must be positive value (milleseconds).");
     }
     return s;
   }
   if (stringproperty == getCountersProperty()) {
     String s1 = getCountersContent();
     if (s1.length() <= 0) {
       hashmap.put(stringproperty, "No counters selected");
     }
     return s;
   }
   if (stringproperty == getPMediaURL()) {
     return s;
   } else {
     return super.verify(stringproperty, s, httprequest, hashmap);
   }
 }
Esempio n. 3
0
 public String getPropertyName(StringProperty stringproperty) {
   String s = stringproperty.getName();
   String s1 = TextUtils.getValue(getLabels(), stringproperty.getLabel());
   if (s1.length() == 0) {
     s1 = s;
   }
   return s1;
 }
Esempio n. 4
0
  protected ArrayList getConnArgs() {
    ArrayList array = getConnectionProperties();
    int i = array.size();
    ArrayList array1 = new ArrayList();
    for (int j = 0; j < i; j++) {
      StringProperty stringproperty = (StringProperty) array.get(j);
      String s = stringproperty.getName().substring(1);
      array1.add(s + "=" + getProperty(stringproperty));
    }

    return array1;
  }
Esempio n. 5
0
 static {
   nMaxCounters = 60;
   nMaxCounters =
       TextUtils.toInt(
           TextUtils.getValue(MasterConfig.getMasterConfig(), "_browsableContentMaxCounters"));
   if (nMaxCounters == 0) {
     nMaxCounters = 60;
   }
   pHostName = new StringProperty("_server", "");
   pHostName.setDisplayText("Server name", "the IPMI server name or IP address");
   pHostName.setParameterOptions(false, 1, false);
   pPortNumber = new StringProperty("_port", "623");
   pPortNumber.setDisplayText(
       "Port number", "the port number of the IPMI server (default is 623)");
   pPortNumber.setParameterOptions(false, 2, false);
   pUserName = new StringProperty("_user", "");
   pUserName.setDisplayText("User name", "user name to connect the IPMI server");
   pUserName.setParameterOptions(false, 3, false);
   pPassword = new StringProperty("_password", "");
   pPassword.setDisplayText("Password", "password to connect the IPMI server");
   pPassword.setParameterOptions(false, 4, false);
   pPassword.isPassword = true;
   chassisMericsMap = new Hashtable();
   chassisMericsMap.put("ChassisPowerOn", "Power On");
   chassisMericsMap.put("ChassisPowerOverload", "Power Overload");
   chassisMericsMap.put("ChassisPowerInterlock", "Power Interlock");
   chassisMericsMap.put("ChassisPowerFault", "Power Fault");
   chassisMericsMap.put("ChassisPowerControlFault", "Power Control Fault");
   chassisMericsMap.put("ChassisDriveFault", "Drive Fault");
   chassisMericsMap.put("ChassisCoolingFanFault", "Cooling Fan Fault");
   chassisMericsMap.put("ChassisIntrusion", "Chassis Intrusion");
   chassisMericsMap.put("ChassisFrontPanelLockout", "Front-Panel Lockout");
   pStatus = new StringProperty("status", "n/a");
   String s = (COM.dragonflow.StandardMonitor.IPMIMonitor.class).getName();
   StringProperty astringproperty[] = BrowsableBase.staticInitializer(nMaxCounters, true);
   StringProperty astringproperty1[] = new StringProperty[astringproperty.length + 5];
   System.arraycopy(astringproperty, 0, astringproperty1, 0, astringproperty.length);
   astringproperty1[astringproperty.length] = pHostName;
   astringproperty1[astringproperty.length + 1] = pPortNumber;
   astringproperty1[astringproperty.length + 2] = pUserName;
   astringproperty1[astringproperty.length + 3] = pPassword;
   astringproperty1[astringproperty.length + 4] = pStatus;
   addProperties(s, astringproperty1);
   setClassProperty(s, "description", "Collect IPMI data");
   setClassProperty(s, "help", "IPMIMonitor.htm");
   setClassProperty(s, "title", "IPMI");
   setClassProperty(s, "class", "IPMIMonitor");
   setClassProperty(s, "topazType", "IPMI");
   setClassProperty(s, "classType", "application");
   addClassElement(s, Rule.stringToClassifier("status == 'Error'\terror"));
   addClassElement(s, Rule.stringToClassifier("status == 'Warning'\twarning"));
   addClassElement(s, Rule.stringToClassifier("status == 'OK'\tgood"));
   setClassProperty(s, "target", "_server");
 }
 public String verify(StringProperty property, String value, HTTPRequest request, HashMap errors) {
   if (mandatoryProps.contains(property.getName())) {
     if (value == null || value.length() == 0) {
       errors.put(property, "value required");
       return value;
     }
   } else if (property.getName().equals("_emsTimeDiff")) {
     //            try {
     //                SimpleResultSetEnumerator rse = createEnumertor();
     //                JdbcMonitorImpl.Test(createConfiguration(), rse);
     //            } catch (JdbcMonitorVerificationException e) {
     //                switch (e.errorCode()) {
     //                case -22:
     //                    errors.put(getPropertyObject("_emsConfigFilePath"), e.getMessage());
     //                    break;
     //
     //                case -21:
     //                    errors.put(getPropertyObject("_emsConfigFilePath"), e.getMessage());
     //                    break;
     //
     //                case -32:
     //                    errors.put(getPropertyObject("_driver"), e.getMessage());
     //                    break;
     //
     //                case -31:
     //                    errors.put(getPropertyObject("_database"), e.getMessage());
     //                    break;
     //
     //                case -12:
     //                    errors.put(getPropertyObject("_emsTablePrimaryKeys"), e.getMessage());
     //                    break;
     //
     //                case -11:
     //                    errors.put(getPropertyObject("_fieldType"), e.getMessage());
     //                    break;
     //
     //                case -14:
     //                    errors.put(getPropertyObject("_select"), e.getMessage());
     //                    break;
     //
     //                case -13:
     //                    errors.put(getPropertyObject("_resetEmum"), e.getMessage());
     //                    break;
     //                }
     //            }
   }
   return super.verify(property, value, request, errors);
 }
 private String getPropertyRealName(StringProperty stringproperty) {
   CounterSpec counterspec = parseCounterSpec(stringproperty.getName());
   if (counterspec == null) {
     return null;
   } else {
     return getProperty(pCounterNames[counterspec.index - 1]) + "/" + counterspec.type;
   }
 }
 public String getProperty(StringProperty stringproperty) {
   String s = stringproperty.getName();
   if (s.startsWith("value")) {
     return getProperty(s);
   } else {
     return super.getProperty(stringproperty);
   }
 }
 static {
   mandatoryProps = new TreeSet();
   mandatoryProps.add("_driver");
   mandatoryProps.add("_database");
   mandatoryProps.add("_select");
   mandatoryProps.add("_from");
   mandatoryProps.add("_emsTablePrimaryKeys");
   mandatoryProps.add("lastEmum");
   mandatoryProps.add("_user");
   mandatoryProps.add("_password");
   String xmlName = Platform.getRoot() + "/classes/COM/dragonflow/topaz/ems/JDBCSource/db.xml";
   StringProperty props[] = StaticInitializer.initialize(xmlName);
   pFieldType = new ScalarProperty("_fieldType");
   pFieldType.setParameterOptions(true, true, 10, false);
   pFieldType.setDisplayText("Enumerating Field Type", "type of field used to order this query");
   pStatus = new StringProperty("pMStatus");
   pStatus.setIsThreshold(false);
   Vector vec = new Vector(Arrays.asList(props));
   vec.add(pStatus);
   vec.add(pFieldType);
   PropertiedObject.addProperties(
       "COM.dragonflow.StandardMonitor.EMSDatabaseMonitor", (StringProperty[]) vec.toArray(props));
   SiteViewObject.addClassElement(
       "COM.dragonflow.StandardMonitor.EMSDatabaseMonitor",
       Rule.stringToClassifier("pMStatus == 2\terror", false));
   SiteViewObject.addClassElement(
       "COM.dragonflow.StandardMonitor.EMSDatabaseMonitor",
       Rule.stringToClassifier("pMStatus == 1\twarning", false));
   SiteViewObject.addClassElement(
       "COM.dragonflow.StandardMonitor.EMSDatabaseMonitor",
       Rule.stringToClassifier("pMStatus == 0\tgood", false));
   SiteViewObject.addClassElement(
       "COM.dragonflow.StandardMonitor.EMSDatabaseMonitor",
       Rule.stringToClassifier("always\tgood"));
   PropertiedObject.setClassProperty(
       "COM.dragonflow.StandardMonitor.EMSDatabaseMonitor",
       "description",
       "Sends Topaz data retireved from a database by connecting to it and performing a query.\t");
   PropertiedObject.setClassProperty(
       "COM.dragonflow.StandardMonitor.EMSDatabaseMonitor", "title", "EMS Database");
   PropertiedObject.setClassProperty(
       "COM.dragonflow.StandardMonitor.EMSDatabaseMonitor", "topazName", "EMS Database");
   handleEmsLicense("COM.dragonflow.StandardMonitor.EMSDatabaseMonitor");
   PropertiedObject.setClassProperty(
       "COM.dragonflow.StandardMonitor.EMSDatabaseMonitor", "class", "EMSDatabaseMonitor");
   PropertiedObject.setClassProperty(
       "COM.dragonflow.StandardMonitor.EMSDatabaseMonitor", "topazType", "System Resources");
   PropertiedObject.setClassProperty(
       "COM.dragonflow.StandardMonitor.EMSDatabaseMonitor", "help", "EMSDatabaseMonitor.htm");
   PropertiedObject.setClassProperty(
       "COM.dragonflow.StandardMonitor.EMSDatabaseMonitor", "toolName", "Database Connection");
   PropertiedObject.setClassProperty(
       "COM.dragonflow.StandardMonitor.EMSDatabaseMonitor",
       "toolDescription",
       "Provides an interface to test a JDBC or ODBC connection to a database.");
   PropertiedObject.setClassProperty(
       "COM.dragonflow.StandardMonitor.EMSDatabaseMonitor", "classType", "advanced");
 }
Esempio n. 10
0
 public String verify(StringProperty property, String value, HTTPRequest request, HashMap errors) {
   if (property == m_EmsTimeDiff) {
     return m_EmsTimeDiff == null ? "0" : m_EmsTimeDiff.verify(property, value, request, errors);
   }
   if (property != null && property.getName().equals("_emsConfigFilePath")) {
     return ((EmsConfigFileProperty) property).verifyConfigFile(this, value, errors);
   } else {
     return super.verify(property, value, request, errors);
   }
 }
Esempio n. 11
0
 public String verify(
     StringProperty stringproperty, String s, HTTPRequest httprequest, HashMap hashmap) {
   if (stringproperty == pCounters) {
     if (s.equals("No Counters available for this machine")) {
       hashmap.put(stringproperty, stringproperty.getLabel() + " missing");
     }
     return s;
   } else {
     return super.verify(stringproperty, s, httprequest, hashmap);
   }
 }
Esempio n. 12
0
 public String GetPropertyLabel(StringProperty stringproperty, boolean flag) {
   String s = stringproperty.printString();
   String s1 = TextUtils.getValue(getLabels(), s);
   if (s1.length() != 0) {
     return s1;
   }
   if (flag) {
     return "";
   } else {
     return s;
   }
 }
Esempio n. 13
0
 static {
   returnURL = "/SiteView/cgi/go.exe/SiteView/?page=monitor&class=ASPMonitor";
   counterObjects = "Active Server Pages";
   pCounters = new StringProperty("_counters", "", "Selected Counters");
   pCounters.setDisplayText(
       "Counters",
       "the current selection of counters</TD></TR><TR><TD></TD><TD><A HREF=\"/SiteView/cgi/go.exe/SiteView/?page=counter&returnURL="
           + URLEncoder.encode(returnURL)
           + "&maxcounters="
           + nMaxCounters
           + "&counterobjects="
           + counterObjects
           + "&type=NTCounter\">choose counters</A>");
   pCounters.setParameterOptions(false, true, 1, false);
   pCounters.isMultiLine = true;
   StringProperty astringproperty[] = {pCounters};
   addProperties("com.dragonflow.StandardMonitor.ASPMonitor", astringproperty);
   addClassElement(
       "com.dragonflow.StandardMonitor.ASPMonitor",
       Rule.stringToClassifier("value0 == n/a\terror", true));
   addClassElement(
       "com.dragonflow.StandardMonitor.ASPMonitor", Rule.stringToClassifier("always\tgood"));
   setClassProperty(
       "com.dragonflow.StandardMonitor.ASPMonitor",
       "description",
       "Monitors Microsoft Active Server Pages server performance statistics.");
   setClassProperty("com.dragonflow.StandardMonitor.ASPMonitor", "help", "ASPServerMon.htm");
   setClassProperty("com.dragonflow.StandardMonitor.ASPMonitor", "title", "ASP Server");
   setClassProperty("com.dragonflow.StandardMonitor.ASPMonitor", "class", "ASPMonitor");
   setClassProperty("com.dragonflow.StandardMonitor.ASPMonitor", "target", "_serverName");
   setClassProperty(
       "com.dragonflow.StandardMonitor.ASPMonitor", "topazName", "MS Active Server Pages");
   setClassProperty(
       "com.dragonflow.StandardMonitor.ASPMonitor", "topazType", "Web Application Server");
   setClassProperty("com.dragonflow.StandardMonitor.ASPMonitor", "classType", "application");
   setClassProperty("com.dragonflow.StandardMonitor.ASPMonitor", "applicationType", "NTCounter");
   if (!Platform.isWindows()) {
     setClassProperty("com.dragonflow.StandardMonitor.ASPMonitor", "loadable", "false");
   }
 }
Esempio n. 14
0
 static {
   pPercentFull = new PercentProperty("percentFull");
   pPercentFull.setLabel("percent used");
   pPercentFull.setStateOptions(1);
   pFreeSpace = new NumericProperty("freeSpace", "0", "MB");
   pFreeSpace.setLabel("MB free");
   pFreeSpace.setStateOptions(2);
   pPageFaultsPerSecond = new RateProperty("pageFaultsPerSecond", "0", "pages", "seconds");
   pPageFaultsPerSecond.setLabel("pages/sec");
   pPageFaultsPerSecond.setStateOptions(3);
   pLastMeasurement = new NumericProperty("lastMeasurement");
   pLastPageFaults = new NumericProperty("lastPageFaults");
   StringProperty astringproperty[] = {
     pPercentFull, pFreeSpace, pPageFaultsPerSecond, pLastMeasurement, pLastPageFaults
   };
   addProperties("COM.dragonflow.StandardMonitor.MemoryMonitor", astringproperty);
   addClassElement(
       "COM.dragonflow.StandardMonitor.MemoryMonitor",
       Rule.stringToClassifier("percentFull > 90\terror", true));
   addClassElement(
       "COM.dragonflow.StandardMonitor.MemoryMonitor",
       Rule.stringToClassifier("percentFull > 80\twarning", true));
   addClassElement(
       "COM.dragonflow.StandardMonitor.MemoryMonitor",
       Rule.stringToClassifier("percentFull == n/a\terror"));
   addClassElement(
       "COM.dragonflow.StandardMonitor.MemoryMonitor", Rule.stringToClassifier("always\tgood"));
   setClassProperty(
       "COM.dragonflow.StandardMonitor.MemoryMonitor",
       "description",
       "Measure virtual memory usage");
   setClassProperty("COM.dragonflow.StandardMonitor.MemoryMonitor", "help", "MemoryMon.htm");
   setClassProperty("COM.dragonflow.StandardMonitor.MemoryMonitor", "title", "Memory");
   setClassProperty("COM.dragonflow.StandardMonitor.MemoryMonitor", "class", "MemoryMonitor");
   setClassProperty("COM.dragonflow.StandardMonitor.MemoryMonitor", "classType", "server");
   setClassProperty("COM.dragonflow.StandardMonitor.MemoryMonitor", "topazName", "Memory");
   setClassProperty(
       "COM.dragonflow.StandardMonitor.MemoryMonitor", "topazType", "System Resources");
 }
Esempio n. 15
0
 protected void updateStats(double ad[], String as[], Monitor monitor, int i) {
   Enumeration enumeration = monitor.getStatePropertyObjects();
   do {
     if (!enumeration.hasMoreElements()) {
       break;
     }
     StringProperty stringproperty = (StringProperty) enumeration.nextElement();
     if (stringproperty.getName().equals("snmpValue")
         || stringproperty.getName().equals("result")
         || stringproperty.getName().equals("value")
         || stringproperty.getName().equals("value0")
         || stringproperty.getName().equals("column1")) {
       String s = monitor.getProperty(stringproperty);
       if (!s.equals("n/a")) {
         ad[i] = TextUtils.toDouble(s);
       } else {
         ad[i] = -999D;
       }
       as[i] = monitor.getProperty("_name");
     }
   } while (true);
 }
Esempio n. 16
0
 public String GetPropertyLabel(StringProperty stringproperty, boolean flag) {
   if (stringproperty == pStatus) {
     return getProperty(pStatusLabel);
   }
   String s = stringproperty.printString();
   String s1 = TextUtils.getValue(getLabels(), s);
   if (s1.length() != 0) {
     return s1;
   }
   if (flag && s.indexOf("value") < 0) {
     return "";
   } else {
     return s;
   }
 }
 static {
   String s = (com.dragonflow.StandardMonitor.Exchange2k3MailboxMonitor.class).getName();
   pNotAccessedN = new StringProperty("_notaccessedN");
   pNotAccessedN.setDisplayText("Days since access", "For \"Mailboxes not accessed in N days\"");
   pNotAccessedN.setParameterOptions(true, 5, false);
   pTopSizeN = new StringProperty("_topsizeN");
   pTopSizeN.setDisplayText("N largest mailboxes", "For \"Top N mailboxes in size\"");
   pTopSizeN.setParameterOptions(true, 6, false);
   StringProperty astringproperty[] = {pNotAccessedN, pTopSizeN};
   addProperties(s, astringproperty);
   addClassElement(s, Rule.stringToClassifier("status != OK\terror"));
   addClassElement(s, Rule.stringToClassifier("always\tgood", true));
   setClassProperty(s, "description", "Monitors Exchange 2003 Mailboxes.");
   setClassProperty(s, "title", "Exchange 2003 Mailbox");
   setClassProperty(s, "class", "Exchange2k3MailboxMonitor");
   setClassProperty(s, "help", "Exch2k3MailboxMon.htm");
   setClassProperty(s, "target", "_server");
   setClassProperty(s, "topazName", "Exchange 2003 Mailbox");
   setClassProperty(s, "classType", "application");
   if (!Platform.isWindows() || !LUtils.isValidSSforXLicense(new Exchange2k3MailboxMonitor())) {
     setClassProperty(s, "loadable", "false");
   }
   setClassProperty(s, "addable", "false");
 }
Esempio n. 18
0
 public String verify(
     StringProperty stringproperty, String s, HTTPRequest httprequest, HashMap hashmap) {
   if (stringproperty == pFrequency) {
     HashMap hashmap1 = MasterConfig.getMasterConfig();
     int i = TextUtils.toInt(TextUtils.getValue(hashmap1, "_J2EEReportMonitorMinRefreshTime"));
     if (i < 15) {
       i = 300;
     }
     String s1 = httprequest.getValue(stringproperty.getName() + "Units");
     int j = FrequencyProperty.toSeconds(TextUtils.toInt(s), s1);
     if (j < i && j != 0) {
       hashmap.put(stringproperty, j + "  was less than " + i + " seconds");
     }
     return Integer.toString(j);
   } else {
     return super.verify(stringproperty, s, httprequest, hashmap);
   }
 }
Esempio n. 19
0
 public void setProperty(StringProperty stringproperty, String s) {
   CounterSpec counterspec = parseCounterSpec(stringproperty.getName());
   if (counterspec == null) {
     super.setProperty(stringproperty, s);
     return;
   }
   String as[];
   if (counterspec.type.endsWith("ART")) {
     as = artValues;
   } else if (counterspec.type.endsWith("HPS")) {
     as = hpsValues;
   } else {
     super.setProperty(stringproperty, s);
     return;
   }
   int i = counterspec.index - 1;
   if (i < 0 || i >= nMaxCounters) {
     super.setProperty(stringproperty, s);
     return;
   } else {
     as[i] = s;
     return;
   }
 }
Esempio n. 20
0
  static {
    pLogFile = new StringProperty("_logFile");
    pLogFile.setDisplayText(
        MonitorIniValueReader.getValue(
            LogMonitor.class.getName(), "_logFile", MonitorIniValueReader.LABEL),
        MonitorIniValueReader.getValue(
            LogMonitor.class.getName(), "_logFile", MonitorIniValueReader.DESCRIPTION));
    // pLogFile.setDisplayText("Log File Pathname", "the pathname of the log file to monitor\n<p> In
    // order to monitor remote Unix files choose the 'Choose Server' link above.  For NT, you must
    // specify the UNC path to the file.  For example,
    // \\\\machinename\\sharename\\filename.log.\n<p>Optionally, use a <a
    // href=/SiteView/docs/regexp.htm>regular expression</a> to insert date and time variables
    // <br>(e.g s/ex$shortYear$$0month$$0day$.log/ to match IIS log files)");
    pLogFile.setParameterOptions(true, 1, false);

    pResetFile = new ScalarProperty("_resetFile");
    pResetFile.setDisplayText(
        MonitorIniValueReader.getValue(
            LogMonitor.class.getName(), "_resetFile", MonitorIniValueReader.LABEL),
        MonitorIniValueReader.getValue(
            LogMonitor.class.getName(), "_resetFile", MonitorIniValueReader.DESCRIPTION));
    // pResetFile.setDisplayText("Check from Beginning", "Select file checking option as follows:\n
    // <br><b>Never</b> - Check only newly added records (default)\n<br><b>First Time Only</b> -
    // Check the whole file once, then only new records\n<br><b>Always</b> - Always check the whole
    // file\n");
    pResetFile.setValue("none");
    pResetFile.setParameterOptions(true, 2, false);

    pAlerting = new ScalarProperty("_alerting", "");
    pAlerting.setDisplayText(
        MonitorIniValueReader.getValue(
            LogMonitor.class.getName(), "_alerting", MonitorIniValueReader.LABEL),
        MonitorIniValueReader.getValue(
            LogMonitor.class.getName(), "_alerting", MonitorIniValueReader.DESCRIPTION));
    // pAlerting.setDisplayText("Run Alerts", "How alerts for this monitor are triggered by the
    // following options:  <TR><TD>(1) For <b>'for each log entry matched and report status'</b> the
    // monitor triggers alerts for every matching entry found based on the <b>Error If</b> and
    // <b>Warning If</b> thresholds defined for the monitor. </TD></TR>\n<TR><TD>(2) For <b>'once,
    // after all log entries have been checked'</b>, the monitor counts up the number of matches and
    // then triggers alerts based on the <b>Error If</b> and <b>Warning If</b> thresholds defined
    // for the monitor. </TD></TR>\n");
    pAlerting.setParameterOptions(true, 3, false);

    pMatch = new StringProperty("_match");
    pMatch.setDisplayText(
        MonitorIniValueReader.getValue(
            LogMonitor.class.getName(), "_match", MonitorIniValueReader.LABEL),
        MonitorIniValueReader.getValue(
            LogMonitor.class.getName(), "_match", MonitorIniValueReader.DESCRIPTION));
    // pMatch.setDisplayText("Content Match", "enter the text to match in a log entry or a <a
    // href=/SiteView/docs/regexp.htm>regular expression</a>. By default successful match makes
    // monitor alert or error.");
    pMatch.setParameterOptions(true, 4, false);

    pRulesFile = new StringProperty("_rulesFile");
    pRulesFile.setParameterOptions(true, 4, true);
    String rulesfile_description =
        MonitorIniValueReader.getValue(
            LogMonitor.class.getName(), "_rulesFile", MonitorIniValueReader.DESCRIPTION);
    rulesfile_description = rulesfile_description.replaceAll("1%", ruleFileDisplayText);
    pRulesFile.setDisplayText(
        MonitorIniValueReader.getValue(
            LogMonitor.class.getName(), "_match", MonitorIniValueReader.LABEL),
        rulesfile_description);
    // pRulesFile.setDisplayText("Rules File Pathname", ruleFileDisplayText);

    pNoFileCheckExist = new BooleanProperty("_noFileCheckExist");
    pNoFileCheckExist.setDisplayText(
        MonitorIniValueReader.getValue(
            LogMonitor.class.getName(), "_noFileCheckExist", MonitorIniValueReader.LABEL),
        MonitorIniValueReader.getValue(
            LogMonitor.class.getName(), "_noFileCheckExist", MonitorIniValueReader.DESCRIPTION));
    // pNoFileCheckExist.setDisplayText("No Error on File Not Found.", "if the file is not found
    // then don't error.");
    pNoFileCheckExist.setParameterOptions(true, 5, true);

    pValueLabels = new StringProperty("_valeLabels", "");
    pValueLabels.setDisplayText(
        MonitorIniValueReader.getValue(
            LogMonitor.class.getName(), "_valeLabels", MonitorIniValueReader.LABEL),
        MonitorIniValueReader.getValue(
            LogMonitor.class.getName(), "_valeLabels", MonitorIniValueReader.DESCRIPTION));
    // pValueLabels.setDisplayText("Match Value Labels", "Labels for the values matched on the
    // script output, separated by a \",\"");
    pValueLabels.setParameterOptions(true, 6, true);

    pLines = new NumericProperty("lineCount");
    pLines.setLabel(
        MonitorIniValueReader.getValue(
            LogMonitor.class.getName(), "lineCount", MonitorIniValueReader.LABEL));
    // pLines.setLabel("lines");
    pLines.setIsThreshold(true);

    pMatches = new NumericProperty("matchCount");
    pMatches.setLabel(
        MonitorIniValueReader.getValue(
            LogMonitor.class.getName(), "matchCount", MonitorIniValueReader.LABEL));
    // pMatches.setLabel("matches");
    pMatches.setIsThreshold(true);

    pLogName = new StringProperty("logName");
    pLogName.setDisplayText(
        MonitorIniValueReader.getValue(
            LogMonitor.class.getName(), "logName", MonitorIniValueReader.LABEL),
        MonitorIniValueReader.getValue(
            LogMonitor.class.getName(), "logName", MonitorIniValueReader.DESCRIPTION));
    // pLogName.setDisplayText("Don't use in Templates", "this is the path to the log file. However,
    // it <b>should not be used</b>, because it is not loaded all of the time. It depends on the
    // state of the monitor");
    pMatchDetails = new StringProperty("matchDetails");

    pLastAlertsPerMinute =
        new RateProperty(
            "lastAlertsPerMinute",
            "0",
            MonitorIniValueReader.getValue(
                LogMonitor.class.getName(), "lastAlertsPerMinute", MonitorIniValueReader.UNIT));
    // pLastAlertsPerMinute = new RateProperty("lastAlertsPerMinute", "0", "lines", "minutes");
    pLastAlertsPerMinute.setLabel(
        MonitorIniValueReader.getValue(
            LogMonitor.class.getName(), "lastAlertsPerMinute", MonitorIniValueReader.LABEL));
    // pLastAlertsPerMinute.setLabel("matches/min");
    pLastAlertsPerMinute.setStateOptions(1);

    pLastLinesPerMinute =
        new RateProperty(
            "lastLinesPerMinute",
            "0",
            MonitorIniValueReader.getValue(
                LogMonitor.class.getName(), "lastLinesPerMinute", MonitorIniValueReader.UNIT));
    // pLastLinesPerMinute = new RateProperty("lastLinesPerMinute", "0", "lines", "minutes");
    pLastLinesPerMinute.setLabel(
        MonitorIniValueReader.getValue(
            LogMonitor.class.getName(), "lastAlertsPerMinute", MonitorIniValueReader.LABEL));
    // pLastLinesPerMinute.setLabel("lines/min");
    pLastLinesPerMinute.setStateOptions(2);

    pLastModDate = new NumericProperty("lastModDate");

    pLastFilePosition = new NumericProperty("lastFilePosition", "-1");

    pStartSearchPosition = new NumericProperty("startSearchPosition", "-1");

    pLastMeasurement = new NumericProperty("lastMeasurement", "0");

    pMessage = new StringProperty("message");

    pValue = new NumericProperty("value");
    pValue.setStateOptions(3);
    pValue2 = new NumericProperty("value2");
    pValue2.setStateOptions(4);
    pValue3 = new NumericProperty("value3");
    pValue3.setStateOptions(5);
    pValue4 = new NumericProperty("value4");
    pValue4.setStateOptions(6);
    StringProperty astringproperty[] = {
      pLogFile, pResetFile, pRulesFile, pNoFileCheckExist, pAlerting, pMatch, pMatches, pLines,
          pMatchDetails, pLastAlertsPerMinute,
      pLastLinesPerMinute, pLogName, pLastFilePosition, pStartSearchPosition, pLastModDate,
          pLastMeasurement, pMessage, pValue, pValue2, pValue3,
      pValue4, pValueLabels
    };
    String s = (com.dragonflow.StandardMonitor.LogMonitor.class).getName();
    addProperties(s, astringproperty);
    addClassElement(s, Rule.stringToClassifier("matchCount > 0\terror", true));
    addClassElement(s, Rule.stringToClassifier("matchCount == 'n/a'\terror"));
    addClassElement(s, Rule.stringToClassifier("always\tgood"));
    setClassProperty(
        s,
        "description",
        MonitorTypeValueReader.getValue(
            LogMonitor.class.getName(), MonitorTypeValueReader.DESCRIPTION));
    // setClassProperty(s, "description", "Scans log files for specific log entries.");

    setClassProperty(s, "help", "LogFileMon.htm");

    setClassProperty(
        s,
        "title",
        MonitorTypeValueReader.getValue(LogMonitor.class.getName(), MonitorTypeValueReader.TITLE));
    // setClassProperty(s, "title", "Log File");

    setClassProperty(s, "class", "LogMonitor");

    setClassProperty(
        s,
        "target",
        MonitorTypeValueReader.getValue(LogMonitor.class.getName(), MonitorTypeValueReader.TARGET));
    // setClassProperty(s, "target", "_logFile");

    setClassProperty(
        s,
        "topazName",
        MonitorTypeValueReader.getValue(
            LogMonitor.class.getName(), MonitorTypeValueReader.TOPAZNAME));
    // setClassProperty(s, "topazName", "Log Monitor");

    setClassProperty(
        s,
        "topazType",
        MonitorTypeValueReader.getValue(
            LogMonitor.class.getName(), MonitorTypeValueReader.TOPAZTYPE));
    // setClassProperty(s, "topazType", "System Resources");

    setClassProperty(
        s,
        "classType",
        MonitorTypeValueReader.getValue(
            LogMonitor.class.getName(), MonitorTypeValueReader.CLASSTYPE));
    // setClassProperty(s, "classType", "advanced");
  }
Esempio n. 21
0
  static {
    maxNumberOfMatches = 30;
    ArrayList arraylist = new ArrayList();
    pScript = new ScalarProperty("_script", "");
    if (Platform.isWindows()) {
      pScript.setDisplayText(
          "Script",
          "the script from the scripts directory to run (example: scriptTest.bat), or choose <a href=\"\\SiteView\\docs\\ScriptMon.htm#script\" TARGET=Help>USE COMMAND </a>for the command file below.");
    } else {
      pScript.setDisplayText(
          "Script",
          "the script from the scripts directory to run (example: scriptTest.sh),  or choose <a href=\"\\SiteView\\docs\\ScriptMon.htm#script\" TARGET=Help>USE COMMAND </a>for the command file below.");
    }
    pScript.setParameterOptions(true, 2, false);
    arraylist.add(pScript);
    pParameters = new StringProperty("_parameters", "");
    pParameters.setDisplayText(
        "Parameters",
        "additional parameters to pass to the script. Optionally, use a <a href=/SiteView/docs/regexp.htm>regular expression</a> to insert date and time variables into the parameters <br>(e.g s/$month$ $day$ $year$/)");
    pParameters.setParameterOptions(true, 3, false);
    arraylist.add(pParameters);
    pLocalScriptLocation = new StringProperty("_localScriptLocation", "scripts");
    pLocalScriptLocation.setParameterOptions(false, true, 4, false);
    arraylist.add(pLocalScriptLocation);
    pRemoteScript = new ScalarProperty("_remotescript", "none");
    pRemoteScript.setDisplayText(
        "USE COMMAND Script File",
        "The file that contains a command to be run on the remote UNIX machine.");
    pRemoteScript.setParameterOptions(true, 4, true);
    arraylist.add(pRemoteScript);
    pCacheLife = new NumericProperty("_cacheLife", "0", "seconds");
    pCacheLife.setDisplayText(
        "Cache Life",
        "The lifetime, in seconds, of the cache, each monitor run will check if the cache life has expired, if it has not then the cache data will be used, otherwise the script will be executed to update the cache.");
    pCacheLife.setParameterOptions(true, 5, true);
    arraylist.add(pCacheLife);
    pExpression = new StringProperty("_expression");
    pExpression.setDisplayText(
        "Match Expression",
        "optional Perl regular expression to match against the output of the script or the command from the command file, to extract values (example: /(\\d*) File.*([\\d,]*) bytes/).");
    pExpression.setParameterOptions(true, 6, true);
    arraylist.add(pExpression);
    pMaxMeasurement = new NumericProperty("_maxMeasurement", "0", "milleseconds");
    pMaxMeasurement.setDisplayText(
        "Maximum for Measurement",
        "optional value to specify as maximum for gauge display in milleseconds (example: if the runtime of the script is 4 seconds and this value is set at 8 seconds (8000ms) than the gauge will show at 50%");
    pMaxMeasurement.setParameterOptions(true, 7, true);
    arraylist.add(pMaxMeasurement);
    pValueLabels = new StringProperty("_valeLabels", "");
    pValueLabels.setDisplayText(
        "Match Value Labels",
        "Labels for the values matched on the script output, separated by a \",\"");
    pValueLabels.setParameterOptions(true, 3, true);
    arraylist.add(pValueLabels);
    pTimeout = new NumericProperty("_timeout", "-1", "seconds");
    pTimeout.setDisplayText(
        "Timeout",
        "The total time, in seconds, to wait for a successful script run. Default value is -1 (no timeout).");
    pTimeout.setParameterOptions(false, 2, true);
    arraylist.add(pTimeout);
    int i = 1;
    pRoundTripTime = new NumericProperty("roundTripTime", "0", "milliseconds");
    pRoundTripTime.setLabel("round trip time");
    pRoundTripTime.setStateOptions(i++);
    arraylist.add(pRoundTripTime);
    pStatus = new StringProperty("status");
    pStatus.setIsThreshold(true);
    arraylist.add(pStatus);
    pStatusLabel = new StringProperty("_statusLabel", "status");
    pStatusLabel.setParameterOptions(false, 3, true);
    arraylist.add(pStatusLabel);
    pScriptOutput = new StringProperty("scriptOutput");
    arraylist.add(pScriptOutput);
    HashMap hashmap = MasterConfig.getMasterConfig();
    if (hashmap != null) {
      int j = TextUtils.toInt(TextUtils.getValue(hashmap, "_maxNumScriptMatches"));
      if (j > 0) {
        maxNumberOfMatches = j;
      }
    }
    pMatchValue = new NumericProperty[maxNumberOfMatches];
    int k = TextUtils.toInt(TextUtils.getValue(hashmap, "_defaultPrecision"));
    for (int l = 0; l < pMatchValue.length; l++) {
      String s = getNameFromIndex(l);
      pMatchValue[l] = new NumericProperty(s);
      pMatchValue[l].setStateOptions(i++);
      pMatchValue[l].setIsThreshold(true);
      if (k > 0) {
        pMatchValue[l].defaultPrecision = k;
      }
      arraylist.add(pMatchValue[l]);
    }

    StringProperty astringproperty[] = new StringProperty[arraylist.size()];
    for (int i1 = 0; i1 < arraylist.size(); i1++) {
      astringproperty[i1] = (StringProperty) arraylist.get(i1);
    }

    String s1 = (COM.dragonflow.StandardMonitor.ScriptMonitor.class).getName();
    addProperties(s1, astringproperty);
    addClassElement(s1, Rule.stringToClassifier("status != 0\terror"));
    addClassElement(s1, Rule.stringToClassifier("status == 0\tgood"));
    setClassProperty(
        s1,
        "description",
        "Verifies that a script or batch file can be run. Can also be used to automatically run scripts.");
    setClassProperty(s1, "help", "ScriptMon.htm");
    setClassProperty(s1, "title", "Script");
    setClassProperty(s1, "class", "ScriptMonitor");
    setClassProperty(s1, "target", "_script");
    setClassProperty(s1, "classType", "advanced");
    setClassProperty(s1, "loadable", "true");
    setClassProperty(s1, "topazName", "Script");
    setClassProperty(s1, "topazType", "System Resources");
  }
Esempio n. 22
0
  static {
    Array array = new Array();
    pSAPServer = new StringProperty("_server", "");
    pSAPServer.setDisplayText("Server", "SAP server name.");
    pSAPServer.setParameterOptions(false, true, BrowsableBase.COUNTER_PROPERTY_INDEX + 1, false);
    array.add(pSAPServer);
    pSystem = new StringProperty("_system", "00");
    pSystem.setDisplayText("System", "Enter the System number for SAP");
    pSystem.setParameterOptions(false, true, BrowsableBase.COUNTER_PROPERTY_INDEX + 2, false);
    array.add(pSystem);
    pClient = new StringProperty("_client");
    pClient.setDisplayText("Client", "Enter the Client for SAP, leave blank for default");
    pClient.setParameterOptions(false, true, BrowsableBase.COUNTER_PROPERTY_INDEX + 3, false);
    array.add(pClient);
    pUsername = new StringProperty("_username");
    pUsername.setDisplayText("Username", "Enter the Username for SAP");
    pUsername.setParameterOptions(false, true, BrowsableBase.COUNTER_PROPERTY_INDEX + 4, false);
    array.add(pUsername);
    pPassword = new StringProperty("_password");
    pPassword.setDisplayText("Password", "Enter the Password for SAP");
    pUsername.setParameterOptions(false, true, BrowsableBase.COUNTER_PROPERTY_INDEX + 5, false);
    pPassword.isPassword = true;
    array.add(pPassword);
    StringProperty astringproperty[] = new StringProperty[array.size()];
    for (int i = 0; i < array.size(); i++) {
      astringproperty[i] = (StringProperty) array.at(i);
    }

    String s = (com.dragonflow.StandardMonitor.SAPMonitor.class).getName();
    addProperties(s, astringproperty);
    addClassElement(s, Rule.stringToClassifier("countersInError > 0\terror", true));
    addClassElement(s, Rule.stringToClassifier("always\tgood"));
    setClassProperty(s, "description", "Monitor statistics from a SAP application server");
    setClassProperty(s, "help", "SAPMon.htm");
    setClassProperty(s, "title", "SAP");
    setClassProperty(s, "class", "SAPMonitor");
    setClassProperty(s, "target", "_server");
    setClassProperty(s, "topazName", "SAP");
    setClassProperty(s, "classType", "application");
    setClassProperty(s, "topazType", "ERP");
    if (!Platform.isWindows()) {
      setClassProperty(s, "loadable", "false");
    }
  }
Esempio n. 23
0
 static {
   pItems = new ScalarProperty("_item", "");
   ((ScalarProperty) pItems).multiple = true;
   ((ScalarProperty) pItems).listSize = 3;
   pItems.setDisplayText(
       "Items",
       "Select two SNMP, Script, or Database monitors to be checked and their results calculated.");
   pItems.setParameterOptions(true, 1, false);
   pOperation = new ScalarProperty("_opertaion", "");
   pOperation.setDisplayText(
       "Operation", "Select the operation to be performed on the results of the above monitors. ");
   pOperation.setParameterOptions(true, 2, false);
   pRunMonitors = new BooleanProperty("_checkSequentially", "");
   pRunMonitors.setDisplayText("Run Monitors", "Run each monitor before performing calculation.");
   pRunMonitors.setParameterOptions(true, 3, true);
   pDelay = new NumericProperty("_delay", "0");
   pDelay.setDisplayText(
       "Monitor Delay", "If running each monitor, delay in seconds between monitor runs.");
   pDelay.setParameterOptions(true, 4, true);
   pStatic = new StringProperty("_static", "");
   pStatic.setDisplayText(
       "Constant",
       "Operate a constant on the Operation result. For example entering *8 will multiply the Operation result by 8.");
   pStatic.setParameterOptions(true, 5, true);
   pValueLabels = new StringProperty("_valeLabels", "");
   pValueLabels.setDisplayText(
       "Result Label", "Optional label for the result of the formula calculation.");
   pValueLabels.setParameterOptions(true, 6, true);
   pResult = new NumericProperty("result");
   pResult.setLabel("Result");
   pResult.setStateOptions(1);
   pStatus = new StringProperty("status");
   StringProperty astringproperty[] = {
     pItems, pRunMonitors, pDelay, pOperation, pResult, pStatus, pStatic, pValueLabels
   };
   addProperties("com.dragonflow.StandardMonitor.BandwidthMonitor", astringproperty);
   addClassElement(
       "com.dragonflow.StandardMonitor.BandwidthMonitor",
       Rule.stringToClassifier("status == 'n/a'\terror", true));
   addClassElement(
       "com.dragonflow.StandardMonitor.BandwidthMonitor", Rule.stringToClassifier("always\tgood"));
   setClassProperty(
       "com.dragonflow.StandardMonitor.BandwidthMonitor",
       "description",
       "Monitor two SNMP, Script, or Database monitors and perform an arithmetic operation on the results.");
   setClassProperty("com.dragonflow.StandardMonitor.BandwidthMonitor", "help", "BandwidthMon.htm");
   setClassProperty(
       "com.dragonflow.StandardMonitor.BandwidthMonitor", "title", "Formula Composite");
   setClassProperty(
       "com.dragonflow.StandardMonitor.BandwidthMonitor", "class", "BandwidthMonitor");
   setClassProperty("com.dragonflow.StandardMonitor.BandwidthMonitor", "topazName", "Bandwidth");
   setClassProperty(
       "com.dragonflow.StandardMonitor.BandwidthMonitor", "topazType", "System Resources");
   setClassProperty("com.dragonflow.StandardMonitor.BandwidthMonitor", "target", "_opertaion");
   setClassProperty("com.dragonflow.StandardMonitor.BandwidthMonitor", "loadable", "true");
 }