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");
 }
Example #2
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");
  }