Ejemplo n.º 1
0
 protected java.lang.String doRequest(java.lang.String s, boolean flag, java.lang.String s1)
     throws java.lang.Exception {
   if (s == null) {
     throw new Exception("Paramater uri cannot be null");
   }
   com.dragonflow.Utils.SocketSession socketsession =
       com.dragonflow.Utils.SocketSession.getSession(null);
   java.lang.StringBuffer stringbuffer = new StringBuffer(10000);
   java.lang.String s2 = "http://" + getConnID() + s;
   jgl.Array array = null;
   if (s1 != null) {
     array = new Array();
     array.add("Custom-Content: " + s1);
   }
   long al[] =
       com.dragonflow.StandardMonitor.URLMonitor.checkURL(
           socketsession,
           s2,
           null,
           null,
           null,
           null,
           null,
           array,
           null,
           null,
           null,
           stringbuffer,
           0x989680L,
           null,
           0,
           60000,
           null);
   java.lang.String s3 =
       com.dragonflow.StandardMonitor.URLMonitor.getHTTPContent(stringbuffer.toString());
   if (al[0] == 200L) {
     s3 = s3.trim();
     if (s3.startsWith("<") && flag) {
       java.lang.String s5 = s3.substring(0, 50);
       java.lang.String s4;
       if (s3.indexOf("<P>") >= 0) {
         xmlKeys = xmlShortKeys;
         s4 = "J2EEGetListShort.xsl";
       } else {
         xmlKeys = xmlLongKeys;
         s4 = "J2EEGetList.xsl";
       }
       return J2EEConnection.transform(s3, "templates.applications/" + s4);
     } else {
       return s3;
     }
   } else {
     throw new Exception(com.dragonflow.StandardMonitor.URLMonitor.lookupStatus(al[0]));
   }
 }
Ejemplo n.º 2
0
  public static java.lang.String getNameFromArray(jgl.Array array) {
    java.lang.String s = "";
    int i = array.size();
    int j;
    if (array.at(0).equals("All SQL")) {
      j = 1;
    } else {
      j = 0;
    }
    for (int k = i; k > j; k--) {
      if (k < array.size()) {
        s = s + '/';
      }
      s = s + J2EEConnection.escapeString((java.lang.String) array.at(k - 1));
    }

    return s;
  }
Ejemplo n.º 3
0
  private synchronized void calcCounterUnion() {
    java.util.HashSet hashset = new HashSet();
    synchronized (activeMonitors) {
      Monitor monitor;
      for (java.util.Iterator iterator = activeMonitors.values().iterator();
          iterator.hasNext();
          hashset.addAll(monitor.getCounters())) {
        monitor = (Monitor) iterator.next();
      }
    }
    synchronized (counterUnion) {
      if (!hashset.equals(counterUnion)) {
        counterUnion.clear();
        java.lang.String s;
        for (java.util.Iterator iterator1 = hashset.iterator();
            iterator1.hasNext();
            counterUnion.put(s, J2EEConnection.parseName(s))) {
          s = (java.lang.String) iterator1.next();
        }

        postMetricList();
      }
    }
  }
Ejemplo n.º 4
0
  private void handleMetricData(java.lang.String s) throws java.lang.Exception {
    long l = java.lang.System.currentTimeMillis() / 1000L;
    org.w3c.dom.Document document = documentBuilder.parse(new InputSource(new StringReader(s)));
    org.w3c.dom.NodeList nodelist =
        document.getElementsByTagName((java.lang.String) xmlKeys.get("counter"));
    int i = nodelist.getLength();
    java.util.HashMap hashmap = new HashMap();
    for (int j = 0; j < i; j++) {
      org.w3c.dom.Element element = (org.w3c.dom.Element) nodelist.item(j);
      if (element.getAttribute((java.lang.String) xmlKeys.get("name")).equals("HPS")) {
        continue;
      }
      org.w3c.dom.Element element1 = (org.w3c.dom.Element) element.getParentNode();
      java.util.Map map = getValuesFromObject(element1);
      java.util.HashMap hashmap1 = new HashMap();
      jgl.Array array = new Array();
      for (org.w3c.dom.Element element2 = element1;
          element2.getTagName().equals((java.lang.String) xmlKeys.get("object"));
          element2 = (org.w3c.dom.Element) element2.getParentNode()) {
        java.lang.String s4 = element2.getAttribute((java.lang.String) xmlKeys.get("class"));
        java.lang.String s5 = (java.lang.String) xmlToLong.get(s4);
        if (s5 == null) {
          s5 = s4;
        }
        java.lang.String s6 = element2.getAttribute((java.lang.String) xmlKeys.get("name"));
        hashmap1.put(s5, s6);
        array.add(s5 + ": " + s6);
      }

      java.lang.String s2 = J2EEConnection.getNameFromArray(array);
      hashmap.put(s2, new SampleData(hashmap1, map));
    }

    for (java.util.Iterator iterator = activeMonitors.entrySet().iterator(); iterator.hasNext(); ) {
      java.util.Map.Entry entry = (java.util.Map.Entry) iterator.next();
      java.lang.String s1 = (java.lang.String) entry.getKey();
      Monitor monitor = (Monitor) entry.getValue();
      java.util.Set set = monitor.getCounters();
      java.util.LinkedList linkedlist = new LinkedList();
      java.lang.String s3 = java.lang.String.valueOf(l);
      boolean flag = false;
      for (java.util.Iterator iterator1 = set.iterator(); iterator1.hasNext(); ) {
        java.lang.String s7 = (java.lang.String) iterator1.next();
        SampleData sampledata = (SampleData) hashmap.get(s7);
        if (sampledata == null) {
          java.lang.System.out.println(
              "J2EEConnection " + getConnID() + "/" + s1 + ": Counter missing - " + s7);
          flag = true;
        } else {
          //                    com.dragonflow.topaz.j2ee.comm.HashedSample hashedsample = new
          // HashedSample(l, "J2EEMonitor");
          java.util.Map.Entry entry1;
          //                    for(java.util.Iterator iterator2 =
          // sampledata.values.entrySet().iterator(); iterator2.hasNext();
          // hashedsample.addValue((java.lang.String)entry1.getKey(), entry1.getValue()))
          //                    {
          //                        entry1 = (java.util.Map.Entry)iterator2.next();
          //                    }

          //                    hashedsample.addValue("TimeStamp", new Double(l));
          //                    hashedsample.setMeasurementValue("Monitor", "J2EEMonitor");
          //                    hashedsample.setMeasurementValue("TimeStamp", s3);
          //                    java.util.Map.Entry entry2;
          //                    for(java.util.Iterator iterator3 =
          // sampledata.measurment.entrySet().iterator(); iterator3.hasNext();
          // hashedsample.setMeasurementValue((java.lang.String)entry2.getKey(),
          // (java.lang.String)entry2.getValue()))
          //                    {
          //                        entry2 = (java.util.Map.Entry)iterator3.next();
          //                    }
          //
          //                    linkedlist.add(hashedsample);
        }
      }

      if (flag) {
        com.dragonflow.Log.LogManager.log("error", "Monitor: " + s1 + " missing counter");
        monitor.setLastError(
            "Probe is out of sync. This is probably due to a second client (such as SiteView or LoadRunner) running against the same probe. To resolve this, shut down the unwanted client and repost metrics from the Tools link on this row.");
      } else {
        monitor.setLastError(null);
      }
      //            com.dragonflow.topaz.j2ee.configuration.CheckSampleChunkResult
      // checksamplechunkresult = aggregationConfigurator.checkSampleChunk(linkedlist);
      //            java.util.ArrayList arraylist =
      // checksamplechunkresult.getResultListByAggregatorId("SiteViewAggregator");
      //            synchronized(monitor)
      //            {
      //                if(arraylist != null)
      //                {
      //                    monitor.getAggregator().addChunk(arraylist);
      //                    monitor.setHasResults(true);
      //                }
      //            }
    }
  }
Ejemplo n.º 5
0
 public void run() {
   con.getMetricData(true);
 }