nifi-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Koji Kawamura <ijokaruma...@gmail.com>
Subject Re: Syntax to access freeSpace from REST API
Date Wed, 21 Nov 2018 01:41:26 GMT
Hi Jim,

The reason for 'contentRepositoryStorageUsage' being an array is that
you can configure multiple content repository paths.
In that case, each content repository can be mapped to different disk
partitions and have own free space.
https://nifi.apache.org/docs/nifi-docs/html/administration-guide.html#file-system-content-repository-properties

If you have only one content repo dir, then you can use following syntax.
$.systemDiagnostics.aggregateSnapshot.contentRepositoryStorageUsage[0].freeSpace

Thanks,
Koji
On Wed, Nov 21, 2018 at 3:47 AM James McMahon <jsmcmahon3@gmail.com> wrote:
>
> Hello. In the json that is returned by a RESTful API call to system diagnostics, I can
access the free space for the flowFile repo something like this:
>
> status     $.systemDiagnostics.aggregateSnapshot.flowFileRepositoryStorageUsage.freeSpace
>
> But the content repo stats seem to be buried deeper in the structure, and are also enclosed
by a [,] that is not found in the flow file repo stats. Using a syntax like that I've shown
above does not return the value to me. What is the syntax to use in an UpdateAttribute processor
to grab that content repo free space value, so that I can save it to an attribute?
>
> Here is the structure returned by the API call:
>
> {"systemDiagnostics":{"aggregateSnapshot":
>
>                       {"totalNonHeap":"338.38 MB",
>
>                        "totalNonHeapBytes":354816000,
>
>                        "usedNonHeap":"326.16 MB",
>
>                        "usedNonHeapBytes":342000064,
>
>                        "freeNonHeap":"12.22 MB",
>
>                        "freeNonHeapBytes":12815936,
>
>                        "maxNonHeap":"-1 bytes",
>
>                        "maxNonHeapBytes":-1,
>
>                        "totalHeap":"6 GB",
>
>                        "totalHeapBytes":6442450944,
>
>                        "usedHeap":"3.17 GB",
>
>                        "usedHeapBytes":3407422960,
>
>                        "freeHeap":"2.83 GB",
>
>                        "freeHeapBytes":3035027984,
>
>                        "maxHeap":"6 GB",
>
>                        "maxHeapBytes":6442450944,
>
>                        "heapUtilization":"53.0%",
>
>                        "availableProcessors":8,
>
>                        "processorLoadAverage":0.36,
>
>                        "totalThreads":99,
>
>                        "daemonThreads":53,
>
>                        "flowFileRepositoryStorageUsage":
>
>                        {"freeSpace":"44.39 GB",
>
>                         "totalSpace":"79.99 GB",
>
>                         "usedSpace":"35.59 GB",
>
>                         "freeSpaceBytes":47666999296,
>
>                         "totalSpaceBytes":85885063168,
>
>                         "usedSpaceBytes":38218063872,
>
>                         "utilization":"44.0%"},
>
>                         "contentRepositoryStorageUsage":[
>
>                           {"identifier":"default","freeSpace":"44.39 GB",
>
>                            "totalSpace":"79.99 GB","usedSpace":"35.59 GB",
>
>                            "freeSpaceBytes":47666999296,
>
>                            "totalSpaceBytes":85885063168,
>
>                            "usedSpaceBytes":38218063872,
>
>                            "utilization":"44.0%"}],
>
>                           "garbageCollection":[
>
>                             {"name":"G1 Young Generation",
>
>                              "collectionCount":2172338,
>
>                              "collectionTime":"132:38:54.540",
>
>                              "collectionMillis":477534540},
>
>                             {"name":"G1 Old Generation","collectionCount":0,
>
>                              "collectionTime":"00:00:00.000",
>
>                              "collectionMillis":0}],
>
>                             "statsLastRefreshed":"03:05:01 UTC"}
>
>                      }
>
>                     }
>
>
> Thanks in advance for your help. -Jim

Mime
View raw message