Package org.rhq.core.domain.measurement

Examples of org.rhq.core.domain.measurement.MeasurementDataTrait


    public void getValues(MeasurementReport report, Set<MeasurementScheduleRequest> metrics) throws Exception {
        if (virt.isConnected()) {
            HVInfo hi = virt.getHVInfo();
            for (MeasurementScheduleRequest request : metrics) {
                if (request.getName().equals("cpus")) {
                    report.addData(new MeasurementDataTrait(request, "" + hi.nodeInfo.cpus));
                } else if (request.getName().equals("memory")) {
                    report.addData(new MeasurementDataTrait(request, "" + hi.nodeInfo.memory));
                } else if (request.getName().equals("memoryUsage")) {
                    report.addData(new MeasurementDataNumeric(request, virt.getMemoryPercentage()));
                } else if (request.getName().equals("cpuUsage")) {
                    long checked = System.nanoTime();
                    long cpuNanos = virt.getCPUTime();
View Full Code Here


                EmsAttribute attribute = eBean.getAttribute(attributeName);
                Object valueObject = attribute.refresh();
               
                if (valueObject != null) {
                    if (request.getDataType() == DataType.TRAIT) {
                        report.addData(new MeasurementDataTrait(request, valueObject.toString()));
                  } else { // numeric
                    report.addData(new MeasurementDataNumeric(request, ((Number)valueObject).doubleValue()));
                    }
                }
            } catch (Exception e) {
View Full Code Here

        for (MeasurementScheduleRequest request : requests) {
            try {
                switch (request.getDataType()) {
                    case TRAIT:
                        Object object = ObjectUtil.lookupDeepAttributeProperty(fileSystemInfo, request.getName());
                        report.addData(new MeasurementDataTrait(request, String.valueOf(object)));
                        break;
                    case MEASUREMENT:
                        Double value = ObjectUtil.lookupDeepNumericAttributeProperty(fileSystemInfo, request.getName());
                        report.addData(new MeasurementDataNumeric(request, value));
                        break;
View Full Code Here

            Configuration pluginConfig = getResourceContext().getPluginConfiguration();
            String path = pluginConfig.getSimpleValue(FILENAME_PLUGIN_CONFIG_PROP, null);
            for (MeasurementScheduleRequest request : requests) {
                String metricName = request.getName();
                if (metricName.equals(APPLICATION_PATH_TRAIT)) {
                    MeasurementDataTrait trait = new MeasurementDataTrait(request, path);
                    report.addData(trait);
                } else if (metricName.equals(APPLICATION_EXPLODED_TRAIT)) {
                    boolean exploded = new File(path).isDirectory();
                    MeasurementDataTrait trait = new MeasurementDataTrait(request, (exploded) ? "yes" : "no");
                    report.addData(trait);
                }
            }
        }
    }
View Full Code Here

        for (MeasurementScheduleRequest request : requests) {
            String requestName = request.getName();
            if (requestName.equals(DOMAIN_CONFIG_TRAIT) || requestName.equals(HOST_CONFIG_TRAIT)) {
                collectConfigTrait(report, request);
            } else if (requestName.equals(DOMAIN_HOST_TRAIT)) {
                MeasurementDataTrait data = new MeasurementDataTrait(request, findASDomainHostName());
                report.addData(data);
            } else if (requestName.equals(DOMAIN_NAME_TRAIT)) {
                MeasurementDataTrait data = new MeasurementDataTrait(request, readAttribute("name"));
                report.addData(data);
            } else {
                leftovers.add(request); // handled below
            }
        }
View Full Code Here

        return super.invokeOperation(name, parameters);
    }

    private MeasurementDataTrait getDistroTrait(MeasurementScheduleRequest metricRequest) {
        MeasurementDataTrait trait = new MeasurementDataTrait(metricRequest, "?");
        if (metricRequest.getName().equals(TRAIT_DISTRO_NAME)) {
            trait.setValue(LinuxDistroInfo.getInstance().getName());
        } else if (metricRequest.getName().equals(TRAIT_DISTRO_VERSION)) {
            trait.setValue(LinuxDistroInfo.getInstance().getVersion());
        } else {
            log.error("Being asked to collect an unknown Linux distro trait: " + metricRequest.getName());
        }

        return trait;
View Full Code Here

        return String.valueOf(dValue);
      } else if (dataType == DataType.TRAIT) {
        assert report.getTraitData().isEmpty()
            || report.getTraitData().size() == 1;

        MeasurementDataTrait dataTrait = (report.getTraitData().size() == 1) ? report
            .getTraitData().iterator().next()
            : null;
        String value = (dataTrait != null) ? dataTrait.getValue()
            : null;
        return value;
      }
    }
    return null;
View Full Code Here

              .doubleValue() * Double.parseDouble(load)));
        } else if (name.equals("conversational")) {
          Boolean value = (Boolean) prop.get("blacktie."
              + serviceName + ".conversational");
          if (value) {
            report.addData(new MeasurementDataTrait(request, "true"));
          } else {
            report.addData(new MeasurementDataTrait(request,
                "false"));
          }
        }
      } catch (Exception e) {
        log.error("Failed to obtain measurement [" + name
View Full Code Here

               report.addData(res);
            }
         } else if (type == DataType.TRAIT) {
            String value = (String) bean.getAttribute(req.getName()).getValue();
            if (trace) log.trace("Metric ("+req.getName()+") is trait with value "+ value);
            MeasurementDataTrait res = new MeasurementDataTrait(req, value);
            report.addData(res);
         }
      }
   }
View Full Code Here

                        if (log.isDebugEnabled()) log.debug("Metric ("+req.getName()+") has null value, do not add to report");
                     }
                  } else if (type == DataType.TRAIT) {
                     String value = (String) o;
                     if (trace) log.trace("Metric ("+req.getName()+") is trait with value " + value);
                     MeasurementDataTrait res = new MeasurementDataTrait(req, value);
                     report.addData(res);
                  }
               } else {
                  if(log.isWarnEnabled()) {
                     log.warn("Attribute "+attName+" not found");
View Full Code Here

TOP

Related Classes of org.rhq.core.domain.measurement.MeasurementDataTrait

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.