示例#1
0
 protected void addToMonitorList(Monitor monitor, Array array, HashMap hashmap) {
   if (monitor == this) {
     return;
   }
   String s = monitor.getProperty(pGroupID) + " " + monitor.getProperty(pID);
   if (hashmap.get(s) == null) {
     hashmap.put(s, monitor);
     array.add(monitor);
   }
 }
示例#2
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);
   }
 }
示例#3
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);
 }