org.apache.nifi.diagnostics.SystemDiagnostics Java Examples

The following examples show how to use org.apache.nifi.diagnostics.SystemDiagnostics. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: StatusConfigReporterTest.java    From nifi-minifi with Apache License 2.0 5 votes vote down vote up
private void populateSystemDiagnostics() {
    SystemDiagnostics systemDiagnostics = new SystemDiagnostics();
    addGarbageCollectionToSystemDiagnostics(systemDiagnostics);
    addHeapSystemDiagnostics(systemDiagnostics);
    addContentRepoToSystemDiagnostics(systemDiagnostics);
    addFlowFileRepoToSystemDiagnostics(systemDiagnostics);
    addProcessorInfoToSystemDiagnostics(systemDiagnostics);
    when(mockFlowController.getSystemDiagnostics()).thenReturn(systemDiagnostics);
}
 
Example #2
Source File: StatusConfigReporterTest.java    From nifi-minifi with Apache License 2.0 5 votes vote down vote up
private void addGarbageCollectionToSystemDiagnostics(SystemDiagnostics systemDiagnostics) {
    Map<String, GarbageCollection> garbageCollectionMap = new HashMap<>();

    GarbageCollection garbageCollection1 = new GarbageCollection();
    garbageCollection1.setCollectionCount(1);
    garbageCollection1.setCollectionTime(10);
    garbageCollection1.setName("garbage 1");
    garbageCollectionMap.put(garbageCollection1.getName(), garbageCollection1);

    systemDiagnostics.setGarbageCollection(garbageCollectionMap);
}
 
Example #3
Source File: StatusConfigReporterTest.java    From nifi-minifi with Apache License 2.0 5 votes vote down vote up
private void addContentRepoToSystemDiagnostics(SystemDiagnostics systemDiagnostics) {
    Map<String, StorageUsage> stringStorageUsageMap = new HashMap<>();

    StorageUsage repoUsage1 = new StorageUsage();
    repoUsage1.setFreeSpace(30);
    repoUsage1.setTotalSpace(100);
    repoUsage1.setIdentifier("Content repo1");
    stringStorageUsageMap.put(repoUsage1.getIdentifier(), repoUsage1);

    systemDiagnostics.setContentRepositoryStorageUsage(stringStorageUsageMap);
}
 
Example #4
Source File: StatusConfigReporterTest.java    From nifi-minifi with Apache License 2.0 5 votes vote down vote up
private void addFlowFileRepoToSystemDiagnostics(SystemDiagnostics systemDiagnostics) {
    StorageUsage repoUsage = new StorageUsage();
    repoUsage.setFreeSpace(30);
    repoUsage.setTotalSpace(100);
    repoUsage.setIdentifier("FlowFile repo");
    systemDiagnostics.setFlowFileRepositoryStorageUsage(repoUsage);
}
 
Example #5
Source File: StatusConfigReporterTest.java    From nifi-minifi with Apache License 2.0 5 votes vote down vote up
private void addHeapSystemDiagnostics(SystemDiagnostics systemDiagnostics) {
    systemDiagnostics.setMaxHeap(5);
    systemDiagnostics.setTotalHeap(3);
    systemDiagnostics.setUsedHeap(2);
    systemDiagnostics.setMaxNonHeap(9);
    systemDiagnostics.setTotalNonHeap(8);
    systemDiagnostics.setUsedNonHeap(6);
}
 
Example #6
Source File: StandardNiFiServiceFacade.java    From localization_nifi with Apache License 2.0 4 votes vote down vote up
@Override
public SystemDiagnosticsDTO getSystemDiagnostics() {
    final SystemDiagnostics sysDiagnostics = controllerFacade.getSystemDiagnostics();
    return dtoFactory.createSystemDiagnosticsDto(sysDiagnostics);
}
 
Example #7
Source File: FlowController.java    From localization_nifi with Apache License 2.0 4 votes vote down vote up
public SystemDiagnostics getSystemDiagnostics() {
    final SystemDiagnosticsFactory factory = new SystemDiagnosticsFactory();
    return factory.create(flowFileRepository, contentRepository);
}
 
Example #8
Source File: StatusRequestParser.java    From nifi-minifi with Apache License 2.0 4 votes vote down vote up
static SystemDiagnosticsStatus parseSystemDiagnosticsRequest(SystemDiagnostics inputSystemDiagnostics, String statusTypes) throws StatusRequestException {
    if (inputSystemDiagnostics == null) {
        throw new StatusRequestException("Unable to get system diagnostics");
    }

    SystemDiagnosticsStatus systemDiagnosticsStatus = new SystemDiagnosticsStatus();
    String[] statusSplits = statusTypes.split(",");

    for (String statusType : statusSplits) {
        switch (statusType.toLowerCase().trim()) {
            case "heap":
                HeapStatus heapStatus = new HeapStatus();
                heapStatus.setTotalHeap(inputSystemDiagnostics.getTotalHeap());
                heapStatus.setMaxHeap(inputSystemDiagnostics.getMaxHeap());
                heapStatus.setFreeHeap(inputSystemDiagnostics.getFreeHeap());
                heapStatus.setUsedHeap(inputSystemDiagnostics.getUsedHeap());
                heapStatus.setHeapUtilization(inputSystemDiagnostics.getHeapUtilization());
                heapStatus.setTotalNonHeap(inputSystemDiagnostics.getTotalNonHeap());
                heapStatus.setMaxNonHeap(inputSystemDiagnostics.getMaxNonHeap());
                heapStatus.setFreeNonHeap(inputSystemDiagnostics.getFreeNonHeap());
                heapStatus.setUsedNonHeap(inputSystemDiagnostics.getUsedNonHeap());
                heapStatus.setNonHeapUtilization(inputSystemDiagnostics.getNonHeapUtilization());
                systemDiagnosticsStatus.setHeapStatus(heapStatus);
                break;
            case "processorstats":
                SystemProcessorStats systemProcessorStats = new SystemProcessorStats();
                systemProcessorStats.setAvailableProcessors(inputSystemDiagnostics.getAvailableProcessors());
                systemProcessorStats.setLoadAverage(inputSystemDiagnostics.getProcessorLoadAverage());
                systemDiagnosticsStatus.setProcessorStatus(systemProcessorStats);
                break;
            case "contentrepositoryusage":
                List<ContentRepositoryUsage> contentRepositoryUsageList = new LinkedList<>();
                Map<String, StorageUsage> contentRepoStorage = inputSystemDiagnostics.getContentRepositoryStorageUsage();

                for (Map.Entry<String, StorageUsage> stringStorageUsageEntry : contentRepoStorage.entrySet()) {
                    ContentRepositoryUsage contentRepositoryUsage = new ContentRepositoryUsage();
                    StorageUsage storageUsage = stringStorageUsageEntry.getValue();

                    contentRepositoryUsage.setName(storageUsage.getIdentifier());
                    contentRepositoryUsage.setFreeSpace(storageUsage.getFreeSpace());
                    contentRepositoryUsage.setTotalSpace(storageUsage.getTotalSpace());
                    contentRepositoryUsage.setDiskUtilization(storageUsage.getDiskUtilization());
                    contentRepositoryUsage.setUsedSpace(storageUsage.getUsedSpace());

                    contentRepositoryUsageList.add(contentRepositoryUsage);
                }
                systemDiagnosticsStatus.setContentRepositoryUsageList(contentRepositoryUsageList);
                break;
            case "flowfilerepositoryusage":
                FlowfileRepositoryUsage flowfileRepositoryUsage = new FlowfileRepositoryUsage();
                StorageUsage flowFileRepoStorage = inputSystemDiagnostics.getFlowFileRepositoryStorageUsage();

                flowfileRepositoryUsage.setFreeSpace(flowFileRepoStorage.getFreeSpace());
                flowfileRepositoryUsage.setTotalSpace(flowFileRepoStorage.getTotalSpace());
                flowfileRepositoryUsage.setDiskUtilization(flowFileRepoStorage.getDiskUtilization());
                flowfileRepositoryUsage.setUsedSpace(flowFileRepoStorage.getUsedSpace());

                systemDiagnosticsStatus.setFlowfileRepositoryUsage(flowfileRepositoryUsage);
                break;
            case "garbagecollection":
                List<GarbageCollectionStatus> garbageCollectionStatusList = new LinkedList<>();
                Map<String, GarbageCollection> garbageCollectionMap = inputSystemDiagnostics.getGarbageCollection();

                for (Map.Entry<String, GarbageCollection> stringGarbageCollectionEntry : garbageCollectionMap.entrySet()) {
                    GarbageCollectionStatus garbageCollectionStatus = new GarbageCollectionStatus();
                    GarbageCollection garbageCollection = stringGarbageCollectionEntry.getValue();

                    garbageCollectionStatus.setName(garbageCollection.getName());
                    garbageCollectionStatus.setCollectionCount(garbageCollection.getCollectionCount());
                    garbageCollectionStatus.setCollectionTime(garbageCollection.getCollectionTime());

                    garbageCollectionStatusList.add(garbageCollectionStatus);
                }
                systemDiagnosticsStatus.setGarbageCollectionStatusList(garbageCollectionStatusList);
                break;
        }
    }
    return systemDiagnosticsStatus;
}
 
Example #9
Source File: StatusConfigReporterTest.java    From nifi-minifi with Apache License 2.0 4 votes vote down vote up
private void addProcessorInfoToSystemDiagnostics(SystemDiagnostics systemDiagnostics) {
    systemDiagnostics.setProcessorLoadAverage(80.9);
    systemDiagnostics.setAvailableProcessors(5);
}
 
Example #10
Source File: FlowController.java    From nifi with Apache License 2.0 4 votes vote down vote up
public SystemDiagnostics getSystemDiagnostics() {
    final SystemDiagnosticsFactory factory = new SystemDiagnosticsFactory();
    return factory.create(flowFileRepository, contentRepository, provenanceRepository);
}
 
Example #11
Source File: ControllerFacade.java    From localization_nifi with Apache License 2.0 2 votes vote down vote up
/**
 * Returns a SystemDiagnostics that describes the current state of the node
 *
 * @return a SystemDiagnostics that describes the current state of the node
 */
public SystemDiagnostics getSystemDiagnostics() {
    return flowController.getSystemDiagnostics();
}
 
Example #12
Source File: ControllerFacade.java    From nifi with Apache License 2.0 2 votes vote down vote up
/**
 * Returns a SystemDiagnostics that describes the current state of the node
 *
 * @return a SystemDiagnostics that describes the current state of the node
 */
public SystemDiagnostics getSystemDiagnostics() {
    return flowController.getSystemDiagnostics();
}