Examples of AvailabilityReport


Examples of org.rhq.core.domain.discovery.AvailabilityReport

            AgentClient client = agentManager.getAgentClient(agent);
            if (client == null) {
                throw new IllegalStateException("No agent is associated with the resource with id [" + resourceId + "]");
            }

            AvailabilityReport report = null;

            // first, quickly see if we can even ping the agent, if not, don't bother trying to get the resource avail
            boolean agentPing = client.pingService(5000L);
            if (agentPing) {
                // we can't serialize the resource due to the hibernate proxies (agent can't deserialize hibernate objs)
                // but we know we only need the basics for the agent to collect availability, so create a bare resource object
                Resource bareResource = new Resource(res.getResourceKey(), res.getName(), res.getResourceType());
                bareResource.setId(res.getId());
                bareResource.setUuid(res.getUuid());
                // root the avail check at the desired resource. Ask for a full report to guarantee that we
                // get back the agent-side avail for the resource and keep the server in sync.  This also means we'll
                // get the descendants as well.
                report = client.getDiscoveryAgentService().getCurrentAvailability(bareResource, false);
            }

            if (report != null) {
                // although the data came from the agent this should be processed like a server-side report
                // because it was requested and initiated by the server (bz 1094540).  The availabilities will
                // still be merged but certain backfill logic will remain unscathed.
                report.setServerSideReport(true);

                AvailabilityType foundAvail = report.forResource(res.getId());
                if (foundAvail != null) {
                    availabilityManager.mergeAvailabilityReport(report);
                } else {
                    foundAvail = res.getCurrentAvailability() == null ? AvailabilityType.UNKNOWN : res
                        .getCurrentAvailability().getAvailabilityType();
View Full Code Here

Examples of org.rhq.core.domain.discovery.AvailabilityReport

            List<Integer> familyResourceIds = getFamily(resource);
            disableResourceIds.addAll(familyResourceIds);

            // add the family resource id's to the appropriate avail report
            Agent agent = resource.getAgent();
            AvailabilityReport report = reports.get(agent);
            if (null == report) {
                report = new AvailabilityReport(agent.getName());
                report.setEnablementReport(true);
                reports.put(agent, report);
            }

            for (Integer familyResourceId : familyResourceIds) {
                report.addAvailability(new AvailabilityReport.Datum(familyResourceId, AvailabilityType.DISABLED, now));
            }
        }

        return reports;
    }
View Full Code Here

Examples of org.rhq.core.domain.discovery.AvailabilityReport

            List<Integer> familyResourceIds = getFamily(resource);
            enableResourceIds.addAll(familyResourceIds);

            // add the family resource id's to the appropriate avail report
            Agent agent = resource.getAgent();
            AvailabilityReport report = reports.get(agent);
            if (null == report) {
                report = new AvailabilityReport(agent.getName());
                report.setEnablementReport(true);
                reports.put(agent, report);
            }

            for (Integer familyResourceId : familyResourceIds) {
                report.addAvailability(new AvailabilityReport.Datum(familyResourceId, AvailabilityType.UNKNOWN, now));
            }
        }

        return reports;
    }
View Full Code Here

Examples of org.rhq.core.domain.discovery.AvailabilityReport

            return;
        }

        // process the inventory
        InventoryManager inventoryManager = pc.getInventoryManager();
        AvailabilityReport report = inventoryManager.executeAvailabilityScanImmediately(changedOnly, force);

        if (report == null) {
            out.println(MSG.getMsg(AgentI18NResourceKeys.AVAILABILITY_NO_COMMITTED_INVENTORY));
            return;
        }

        // get the availability data containing the light-weight attached resource
        List<AvailabilityReport.Datum> availabilities = report.getResourceAvailability();

        out.println(MSG.getMsg(AgentI18NResourceKeys.AVAILABILITY_REPORT_HEADER, new Date(), availabilities.size(),
            report.isChangesOnlyReport()));

        // Now that we printed out the report summary, return if there is nothing to send
        if (availabilities.isEmpty()) {
            return;
        }
View Full Code Here

Examples of org.rhq.core.domain.discovery.AvailabilityReport

                availExec.sendChangesOnlyReportNextTime();
            } else {
                availExec.sendFullReportNextTime();
            }

            AvailabilityReport availabilityReport = availabilityThreadPoolExecutor.submit(
                (Callable<AvailabilityReport>) availExec).get();

            // make sure the server is notified of any changes in availability
            handleReport(availabilityReport);
View Full Code Here

Examples of org.rhq.core.domain.discovery.AvailabilityReport

        try {
            //make sure we have the full version of the resource
            ResourceContainer container = getResourceContainer(resource.getId());
            if (container == null) {
                //don't bother doing anything
                return new AvailabilityReport(changesOnly, getAgent().getName());
            }
            resource = container.getResource();

            AvailabilityExecutor availExec = new CustomScanRootAvailabilityExecutor(this, resource, true);
            if (changesOnly) {
View Full Code Here

Examples of org.rhq.core.domain.discovery.AvailabilityReport

        switch (com) {
        case ADD:
            manualAdd(tokens);
            break;
        case ASCAN:
            AvailabilityReport aReport = pc.getDiscoveryAgentService().executeAvailabilityScanImmediately(false);

            System.out.println(aReport);
            break;
        case AVAIL:
            avail(tokens);
View Full Code Here

Examples of org.rhq.core.domain.discovery.AvailabilityReport

        int id = getResourceIdFromTokens(tokens, 0);

        for (Resource res : resources) {
            if (id == 0 || (res.getId() == id)) {
                AvailabilityReport availabilityReport = inventoryManager.getCurrentAvailability(res, false);
                for(AvailabilityReport.Datum datum : availabilityReport.getResourceAvailability()) {
                    if (datum.getResourceId() == res.getId()) {
                        System.out.println(res.getName() + "( " + res.getId() + " ):" + datum.getAvailabilityType());
                        break;
                    }
                }
View Full Code Here

Examples of org.rhq.core.domain.discovery.AvailabilityReport

    }

    public void run() {
        try {
            synchronized (lock) {
                AvailabilityReport report = call();
                inventoryManager.handleReport(report);
            }
        } catch (Exception e) {
            LOG.warn("Availability report collection failed", e);
        }
View Full Code Here

Examples of org.rhq.core.domain.discovery.AvailabilityReport

     *
     * @throws Exception if failed to create and prepare the report
     */
    @Nullable
    public AvailabilityReport call() throws Exception {
        AvailabilityReport availabilityReport;

        synchronized (lock) {
            if (inventoryManager.getPlatform().getInventoryStatus() != InventoryStatus.COMMITTED) {
                return null;
            }

            boolean changesOnly = sendChangesOnlyReport.get();
            availabilityReport = new AvailabilityReport(changesOnly, inventoryManager.getAgent().getName());

            // Follow up full reports with changesOnly reports
            if (!changesOnly) {
                sendChangesOnlyReportNextTime();
            }
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.