Examples of MeasurementScheduleRequest


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

                        scheduleRequest = new ResourceMeasurementScheduleRequest(resourceId);
                        scheduleRequestMap.put(resourceId, scheduleRequest);
                        allSchedules.add(scheduleRequest);
                    }

                    MeasurementScheduleRequest requestData = new MeasurementScheduleRequest(scheduleId, definitionName,
                        interval, enabled, dataType, rawNumericType);
                    scheduleRequest.addMeasurementScheduleRequest(requestData);
                }
            } finally {
                results.close();
View Full Code Here

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

        query.setParameter("resourceIds", Arrays.asList(resourceId));
        List<MeasurementSchedule> schedules = query.getResultList();

        Set<MeasurementScheduleRequest> requests = new HashSet<MeasurementScheduleRequest>(schedules.size());
        for (MeasurementSchedule schedule : schedules) {
            requests.add(new MeasurementScheduleRequest(schedule));
        }

        Set<MeasurementData> result = null;
        try {
            AgentClient ac = agentClientManager.getAgentClient(agent);
View Full Code Here

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

                List<MeasurementSchedule> schedules = query.getResultList();

                Map<Integer, Integer> scheduleIdToResourceIdMap = new HashMap<Integer, Integer>(schedules.size());
                Set<MeasurementScheduleRequest> requests = new HashSet<MeasurementScheduleRequest>(schedules.size());
                for (MeasurementSchedule schedule : schedules) {
                    requests.add(new MeasurementScheduleRequest(schedule));
                    scheduleIdToResourceIdMap.put(schedule.getId(), resourceIdWithAgent.getResourceId());
                }

                AgentClient ac = agentClientManager.getAgentClient(resourceIdWithAgent.getAgent());
                Set<MeasurementData> newValues = ac.getMeasurementAgentService().getRealTimeMeasurementValue(
View Full Code Here

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

            if (null == availabilitySchedule) {
                switch (this.resource.getResourceType().getCategory()) {
                case PLATFORM:
                    break;
                case SERVER:
                    availabilitySchedule = new MeasurementScheduleRequest(-1, MeasurementDefinition.AVAILABILITY_NAME,
                        MeasurementDefinition.AVAILABILITY_DEFAULT_PERIOD_SERVER, true, DataType.AVAILABILITY);
                    break;
                case SERVICE:
                    availabilitySchedule = new MeasurementScheduleRequest(-1, MeasurementDefinition.AVAILABILITY_NAME,
                        MeasurementDefinition.AVAILABILITY_DEFAULT_PERIOD_SERVICE, true, DataType.AVAILABILITY);
                    break;
                }
            }
        }
View Full Code Here

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

        String traitValue = getCachedTraitValue(traitScheduleId);
        if (traitValue == null) {
            // the trait hasn't been collected yet, so it isn't cached. We need to get its live value
            Set<MeasurementScheduleRequest> requests = new HashSet<MeasurementScheduleRequest>();
            requests.add(new MeasurementScheduleRequest(MeasurementScheduleRequest.NO_SCHEDULE_ID, traitName, 0, true,
                DataType.TRAIT));
            Set<MeasurementData> dataset = getRealTimeMeasurementValue(container.getResource().getId(), requests);
            if (dataset.size() == 1) {
                Object value = dataset.iterator().next().getValue();
                if (value != null) {
View Full Code Here

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

        String[] metricNames = new String[tokens.length - 2];
        System.arraycopy(tokens, 2, metricNames, 0, tokens.length - 2);

        Set<MeasurementScheduleRequest> requests = new HashSet<MeasurementScheduleRequest>();
        for (String metric : metricNames) {
            requests.add(new MeasurementScheduleRequest(MeasurementScheduleRequest.NO_SCHEDULE_ID, metric, 0, true,
                dataType));
        }

        Set<MeasurementData> dataset = mm.getRealTimeMeasurementValue(resourceId, requests);
        if (dataset == null) {
View Full Code Here

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

        // See if this resource is scheduled for an avail check
        boolean checkAvail = false;
        boolean deferToParent = false;
        long availabilityScheduleTime = resourceContainer.getAvailabilityScheduleTime();
        MeasurementScheduleRequest availScheduleRequest = resourceContainer.getAvailabilitySchedule();

        // if no avail check is scheduled or we're forcing the check, schedule the next check. Note that a forcedCheck
        // is "off-schedule" so we need to push out the next check.
        if ((0 == availabilityScheduleTime) || isForced) {
            // if there is no availability schedule (platform) then just perform the avail check
            // (note, platforms always return UP anyway).
            if (null == availScheduleRequest) {
                if (traceEnabled) {
                    LOG.trace("No availScheduleRequest for " + resource + ". checkAvail set to true");
                }
                checkAvail = true;

            } else {
                // if the schedule is enabled then schedule the next avail check, else just defer to the parent type
                if (availScheduleRequest.isEnabled()) {
                    // Schedule the avail check at some time between now and (now + collectionInterval). By
                    // doing this random assignment for the first scheduled collection, we'll spread out the actual
                    // check times going forward. Do not check it on this pass (unless we're forced)
                    int interval = (int) availScheduleRequest.getInterval(); // intervals are short enough for safe cast
                    availabilityScheduleTime = scan.startTime + RANDOM.nextInt(interval + 1);
                    resourceContainer.setAvailabilityScheduleTime(availabilityScheduleTime);

                    if (traceEnabled) {
                        LOG.trace("Forced availabilityScheduleTime to " + new Date(availabilityScheduleTime) + " for "
                            + resource);
                    }
                    ++scan.numScheduledRandomly;

                } else {
                    if (traceEnabled) {
                        LOG.trace("Deferred availability to parent for " + resource);
                    }
                    deferToParent = true;
                }
            }
        } else {
            // check avail if this resource scheduled time has been reached
            checkAvail = scan.startTime >= availabilityScheduleTime;

            if (checkAvail) {
                if (traceEnabled) {
                    LOG.trace("Scheduled time has been reached for " + resource);
                }
                long interval = availScheduleRequest.getInterval(); // intervals are short enough for safe cast
                resourceContainer.setAvailabilityScheduleTime(scan.startTime + interval);
                ++scan.numPushedByInterval;
            } else {
                if (traceEnabled) {
                    LOG.trace("Scheduled time has not been reached for " + resource);
View Full Code Here

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

            MeasurementDefinition definition = new MeasurementDefinition(serverTypeMT, BUNDLE_CONFIG_CONTEXT_VALUE_MT);
            definition.setDataType(DataType.TRAIT);
            definition.setId(123);
            MeasurementSchedule schedule = new MeasurementSchedule(definition, serverMT);
            schedule.setId(123123);
            MeasurementScheduleRequest scheduleRequest = new MeasurementScheduleRequest(schedule);
            Set<MeasurementScheduleRequest> schedules = new HashSet<MeasurementScheduleRequest>(1);
            schedules.add(scheduleRequest);
            serverContainerMT.setMeasurementSchedule(schedules);
        }
View Full Code Here

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

     */
    @Override
    public void getValues(MeasurementReport report, Set<MeasurementScheduleRequest> metrics) throws Exception {
        try {
            for (Iterator<MeasurementScheduleRequest> i = metrics.iterator(); i.hasNext();) {
                MeasurementScheduleRequest metric = i.next();
                report.addData(new MeasurementDataNumeric(metric, new Double(1.0)));
                System.out.println("===============PRE REMOVE");
                i.remove(); // this should not be allowed
                System.out.println("===============POST REMOVE");
            }
View Full Code Here

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

        ArrayList<CollectedMetric> thisCollection = new ArrayList<CollectedMetric>();

        long now = System.currentTimeMillis() - initialCollectionTime;
        for (Iterator<MeasurementScheduleRequest> i = metrics.iterator(); i.hasNext();) {
            MeasurementScheduleRequest metric = i.next();
            log("collecting metric " + (metric.getName() + " (interval=" + metric.getInterval() + ")"));
            report.addData(new MeasurementDataNumeric(metric, new Double(1.0)));

            // remember what time we were called and which metric was asked to be collected
            CollectedMetric collectedMetric = new CollectedMetric();
            collectedMetric.collectedTime = now;
            collectedMetric.metricName = metric.getName();
            collectedMetrics.add(collectedMetric);
            thisCollection.add(collectedMetric);
        }

        // delay the initial collection a long time to push back collection of future metrics - we must ignore all interrupts!
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.