Search in sources :

Example 41 with CompositeResultData

use of org.apache.geode.management.internal.cli.result.CompositeResultData in project geode by apache.

the class MiscellaneousCommands method getSystemWideMetrics.

/**
   * Gets the system wide metrics
   *
   * @return ResultData with required System wide statistics or ErrorResultData if DS MBean is not
   *         found to gather metrics
   */
private ResultData getSystemWideMetrics(String export_to_report_to, String[] categoriesArr) throws Exception {
    final InternalCache cache = getCache();
    final ManagementService managmentService = ManagementService.getManagementService(cache);
    DistributedSystemMXBean dsMxBean = managmentService.getDistributedSystemMXBean();
    StringBuilder csvBuilder = null;
    if (dsMxBean != null) {
        if (export_to_report_to != null && !export_to_report_to.isEmpty()) {
            csvBuilder = new StringBuilder();
            csvBuilder.append("Category");
            csvBuilder.append(',');
            csvBuilder.append(CliStrings.SHOW_METRICS__METRIC__HEADER);
            csvBuilder.append(',');
            csvBuilder.append(CliStrings.SHOW_METRICS__VALUE__HEADER);
            csvBuilder.append('\n');
        }
        CompositeResultData crd = ResultBuilder.createCompositeResultData();
        SectionResultData section = crd.addSection();
        TabularResultData metricsTable = section.addTable();
        Map<String, Boolean> categoriesMap = getSystemMetricsCategories();
        if (categoriesArr != null && categoriesArr.length != 0) {
            Set<String> categories = createSet(categoriesArr);
            Set<String> checkSet = new HashSet<String>(categoriesMap.keySet());
            Set<String> userCategories = getSetDifference(categories, checkSet);
            if (userCategories.isEmpty()) {
                for (String category : checkSet) {
                    categoriesMap.put(category, false);
                }
                for (String category : categories) {
                    categoriesMap.put(category.toLowerCase(), true);
                }
            } else {
                StringBuilder sb = new StringBuilder();
                sb.append("Invalid Categories\n");
                for (String category : userCategories) {
                    sb.append(category);
                    sb.append('\n');
                }
                return ResultBuilder.createErrorResultData().addLine(sb.toString());
            }
        }
        metricsTable.setHeader("Cluster-wide Metrics");
        if (categoriesMap.get("cluster").booleanValue()) {
            writeToTableAndCsv(metricsTable, "cluster", "totalHeapSize", dsMxBean.getTotalHeapSize(), csvBuilder);
        }
        if (categoriesMap.get("cache").booleanValue()) {
            writeToTableAndCsv(metricsTable, "cache", "totalRegionEntryCount", dsMxBean.getTotalRegionEntryCount(), csvBuilder);
            writeToTableAndCsv(metricsTable, "", "totalRegionCount", dsMxBean.getTotalRegionCount(), csvBuilder);
            writeToTableAndCsv(metricsTable, "", "totalMissCount", dsMxBean.getTotalMissCount(), csvBuilder);
            writeToTableAndCsv(metricsTable, "", "totalHitCount", dsMxBean.getTotalHitCount(), csvBuilder);
        }
        if (categoriesMap.get("diskstore").booleanValue()) {
            writeToTableAndCsv(metricsTable, "diskstore", "totalDiskUsage", dsMxBean.getTotalDiskUsage(), // deadcoded to workaround bug 46397
            csvBuilder);
            writeToTableAndCsv(metricsTable, "", /* 46608 */
            "diskReadsRate", dsMxBean.getDiskReadsRate(), csvBuilder);
            writeToTableAndCsv(metricsTable, "", "diskWritesRate", dsMxBean.getDiskWritesRate(), csvBuilder);
            writeToTableAndCsv(metricsTable, "", "flushTimeAvgLatency", dsMxBean.getDiskFlushAvgLatency(), csvBuilder);
            writeToTableAndCsv(metricsTable, "", "totalBackupInProgress", dsMxBean.getTotalBackupInProgress(), csvBuilder);
        }
        if (categoriesMap.get("query").booleanValue()) {
            writeToTableAndCsv(metricsTable, "query", "activeCQCount", dsMxBean.getActiveCQCount(), csvBuilder);
            writeToTableAndCsv(metricsTable, "", "queryRequestRate", dsMxBean.getQueryRequestRate(), csvBuilder);
        }
        if (export_to_report_to != null && !export_to_report_to.isEmpty()) {
            crd.addAsFile(export_to_report_to, csvBuilder.toString(), "Cluster wide metrics exported to {0}.", false);
        }
        return crd;
    } else {
        String errorMessage = CliStrings.format(CliStrings.SHOW_METRICS__ERROR, "Distributed System MBean not found");
        return ResultBuilder.createErrorResultData().addLine(errorMessage);
    }
}
Also used : DistributedSystemMXBean(org.apache.geode.management.DistributedSystemMXBean) ManagementService(org.apache.geode.management.ManagementService) SystemManagementService(org.apache.geode.management.internal.SystemManagementService) CompositeResultData(org.apache.geode.management.internal.cli.result.CompositeResultData) TabularResultData(org.apache.geode.management.internal.cli.result.TabularResultData) InternalCache(org.apache.geode.internal.cache.InternalCache) SectionResultData(org.apache.geode.management.internal.cli.result.CompositeResultData.SectionResultData) HashSet(java.util.HashSet)

Example 42 with CompositeResultData

use of org.apache.geode.management.internal.cli.result.CompositeResultData in project geode by apache.

the class MiscellaneousCommands method getRegionMetricsFromMember.

/**
   * Gets the metrics of region on a given member
   *
   * @return ResultData with required Region statistics or ErrorResultData if Region MBean is not
   *         found to gather metrics
   * @throws ResultDataException if building result fails
   */
private ResultData getRegionMetricsFromMember(String regionName, DistributedMember distributedMember, String export_to_report_to, String[] categoriesArr) throws ResultDataException {
    final InternalCache cache = getCache();
    final SystemManagementService managementService = (SystemManagementService) ManagementService.getManagementService(cache);
    ObjectName regionMBeanName = managementService.getRegionMBeanName(distributedMember, regionName);
    RegionMXBean regionMxBean = managementService.getMBeanInstance(regionMBeanName, RegionMXBean.class);
    if (regionMxBean != null) {
        CompositeResultData crd = ResultBuilder.createCompositeResultData();
        SectionResultData section = crd.addSection();
        TabularResultData metricsTable = section.addTable();
        metricsTable.setHeader("Metrics for region:" + regionName + " On Member " + MBeanJMXAdapter.getMemberNameOrId(distributedMember));
        StringBuilder csvBuilder = null;
        if (export_to_report_to != null && !export_to_report_to.isEmpty()) {
            csvBuilder = new StringBuilder();
            csvBuilder.append("Category");
            csvBuilder.append(',');
            csvBuilder.append(CliStrings.SHOW_METRICS__METRIC__HEADER);
            csvBuilder.append(',');
            csvBuilder.append(CliStrings.SHOW_METRICS__VALUE__HEADER);
            csvBuilder.append('\n');
        }
        /*
       * Region Metrics
       */
        Map<String, Boolean> categoriesMap = getRegionMetricsCategories();
        if (categoriesArr != null && categoriesArr.length != 0) {
            Set<String> categories = createSet(categoriesArr);
            Set<String> checkSet = new HashSet<String>(categoriesMap.keySet());
            Set<String> userCategories = getSetDifference(categories, checkSet);
            // Checking if the categories specified by the user are valid or not
            if (userCategories.isEmpty()) {
                for (String category : checkSet) {
                    categoriesMap.put(category, false);
                }
                for (String category : categories) {
                    categoriesMap.put(category.toLowerCase(), true);
                }
            } else {
                StringBuilder sb = new StringBuilder();
                sb.append("Invalid Categories\n");
                for (String category : userCategories) {
                    sb.append(category);
                    sb.append('\n');
                }
                return ResultBuilder.createErrorResultData().addLine(sb.toString());
            }
        }
        if (categoriesMap.get("region").booleanValue()) {
            writeToTableAndCsv(metricsTable, "region", "lastModifiedTime", regionMxBean.getLastModifiedTime(), csvBuilder);
            writeToTableAndCsv(metricsTable, "", "lastAccessedTime", regionMxBean.getLastAccessedTime(), csvBuilder);
            writeToTableAndCsv(metricsTable, "", "missCount", regionMxBean.getMissCount(), csvBuilder);
            writeToTableAndCsv(metricsTable, "", "hitCount", regionMxBean.getHitCount(), csvBuilder);
            writeToTableAndCsv(metricsTable, "", "hitRatio", regionMxBean.getHitRatio(), csvBuilder);
            writeToTableAndCsv(metricsTable, "", "getsRate", regionMxBean.getGetsRate(), csvBuilder);
            writeToTableAndCsv(metricsTable, "", "putsRate", regionMxBean.getPutsRate(), csvBuilder);
            writeToTableAndCsv(metricsTable, "", "createsRate", regionMxBean.getCreatesRate(), csvBuilder);
            writeToTableAndCsv(metricsTable, "", "destroyRate", regionMxBean.getDestroyRate(), csvBuilder);
            writeToTableAndCsv(metricsTable, "", "putAllRate", regionMxBean.getPutAllRate(), csvBuilder);
        }
        if (categoriesMap.get("partition").booleanValue()) {
            writeToTableAndCsv(metricsTable, "partition", "putLocalRate", regionMxBean.getPutLocalRate(), csvBuilder);
            writeToTableAndCsv(metricsTable, "", "putRemoteRate", regionMxBean.getPutRemoteRate(), csvBuilder);
            writeToTableAndCsv(metricsTable, "", "putRemoteLatency", regionMxBean.getPutRemoteLatency(), csvBuilder);
            writeToTableAndCsv(metricsTable, "", "putRemoteAvgLatency", regionMxBean.getPutRemoteAvgLatency(), csvBuilder);
            writeToTableAndCsv(metricsTable, "", "bucketCount", regionMxBean.getBucketCount(), csvBuilder);
            writeToTableAndCsv(metricsTable, "", "primaryBucketCount", regionMxBean.getPrimaryBucketCount(), csvBuilder);
            writeToTableAndCsv(metricsTable, "", "configuredRedundancy", regionMxBean.getConfiguredRedundancy(), csvBuilder);
            writeToTableAndCsv(metricsTable, "", "actualRedundancy", regionMxBean.getActualRedundancy(), csvBuilder);
            writeToTableAndCsv(metricsTable, "", "numBucketsWithoutRedundancy", regionMxBean.getNumBucketsWithoutRedundancy(), csvBuilder);
            writeToTableAndCsv(metricsTable, "", "totalBucketSize", regionMxBean.getTotalBucketSize(), csvBuilder);
        }
        /*
       * Disk store
       */
        if (categoriesMap.get("diskstore").booleanValue()) {
            writeToTableAndCsv(metricsTable, "diskstore", "totalEntriesOnlyOnDisk", regionMxBean.getTotalEntriesOnlyOnDisk(), csvBuilder);
            writeToTableAndCsv(metricsTable, "", "diskReadsRate", "" + regionMxBean.getDiskReadsRate(), csvBuilder);
            writeToTableAndCsv(metricsTable, "", "diskWritesRate", regionMxBean.getDiskWritesRate(), csvBuilder);
            writeToTableAndCsv(metricsTable, "", "totalDiskWriteInProgress", regionMxBean.getTotalDiskWritesProgress(), csvBuilder);
            writeToTableAndCsv(metricsTable, "", "diskTaskWaiting", regionMxBean.getDiskTaskWaiting(), csvBuilder);
        }
        /*
       * LISTENER
       */
        if (categoriesMap.get("callback").booleanValue()) {
            writeToTableAndCsv(metricsTable, "callback", "cacheWriterCallsAvgLatency", regionMxBean.getCacheWriterCallsAvgLatency(), csvBuilder);
            writeToTableAndCsv(metricsTable, "", "cacheListenerCallsAvgLatency", regionMxBean.getCacheListenerCallsAvgLatency(), csvBuilder);
        }
        /*
       * Eviction
       */
        if (categoriesMap.get("eviction").booleanValue()) {
            writeToTableAndCsv(metricsTable, "eviction", "lruEvictionRate", regionMxBean.getLruEvictionRate(), csvBuilder);
            writeToTableAndCsv(metricsTable, "", "lruDestroyRate", regionMxBean.getLruDestroyRate(), csvBuilder);
        }
        if (export_to_report_to != null && !export_to_report_to.isEmpty()) {
            crd.addAsFile(export_to_report_to, csvBuilder.toString(), "Region Metrics exported to {0}.", false);
        }
        return crd;
    } else {
        ErrorResultData erd = ResultBuilder.createErrorResultData();
        String errorMessage = CliStrings.format(CliStrings.SHOW_METRICS__ERROR, "Region MBean for " + regionName + " on member " + MBeanJMXAdapter.getMemberNameOrId(distributedMember) + " not found");
        erd.addLine(errorMessage);
        return erd;
    }
}
Also used : DistributedRegionMXBean(org.apache.geode.management.DistributedRegionMXBean) RegionMXBean(org.apache.geode.management.RegionMXBean) CompositeResultData(org.apache.geode.management.internal.cli.result.CompositeResultData) TabularResultData(org.apache.geode.management.internal.cli.result.TabularResultData) InternalCache(org.apache.geode.internal.cache.InternalCache) SystemManagementService(org.apache.geode.management.internal.SystemManagementService) ObjectName(javax.management.ObjectName) SectionResultData(org.apache.geode.management.internal.cli.result.CompositeResultData.SectionResultData) ErrorResultData(org.apache.geode.management.internal.cli.result.ErrorResultData) HashSet(java.util.HashSet)

Example 43 with CompositeResultData

use of org.apache.geode.management.internal.cli.result.CompositeResultData in project geode by apache.

the class MiscellaneousCommands method getDistributedRegionMetrics.

/**
   * Gets the Cluster-wide metrics for a region
   *
   * @return ResultData containing the table
   * @throws ResultDataException if building result fails
   */
private ResultData getDistributedRegionMetrics(String regionName, String export_to_report_to, String[] categoriesArr) throws ResultDataException {
    final InternalCache cache = getCache();
    final ManagementService managementService = ManagementService.getManagementService(cache);
    DistributedRegionMXBean regionMxBean = managementService.getDistributedRegionMXBean(regionName);
    if (regionMxBean != null) {
        CompositeResultData crd = ResultBuilder.createCompositeResultData();
        SectionResultData section = crd.addSection();
        TabularResultData metricsTable = section.addTable();
        metricsTable.setHeader("Cluster-wide Region Metrics");
        StringBuilder csvBuilder = null;
        if (export_to_report_to != null && !export_to_report_to.isEmpty()) {
            csvBuilder = new StringBuilder();
            csvBuilder.append("Category");
            csvBuilder.append(',');
            csvBuilder.append(CliStrings.SHOW_METRICS__METRIC__HEADER);
            csvBuilder.append(',');
            csvBuilder.append(CliStrings.SHOW_METRICS__VALUE__HEADER);
            csvBuilder.append('\n');
        }
        Map<String, Boolean> categoriesMap = getSystemRegionMetricsCategories();
        if (categoriesArr != null && categoriesArr.length != 0) {
            Set<String> categories = createSet(categoriesArr);
            Set<String> checkSet = new HashSet<String>(categoriesMap.keySet());
            Set<String> userCategories = getSetDifference(categories, checkSet);
            // Checking if the categories specified by the user are valid or not
            if (userCategories.isEmpty()) {
                for (String category : checkSet) {
                    categoriesMap.put(category, false);
                }
                for (String category : categories) {
                    categoriesMap.put(category.toLowerCase(), true);
                }
            } else {
                StringBuilder sb = new StringBuilder();
                sb.append("Invalid Categories\n");
                for (String category : userCategories) {
                    sb.append(category);
                    sb.append('\n');
                }
                return ResultBuilder.createErrorResultData().addLine(sb.toString());
            }
        }
        // cluster, region, partition , diskstore, callback, eviction
        if (categoriesMap.get("cluster").booleanValue()) {
            writeToTableAndCsv(metricsTable, "cluster", "member count", regionMxBean.getMemberCount(), csvBuilder);
            writeToTableAndCsv(metricsTable, "", "region entry count", regionMxBean.getSystemRegionEntryCount(), csvBuilder);
        }
        if (categoriesMap.get("region").booleanValue()) {
            writeToTableAndCsv(metricsTable, "region", "lastModifiedTime", regionMxBean.getLastModifiedTime(), csvBuilder);
            writeToTableAndCsv(metricsTable, "", "lastAccessedTime", regionMxBean.getLastAccessedTime(), csvBuilder);
            writeToTableAndCsv(metricsTable, "", "missCount", regionMxBean.getMissCount(), csvBuilder);
            writeToTableAndCsv(metricsTable, "", "hitCount", regionMxBean.getHitCount(), csvBuilder);
            writeToTableAndCsv(metricsTable, "", "hitRatio", regionMxBean.getHitRatio(), csvBuilder);
            writeToTableAndCsv(metricsTable, "", "getsRate", regionMxBean.getGetsRate(), csvBuilder);
            writeToTableAndCsv(metricsTable, "", "putsRate", regionMxBean.getPutsRate(), csvBuilder);
            writeToTableAndCsv(metricsTable, "", "createsRate", regionMxBean.getCreatesRate(), csvBuilder);
            writeToTableAndCsv(metricsTable, "", "destroyRate", regionMxBean.getDestroyRate(), csvBuilder);
            writeToTableAndCsv(metricsTable, "", "putAllRate", regionMxBean.getPutAllRate(), csvBuilder);
        }
        if (categoriesMap.get("partition").booleanValue()) {
            writeToTableAndCsv(metricsTable, "partition", "putLocalRate", regionMxBean.getPutLocalRate(), csvBuilder);
            writeToTableAndCsv(metricsTable, "", "putRemoteRate", regionMxBean.getPutRemoteRate(), csvBuilder);
            writeToTableAndCsv(metricsTable, "", "putRemoteLatency", regionMxBean.getPutRemoteLatency(), csvBuilder);
            writeToTableAndCsv(metricsTable, "", "putRemoteAvgLatency", regionMxBean.getPutRemoteAvgLatency(), csvBuilder);
            writeToTableAndCsv(metricsTable, "", "bucketCount", regionMxBean.getBucketCount(), csvBuilder);
            writeToTableAndCsv(metricsTable, "", "primaryBucketCount", regionMxBean.getPrimaryBucketCount(), csvBuilder);
            writeToTableAndCsv(metricsTable, "", "numBucketsWithoutRedundancy", regionMxBean.getNumBucketsWithoutRedundancy(), csvBuilder);
            writeToTableAndCsv(metricsTable, "", "totalBucketSize", regionMxBean.getTotalBucketSize(), csvBuilder);
            writeToTableAndCsv(metricsTable, "", "averageBucketSize", regionMxBean.getAvgBucketSize(), csvBuilder);
        }
        /*
       * Disk store
       */
        if (categoriesMap.get("diskstore").booleanValue()) {
            writeToTableAndCsv(metricsTable, "diskstore", "totalEntriesOnlyOnDisk", regionMxBean.getTotalEntriesOnlyOnDisk(), csvBuilder);
            writeToTableAndCsv(metricsTable, "", "diskReadsRate", regionMxBean.getDiskReadsRate(), csvBuilder);
            writeToTableAndCsv(metricsTable, "", "diskWritesRate", regionMxBean.getDiskWritesRate(), csvBuilder);
            writeToTableAndCsv(metricsTable, "", "totalDiskWriteInProgress", regionMxBean.getTotalDiskWritesProgress(), csvBuilder);
            writeToTableAndCsv(metricsTable, "", "diskTaskWaiting", regionMxBean.getDiskTaskWaiting(), csvBuilder);
        }
        /*
       * LISTENER
       */
        if (categoriesMap.get("callback").booleanValue()) {
            writeToTableAndCsv(metricsTable, "callback", "cacheWriterCallsAvgLatency", regionMxBean.getCacheWriterCallsAvgLatency(), csvBuilder);
            writeToTableAndCsv(metricsTable, "", "cacheListenerCallsAvgLatency", regionMxBean.getCacheListenerCallsAvgLatency(), csvBuilder);
        }
        /*
       * Eviction
       */
        if (categoriesMap.get("eviction").booleanValue()) {
            writeToTableAndCsv(metricsTable, "eviction", "lruEvictionRate", regionMxBean.getLruEvictionRate(), csvBuilder);
            writeToTableAndCsv(metricsTable, "", "lruDestroyRate", regionMxBean.getLruDestroyRate(), csvBuilder);
        }
        if (export_to_report_to != null && !export_to_report_to.isEmpty()) {
            crd.addAsFile(export_to_report_to, csvBuilder.toString(), "Aggregate Region Metrics exported to {0}.", false);
        }
        return crd;
    } else {
        ErrorResultData erd = ResultBuilder.createErrorResultData();
        String errorMessage = CliStrings.format(CliStrings.SHOW_METRICS__ERROR, "Distributed Region MBean for " + regionName + " not found");
        erd.addLine(errorMessage);
        return erd;
    }
}
Also used : CompositeResultData(org.apache.geode.management.internal.cli.result.CompositeResultData) TabularResultData(org.apache.geode.management.internal.cli.result.TabularResultData) InternalCache(org.apache.geode.internal.cache.InternalCache) DistributedRegionMXBean(org.apache.geode.management.DistributedRegionMXBean) ManagementService(org.apache.geode.management.ManagementService) SystemManagementService(org.apache.geode.management.internal.SystemManagementService) SectionResultData(org.apache.geode.management.internal.cli.result.CompositeResultData.SectionResultData) ErrorResultData(org.apache.geode.management.internal.cli.result.ErrorResultData) HashSet(java.util.HashSet)

Example 44 with CompositeResultData

use of org.apache.geode.management.internal.cli.result.CompositeResultData in project geode by apache.

the class DiskStoreCommands method toCompositeResult.

protected Result toCompositeResult(final DiskStoreDetails diskStoreDetails) {
    final CompositeResultData diskStoreData = ResultBuilder.createCompositeResultData();
    final CompositeResultData.SectionResultData diskStoreSection = diskStoreData.addSection();
    diskStoreSection.addData("Disk Store ID", diskStoreDetails.getId());
    diskStoreSection.addData("Disk Store Name", diskStoreDetails.getName());
    diskStoreSection.addData("Member ID", diskStoreDetails.getMemberId());
    diskStoreSection.addData("Member Name", diskStoreDetails.getMemberName());
    diskStoreSection.addData("Allow Force Compaction", toString(diskStoreDetails.isAllowForceCompaction(), "Yes", "No"));
    diskStoreSection.addData("Auto Compaction", toString(diskStoreDetails.isAutoCompact(), "Yes", "No"));
    diskStoreSection.addData("Compaction Threshold", diskStoreDetails.getCompactionThreshold());
    diskStoreSection.addData("Max Oplog Size", diskStoreDetails.getMaxOplogSize());
    diskStoreSection.addData("Queue Size", diskStoreDetails.getQueueSize());
    diskStoreSection.addData("Time Interval", diskStoreDetails.getTimeInterval());
    diskStoreSection.addData("Write Buffer Size", diskStoreDetails.getWriteBufferSize());
    diskStoreSection.addData("Disk Usage Warning Percentage", diskStoreDetails.getDiskUsageWarningPercentage());
    diskStoreSection.addData("Disk Usage Critical Percentage", diskStoreDetails.getDiskUsageCriticalPercentage());
    diskStoreSection.addData("PDX Serialization Meta-Data Stored", toString(diskStoreDetails.isPdxSerializationMetaDataStored(), "Yes", "No"));
    final TabularResultData diskDirTable = diskStoreData.addSection().addTable();
    for (DiskStoreDetails.DiskDirDetails diskDirDetails : diskStoreDetails) {
        diskDirTable.accumulate("Disk Directory", diskDirDetails.getAbsolutePath());
        diskDirTable.accumulate("Size", diskDirDetails.getSize());
    }
    final TabularResultData regionTable = diskStoreData.addSection().addTable();
    for (DiskStoreDetails.RegionDetails regionDetails : diskStoreDetails.iterateRegions()) {
        regionTable.accumulate("Region Path", regionDetails.getFullPath());
        regionTable.accumulate("Region Name", regionDetails.getName());
        regionTable.accumulate("Persistent", toString(regionDetails.isPersistent(), "Yes", "No"));
        regionTable.accumulate("Overflow To Disk", toString(regionDetails.isOverflowToDisk(), "Yes", "No"));
    }
    final TabularResultData cacheServerTable = diskStoreData.addSection().addTable();
    for (DiskStoreDetails.CacheServerDetails cacheServerDetails : diskStoreDetails.iterateCacheServers()) {
        cacheServerTable.accumulate("Bind Address", cacheServerDetails.getBindAddress());
        cacheServerTable.accumulate("Hostname for Clients", cacheServerDetails.getHostName());
        cacheServerTable.accumulate("Port", cacheServerDetails.getPort());
    }
    final TabularResultData gatewayTable = diskStoreData.addSection().addTable();
    for (DiskStoreDetails.GatewayDetails gatewayDetails : diskStoreDetails.iterateGateways()) {
        gatewayTable.accumulate("Gateway ID", gatewayDetails.getId());
        gatewayTable.accumulate("Persistent", toString(gatewayDetails.isPersistent(), "Yes", "No"));
    }
    final TabularResultData asyncEventQueueTable = diskStoreData.addSection().addTable();
    for (DiskStoreDetails.AsyncEventQueueDetails asyncEventQueueDetails : diskStoreDetails.iterateAsyncEventQueues()) {
        asyncEventQueueTable.accumulate("Async Event Queue ID", asyncEventQueueDetails.getId());
    }
    return ResultBuilder.buildResult(diskStoreData);
}
Also used : CompositeResultData(org.apache.geode.management.internal.cli.result.CompositeResultData) TabularResultData(org.apache.geode.management.internal.cli.result.TabularResultData) SectionResultData(org.apache.geode.management.internal.cli.result.CompositeResultData.SectionResultData) DiskStoreDetails(org.apache.geode.management.internal.cli.domain.DiskStoreDetails)

Example 45 with CompositeResultData

use of org.apache.geode.management.internal.cli.result.CompositeResultData in project geode by apache.

the class DataCommandFunctionWithPDXJUnitTest method getTableFromQuery.

private TabularResultData getTableFromQuery(String query) {
    DataCommandRequest request = new DataCommandRequest();
    request.setQuery(query);
    DataCommandResult result = new DataCommandFunction().select(request);
    CompositeResultData r = result.toSelectCommandResult();
    return r.retrieveSectionByIndex(0).retrieveTableByIndex(0);
}
Also used : CompositeResultData(org.apache.geode.management.internal.cli.result.CompositeResultData) DataCommandRequest(org.apache.geode.management.internal.cli.domain.DataCommandRequest) DataCommandResult(org.apache.geode.management.internal.cli.domain.DataCommandResult)

Aggregations

CompositeResultData (org.apache.geode.management.internal.cli.result.CompositeResultData)49 SectionResultData (org.apache.geode.management.internal.cli.result.CompositeResultData.SectionResultData)39 TabularResultData (org.apache.geode.management.internal.cli.result.TabularResultData)30 DistributedMember (org.apache.geode.distributed.DistributedMember)15 InternalCache (org.apache.geode.internal.cache.InternalCache)14 Result (org.apache.geode.management.cli.Result)14 CliMetaData (org.apache.geode.management.cli.CliMetaData)13 ResourceOperation (org.apache.geode.management.internal.security.ResourceOperation)13 CliCommand (org.springframework.shell.core.annotation.CliCommand)13 CommandResult (org.apache.geode.management.internal.cli.result.CommandResult)12 HashSet (java.util.HashSet)10 ArrayList (java.util.ArrayList)9 ObjectName (javax.management.ObjectName)9 SystemManagementService (org.apache.geode.management.internal.SystemManagementService)9 CommandResultException (org.apache.geode.management.internal.cli.result.CommandResultException)8 DistributedTest (org.apache.geode.test.junit.categories.DistributedTest)8 FlakyTest (org.apache.geode.test.junit.categories.FlakyTest)8 Test (org.junit.Test)8 List (java.util.List)6 CliFunctionResult (org.apache.geode.management.internal.cli.functions.CliFunctionResult)6