Esempio n. 1
0
  void processSiteView(PortalSiteView portalsiteview) {
    boolean flag = visitor.siteviewPre(portalsiteview);
    if (flag) {
      if (debug) {
        PortalSiteView _tmp = portalsiteview;
        TextUtils.debugPrint("search groups: " + portalsiteview.getProperty(PortalSiteView.pTitle));
      }
      Array array = getSortedGroupIDs(portalsiteview);
      for (int i = 0; i < array.size(); i++) {
        String s = (String) array.at(i);
        MonitorGroup monitorgroup = (MonitorGroup) portalsiteview.getElement(s);
        if (monitorgroup == null || !itemFilter.itemAllowed(monitorgroup.getFullID())) {
          continue;
        }
        if (debug) {
          MonitorGroup _tmp1 = monitorgroup;
          TextUtils.debugPrint("process group: " + monitorgroup.getProperty(MonitorGroup.pName));
        }
        processGroup(monitorgroup, portalsiteview);
      }

      if (addAlerts) {
        Array array1 =
            portalsiteview.getElementsOfClass("COM.dragonflow.SiteView.Rule", false, false);
        Rule rule;
        for (Enumeration enumeration = array1.elements();
            enumeration.hasMoreElements();
            processAlert(rule, null, null, portalsiteview)) {
          rule = (Rule) enumeration.nextElement();
        }
      }
    }
    visitor.siteviewPost(portalsiteview);
  }
Esempio n. 2
0
 /**
  * @param monitorgroup
  * @param portalsiteview
  */
 void processGroup(MonitorGroup monitorgroup, PortalSiteView portalsiteview) {
   boolean flag = visitor.groupPre(monitorgroup, portalsiteview);
   if (flag) {
     if (addAlerts) {
       Array array = monitorgroup.getElementsOfClass("COM.dragonflow.SiteView.Rule", false, false);
       Rule rule;
       for (Enumeration enumeration1 = array.elements();
           enumeration1.hasMoreElements();
           processAlert(rule, null, monitorgroup, portalsiteview)) {
         rule = (Rule) enumeration1.nextElement();
       }
     }
     Enumeration enumeration = monitorgroup.getMonitors();
     while (enumeration.hasMoreElements()) {
       Monitor monitor = (Monitor) enumeration.nextElement();
       if (itemFilter.itemAllowed(monitor.getFullID()) && itemFilter.monitorAllowed(monitor)) {
         if (debug) {
           Monitor _tmp = monitor;
           TextUtils.debugPrint("process monitor: " + monitor.getProperty(Monitor.pName));
         }
         processMonitor(monitor, monitorgroup, portalsiteview);
       }
     }
   }
   visitor.groupPost(monitorgroup, portalsiteview);
 }
Esempio n. 3
0
 public SiteViewObject getElement(String s) {
   Object obj = null;
   portalAssert(isPortalID(s), "Portal.getElement - accepts only portal IDs: " + s);
   String as[] = getIDComponents(s);
   String s1 = as[0];
   String s2 = as[1];
   String s3 = as[2];
   if (s1.length() == 0) {
     obj = this;
   } else {
     PortalSiteView portalsiteview = (PortalSiteView) getElementByID(s1);
     if (portalsiteview != null) {
       if (s2.length() == 0) {
         obj = portalsiteview;
       } else {
         MonitorGroup monitorgroup = (MonitorGroup) portalsiteview.getElementByID(s2);
         if (monitorgroup != null) {
           if (s3.length() == 0) {
             obj = monitorgroup;
           } else {
             obj = monitorgroup.getElementByID(s3);
           }
         }
       }
     }
   }
   return ((SiteViewObject) (obj));
 }
Esempio n. 4
0
 public Vector getScalarValues(ScalarProperty scalarproperty, HTTPRequest httprequest, CGI cgi)
     throws SiteViewException {
   if (scalarproperty == pItems) {
     SiteViewGroup siteviewgroup = SiteViewGroup.currentSiteView();
     Array array = CGI.getAllowedGroupIDsForAccount(httprequest);
     Enumeration enumeration = array.elements();
     Vector vector1 = new Vector();
     Vector vector2 = new Vector();
     String s = getFullID();
     while (enumeration.hasMoreElements()) {
       MonitorGroup monitorgroup =
           (MonitorGroup) siteviewgroup.getElement((String) enumeration.nextElement());
       if (monitorgroup != null) {
         Enumeration enumeration2 = monitorgroup.getMonitors();
         while (enumeration2.hasMoreElements()) {
           Monitor monitor = (Monitor) enumeration2.nextElement();
           if (!(monitor instanceof SubGroup)
               && !s.equals(monitor.getFullID())
               && ("SNMPMonitor".equals(monitor.getClassProperty("class"))
                   || (monitor instanceof BandwidthMonitor)
                   || "ScriptMonitor".equals(monitor.getClassProperty("class"))
                   || "NTCounterMonitor".equals(monitor.getClassProperty("class"))
                   || "DatabaseMonitor".equals(monitor.getClassProperty("class")))) // dingbing.xu
           {
             vector2.addElement(monitor.getProperty(pGroupID) + " " + monitor.getProperty(pID));
             vector2.addElement(
                 monitorgroup.getProperty(pName) + ": " + monitor.getProperty(pName));
           }
         }
       }
     }
     for (Enumeration enumeration1 = vector2.elements();
         enumeration1.hasMoreElements();
         vector1.addElement(enumeration1.nextElement())) {}
     return vector1;
   } else if (scalarproperty == pOperation) {
     Vector vector = new Vector();
     vector.addElement("Add");
     vector.addElement("Add");
     vector.addElement("Multiply");
     vector.addElement("Multiply");
     vector.addElement("Subtract12");
     vector.addElement("Subtract 1 from 2");
     vector.addElement("Subtract21");
     vector.addElement("Subtract 2 from 1");
     vector.addElement("Divide12");
     vector.addElement("Divide 1 by 2");
     vector.addElement("Divide21");
     vector.addElement("Divide 2 by 1");
     return vector;
   } else {
     return super.getScalarValues(scalarproperty, httprequest, cgi);
   }
 }
Esempio n. 5
0
 public static String getHealthState() {
   String s = "good";
   String s1 = CheckCreateHealth();
   MonitorGroup monitorgroup = MonitorGroup.loadGroup("__Health__", s1);
   if (monitorgroup != null) {
     String s2 = monitorgroup.getProperty(MonitorGroup.pCategory);
     s = s2;
   } else {
     LogManager.log("Error", "Unable to find Health System.");
   }
   return s;
 }
Esempio n. 6
0
 /**
  * @param portalsiteview
  * @param monitorgroup
  * @param array
  * @param i
  */
 void findSubgroups(PortalSiteView portalsiteview, MonitorGroup monitorgroup, Array array, int i) {
   Enumeration enumeration = monitorgroup.getMonitors();
   while (enumeration.hasMoreElements()) {
     Monitor monitor = (Monitor) enumeration.nextElement();
     if (monitor instanceof SubGroup) {
       String s = monitor.getProperty(SubGroup.pGroup);
       MonitorGroup monitorgroup1 = (MonitorGroup) portalsiteview.getElement(s);
       if (monitorgroup1 != null) {
         array.add(monitorgroup1.getProperty(Monitor.pID));
         monitorgroup1.setProperty("groupLevel", "" + i);
         findSubgroups(portalsiteview, monitorgroup1, array, i + 1);
       }
     }
   }
 }
Esempio n. 7
0
  public Array getSortedGroupIDs(PortalSiteView portalsiteview) {
    Array array = new Array();
    int i = 0;
    Array array1 = portalsiteview.getGroups();
    for (int j = 0; j < array1.size(); j++) {
      MonitorGroup monitorgroup = (MonitorGroup) array1.at(j);
      if (monitorgroup.getProperty(MonitorGroup.pParent).length() == 0) {
        array.add(monitorgroup.getProperty(Monitor.pID));
        monitorgroup.setProperty("groupLevel", "0");
        findSubgroups(portalsiteview, monitorgroup, array, i + 1);
      }
    }

    return array;
  }
Esempio n. 8
0
 /**
  * CAUTION: Decompiled by hand.
  *
  * @param subgroup
  */
 private static void addSubGroup(SubGroup subgroup) {
   if (groupIDsInHealth.contains(subgroup.getProperty("_group"))) {
     return;
   }
   groupIDsInHealth.add(subgroup.getProperty("_group"));
   MonitorGroup monitorgroup = subgroup.lookupGroup();
   Enumeration enumeration = monitorgroup.getElements();
   while (enumeration.hasMoreElements()) {
     SiteViewObject siteviewobject = (SiteViewObject) enumeration.nextElement();
     if (siteviewobject instanceof SubGroup) {
       SubGroup subgroup1 = (SubGroup) siteviewobject;
       addSubGroup(subgroup1);
     }
   }
 }
Esempio n. 9
0
 protected Array getMonitorsToRun() {
   HashMap hashmap = new HashMap();
   Array array = new Array();
   SiteViewGroup siteviewgroup = SiteViewGroup.currentSiteView();
   Enumeration enumeration = getMultipleValues(pItems);
   label0:
   do {
     if (!enumeration.hasMoreElements()) {
       break;
     }
     String s = (String) enumeration.nextElement();
     String as[] = TextUtils.split(s);
     Object obj = null;
     Object obj1 = null;
     if (as.length == 1) {
       MonitorGroup monitorgroup = (MonitorGroup) siteviewgroup.getElement(as[0]);
       if (monitorgroup == null) {
         continue;
       }
       Enumeration enumeration1 = monitorgroup.getMonitors();
       do {
         Monitor monitor;
         do {
           if (!enumeration1.hasMoreElements()) {
             continue label0;
           }
           monitor = (Monitor) enumeration1.nextElement();
         } while (!(monitor instanceof AtomicMonitor));
         addToMonitorList(monitor, array, hashmap);
       } while (true);
     }
     if (as.length > 1) {
       String s1 = as[0] + SiteViewGroup.ID_SEPARATOR + as[1];
       MonitorGroup monitorgroup1 = (MonitorGroup) siteviewgroup.getElement(as[0]);
       if (monitorgroup1 != null) {
         Monitor monitor1 = (Monitor) siteviewgroup.getElement(s1);
         if (monitor1 != null) {
           addToMonitorList(monitor1, array, hashmap);
         }
       }
     }
   } while (true);
   return array;
 }
Esempio n. 10
0
 /** CAUTION: Decompiled by hand. */
 public static void loadHealthGroupList() {
   synchronized (groupIDsInHealth) {
     groupIDsInHealth.clear();
     SiteViewGroup siteviewgroup = SiteViewGroup.currentSiteView();
     MonitorGroup monitorgroup = (MonitorGroup) siteviewgroup.getElementByID("__Health__");
     if (monitorgroup == null) {
       createHealthGroupList("__Health__");
     } else {
       groupIDsInHealth.add(monitorgroup.getProperty(SiteViewObject.pID));
       Enumeration enumeration = monitorgroup.getElements();
       while (enumeration.hasMoreElements()) {
         SiteViewObject siteviewobject = (SiteViewObject) enumeration.nextElement();
         if (siteviewobject instanceof SubGroup) {
           addSubGroup((SubGroup) siteviewobject);
         }
       }
     }
   }
 }