Examples of AlertConditionCacheStats


Examples of org.rhq.enterprise.server.alert.engine.AlertConditionCacheStats

        }
    }

    public AlertConditionCacheStats checkConditions(MeasurementData... measurementData) {
        if ((measurementData == null) || (measurementData.length == 0)) {
            return new AlertConditionCacheStats();
        }

        AlertConditionCacheStats stats = new AlertConditionCacheStats();
        try {
            for (MeasurementData datum : measurementData) {
                int scheduleId = datum.getScheduleId();

                if (datum instanceof MeasurementDataNumeric) {
                    List<? extends NumericDoubleCacheElement> conditionCacheElements = lookupMeasurementDataCacheElements(scheduleId);

                    Double providedValue = ((MeasurementDataNumeric) datum).getValue();

                    processCacheElements(conditionCacheElements, providedValue, datum.getTimestamp(), stats);
                } else if (datum instanceof MeasurementDataTrait) {
                    List<MeasurementTraitCacheElement> cacheElements = lookupMeasurementTraitCacheElements(scheduleId);

                    processCacheElements(cacheElements, ((MeasurementDataTrait) datum).getValue(),
                        datum.getTimestamp(), stats);
                } else {
                    log.error(getClass().getSimpleName() + " does not support " + "checking conditions against "
                        + datum.getClass().getSimpleName() + " types");
                }
            }

            AlertConditionCacheMonitor.getMBean().incrementMeasurementCacheElementMatches(stats.matched);
            AlertConditionCacheMonitor.getMBean().incrementMeasurementProcessingTime(stats.getAge());
            if (log.isDebugEnabled())
                log.debug("Check Measurements[size=" + measurementData.length + "] - " + stats);
        } catch (Throwable t) {
            // don't let any exceptions bubble up to the calling SLSB layer
            log.error("Error during measurement data cache processing for agent[id=" + agentId + "]", t);
View Full Code Here

Examples of org.rhq.enterprise.server.alert.engine.AlertConditionCacheStats

        return stats;
    }

    public AlertConditionCacheStats checkConditions(CallTimeData... callTime) {
        if ((callTime == null) || (callTime.length == 0)) {
            return new AlertConditionCacheStats();
        }

        AlertConditionCacheStats stats = new AlertConditionCacheStats();
        try {
            HashMap<Integer, HashMap<String, ArrayList<CallTimeDataValue>>> order = produceOrderedCallTimeDataStructure(callTime);
            for (Integer scheduleId : order.keySet()) {
                List<? extends CallTimeDataCacheElement> conditionCacheElements = lookupCallTimeDataCacheElements(scheduleId);
                for (String callDest : order.get(scheduleId).keySet()) {
                    for (CallTimeDataValue provided : order.get(scheduleId).get(callDest)) {
                        processCacheElements(conditionCacheElements, provided, provided.getBeginTime(), stats, callDest);
                    }
                }
            }
            AlertConditionCacheMonitor.getMBean().incrementCallTimeCacheElementMatches(stats.matched);
            AlertConditionCacheMonitor.getMBean().incrementCallTimeProcessingTime(stats.getAge());
        } catch (Throwable t) {
            // don't let any exceptions bubble up to the calling SLSB layer
            log.error("Error during calltime cache processing for agent[id=" + agentId + "]", t);
        }
View Full Code Here

Examples of org.rhq.enterprise.server.alert.engine.AlertConditionCacheStats

     * @param source
     * @param events
     * @return the number of eventsProcessed until a match was found or all events were processed.
     */
    public AlertConditionCacheStats checkConditions(EventSource source, List<Event> events) {
        AlertConditionCacheStats stats = new AlertConditionCacheStats();
        if ((events == null) || events.isEmpty()) {
            return stats;
        }

        int initialSize = events.size();
        try {
            Resource resource = source.getResource();
            List<EventCacheElement> cacheElements = lookupEventCacheElements(resource.getId());

            for (Iterator<Event> i = events.iterator(); i.hasNext();) {
                Event event = i.next();
                i.remove();
                int matched = stats.matched;
                processCacheElements(cacheElements, event.getSeverity(), event.getTimestamp(), stats,
                    "sourceLocation=" + source.getLocation(), event.getDetail());
                if (matched < stats.matched) {
                    break;
                }
            }

            AlertConditionCacheMonitor.getMBean().incrementEventCacheElementMatches(stats.matched);
            AlertConditionCacheMonitor.getMBean().incrementEventProcessingTime(stats.getAge());
            if (log.isDebugEnabled()) {
                log.debug("Check Events[size=" + (initialSize - events.size()) + "] - " + stats);
            }
        } catch (Throwable t) {
            // don't let any exceptions bubble up to the calling SLSB layer
View Full Code Here

Examples of org.rhq.enterprise.server.alert.engine.AlertConditionCacheStats

        }
        return stats;
    }

    public AlertConditionCacheStats checkConditions(DriftChangeSetSummary driftChangeSetSummary) {
        AlertConditionCacheStats stats = new AlertConditionCacheStats();
        try {
            int resourceId = driftChangeSetSummary.getResourceId();
            List<DriftCacheElement> cacheElements = lookupDriftCacheElements(resourceId);

            processCacheElements(cacheElements, DriftCacheElement.UNUSED_CONDITION_VALUE,
                driftChangeSetSummary.getCreatedTime(), stats, driftChangeSetSummary);

            AlertConditionCacheMonitor.getMBean().incrementDriftCacheElementMatches(stats.matched);
            AlertConditionCacheMonitor.getMBean().incrementDriftProcessingTime(stats.getAge());
            if (log.isDebugEnabled()) {
                log.debug("Check Drift[resourceId=" + resourceId + "] - " + stats);
            }
        } catch (Throwable t) {
            // don't let any exceptions bubble up to the calling SLSB layer
View Full Code Here

Examples of org.rhq.enterprise.server.alert.engine.AlertConditionCacheStats

        }
    }

    public AlertConditionCacheStats checkConditions(MeasurementData... measurementData) {
        if (measurementData == null || measurementData.length == 0) {
            return new AlertConditionCacheStats();
        }

        MeasurementData datum = measurementData[0];
        Integer agentId = getAgentId(datum);
        if (agentId == null) {
            log.error("Could not find agent for scheduleId = " + datum.getScheduleId());
            return new AlertConditionCacheStats();
        }

        AlertConditionCacheStats stats = null;
        AgentConditionCache agentCache = null;
        agentReadWriteLock.readLock().lock();
        try {
            agentCache = agentCaches.get(agentId);
        } catch (Throwable t) {
            log.error("Error during checkConditions", t); // don't let any exceptions bubble up to the calling SLSB layer
        } finally {
            agentReadWriteLock.readLock().unlock();
        }
        if (agentCache != null) {
            stats = agentCache.checkConditions(measurementData);
        } else {
            stats = new AlertConditionCacheStats();
        }

        return stats;
    }
View Full Code Here

Examples of org.rhq.enterprise.server.alert.engine.AlertConditionCacheStats

        return stats;
    }

    public AlertConditionCacheStats checkConditions(CallTimeData... callTimeData) {
        if (callTimeData == null || callTimeData.length == 0) {
            return new AlertConditionCacheStats();
        }

        CallTimeData datum = callTimeData[0];
        Integer agentId = getAgentId(datum);
        if (agentId == null) {
            log.error("Could not find agent for scheduleId = " + datum.getScheduleId());
            return new AlertConditionCacheStats();
        }

        AlertConditionCacheStats stats = null;
        AgentConditionCache agentCache = null;
        agentReadWriteLock.readLock().lock();
        try {
            agentCache = agentCaches.get(agentId);
        } catch (Throwable t) {
            log.error("Error during checkConditions", t); // don't let any exceptions bubble up to the calling SLSB layer
        } finally {
            agentReadWriteLock.readLock().unlock();
        }
        if (agentCache != null) {
            stats = agentCache.checkConditions(callTimeData);
        } else {
            stats = new AlertConditionCacheStats();
        }

        return stats;
    }
View Full Code Here

Examples of org.rhq.enterprise.server.alert.engine.AlertConditionCacheStats

        return stats;
    }

    public AlertConditionCacheStats checkConditions(OperationHistory operationHistory) {
        AlertConditionCacheStats stats = null;
        try {
            stats = globalCache.checkConditions(operationHistory);
        } catch (Throwable t) {
            log.error("Error during checkConditions", t); // don't let any exceptions bubble up to the calling SLSB layer
        }
        if (stats == null) {
            stats = new AlertConditionCacheStats();
        }
        return stats;
    }
View Full Code Here

Examples of org.rhq.enterprise.server.alert.engine.AlertConditionCacheStats

        }
        return stats;
    }

    public AlertConditionCacheStats checkConditions(ResourceConfigurationUpdate update) {
        AlertConditionCacheStats stats = null;
        try {
            stats = globalCache.checkConditions(update);
        } catch (Throwable t) {
            log.error("Error during checkConditions", t); // don't let any exceptions bubble up to the calling SLSB layer
        }
        if (stats == null) {
            stats = new AlertConditionCacheStats();
        }
        return stats;
    }
View Full Code Here

Examples of org.rhq.enterprise.server.alert.engine.AlertConditionCacheStats

        return stats;
    }

    public AlertConditionCacheStats checkConditions(EventSource source, Event... events) {
        if (source == null) {
            return new AlertConditionCacheStats();
        }

        Integer agentId = getAgentId(source);
        if (agentId == null) {
            log.error("Could not find agent for resourceId = " + source.getResource().getId());
            return new AlertConditionCacheStats();
        }

        AlertConditionCacheStats stats = new AlertConditionCacheStats();
        List<Event> unprocessedEvents = new ArrayList(Arrays.asList(events)); // need a List that supports iterator remove
        while (!unprocessedEvents.isEmpty()) {
            AgentConditionCache agentCache = null;
            agentReadWriteLock.readLock().lock();
            try {
                agentCache = agentCaches.get(agentId);
            } catch (Throwable t) {
                log.error("Error during checkConditions", t); // don't let any exceptions bubble up to the calling SLSB layer
            } finally {
                agentReadWriteLock.readLock().unlock();
            }
            if (agentCache != null) {
                stats.add(agentCache.checkConditions(source, unprocessedEvents));
                if (!unprocessedEvents.isEmpty()) {
                    // delay for a brief time to allow for the matched conditions to potentially fire an alert and
                    // activate recovery alerts, in case the remaining events match the pending recovery conditions
                    try {
                        Thread.sleep(ALERTED_EVENT_PROCESSING_DELAY);
View Full Code Here

Examples of org.rhq.enterprise.server.alert.engine.AlertConditionCacheStats

        return stats;
    }

    public AlertConditionCacheStats checkConditions(DriftChangeSetSummary driftChangeSetSummary) {
        if (driftChangeSetSummary == null) {
            return new AlertConditionCacheStats();
        }

        Integer agentId = getAgentId(driftChangeSetSummary);
        if (agentId == null) {
            log.error("Could not find agent for resourceId = " + driftChangeSetSummary.getResourceId());
            return new AlertConditionCacheStats();
        }

        AlertConditionCacheStats stats = null;
        AgentConditionCache agentCache = null;
        agentReadWriteLock.readLock().lock();
        try {
            agentCache = agentCaches.get(agentId);
        } catch (Throwable t) {
            log.error("Error during checkConditions", t); // don't let any exceptions bubble up to the calling SLSB layer
        } finally {
            agentReadWriteLock.readLock().unlock();
        }
        if (agentCache != null) {
            stats = agentCache.checkConditions(driftChangeSetSummary);
        } else {
            stats = new AlertConditionCacheStats();
        }
        return stats;
    }
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.