Exemplo n.º 1
0
 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");
 }
Exemplo n.º 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");
  }
Exemplo n.º 3
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");
  }