In Apache NiFi, there are multiple ways to monitor the different statistics of the system like errors, memory usage, CPU usage, Data Flow statistics, etc. We will discuss the most popular ones in this tutorial.

In built Monitoring

In this section, we will learn more about in built monitoring in Apache NiFi.

Bulletin Board

The bulletin board shows the latest ERROR and WARNING getting generated by NiFi processors in real time. To access the bulletin board, a user will have to go the right hand drop down menu and select the Bulletin Board option. It refreshes automatically and a user can disable it also. A user can also navigate to the actual processor by double-clicking the error. A user can also filter the bulletins by working out with the following −

  • by message
  • by name
  • by id
  • by group id

Data provenance UI

To monitor the Events occurring on any specific processor or throughout NiFi, a user can access the Data provenance from the same menu as the bulletin board. A user can also filter the events in data provenance repository by working out with the following fields −

  • by component name
  • by component type
  • by type

NiFi Summary UI

Apache NiFi summary also can be accessed from the same menu as the bulletin board. This UI contains information about all the components of that particular NiFi instance or cluster. They can be filtered by name, by type or by URI. There are different tabs for different component types. Following are the components, which can be monitored in the NiFi summary UI −

  • Processors
  • Input ports
  • Output ports
  • Remote process groups
  • Connections
  • Process groups

In this UI, there is a link at the bottom right hand side named system diagnostics to check the JVM statistics.

Reporting Tasks

Apache NiFi provides multiple reporting tasks to support external monitoring systems like Ambari, Grafana, etc. A developer can create a custom reporting task or can configure the inbuilt ones to send the metrics of NiFi to the externals monitoring systems. The following table lists down the reporting tasks offered by NiFi 1.7.1.

S.No. Reporting Task Name Description
1 AmbariReportingTask To setup Ambari Metrics Service for NiFi.
2 ControllerStatusReportingTask To report the information from the NiFi summary UI for the last 5 minute.
3 MonitorDiskUsage To report and warn about the disk usage of a specific directory.
4 MonitorMemory To monitor the amount of Java Heap used in a Java Memory pool of JVM.
5 SiteToSiteBulletinReportingTask To report the errors and warning in bulletins using Site to Site protocol.
6 SiteToSiteProvenanceReportingTask To report the NiFi Data Provenance events using Site to Site protocol.

NiFi API

There is an API named system diagnostics, which can be used to monitor the NiFI stats in any custom developed application. Let us check the API in postman.

Request

  1. http://localhost:8080/nifi-api/system-diagnostics

Response

  1. {
  2. "systemDiagnostics": {
  3. "aggregateSnapshot": {
  4. "totalNonHeap": "183.89 MB",
  5. "totalNonHeapBytes": 192819200,
  6. "usedNonHeap": "173.47 MB",
  7. "usedNonHeapBytes": 181894560,
  8. "freeNonHeap": "10.42 MB",
  9. "freeNonHeapBytes": 10924640,
  10. "maxNonHeap": "-1 bytes",
  11. "maxNonHeapBytes": -1,
  12. "totalHeap": "512 MB",
  13. "totalHeapBytes": 536870912,
  14. "usedHeap": "273.37 MB",
  15. "usedHeapBytes": 286652264,
  16. "freeHeap": "238.63 MB",
  17. "freeHeapBytes": 250218648,
  18. "maxHeap": "512 MB",
  19. "maxHeapBytes": 536870912,
  20. "heapUtilization": "53.0%",
  21. "availableProcessors": 4,
  22. "processorLoadAverage": -1,
  23. "totalThreads": 71,
  24. "daemonThreads": 31,
  25. "uptime": "17:30:35.277",
  26. "flowFileRepositoryStorageUsage": {
  27. "freeSpace": "286.93 GB",
  28. "totalSpace": "464.78 GB",
  29. "usedSpace": "177.85 GB",
  30. "freeSpaceBytes": 308090789888,
  31. "totalSpaceBytes": 499057160192,
  32. "usedSpaceBytes": 190966370304,
  33. "utilization": "38.0%"
  34. },
  35. "contentRepositoryStorageUsage": [
  36. {
  37. "identifier": "default",
  38. "freeSpace": "286.93 GB",
  39. "totalSpace": "464.78 GB",
  40. "usedSpace": "177.85 GB",
  41. "freeSpaceBytes": 308090789888,
  42. "totalSpaceBytes": 499057160192,
  43. "usedSpaceBytes": 190966370304,
  44. "utilization": "38.0%"
  45. }
  46. ],
  47. "provenanceRepositoryStorageUsage": [
  48. {
  49. "identifier": "default",
  50. "freeSpace": "286.93 GB",
  51. "totalSpace": "464.78 GB",
  52. "usedSpace": "177.85 GB",
  53. "freeSpaceBytes": 308090789888,
  54. "totalSpaceBytes": 499057160192,
  55. "usedSpaceBytes": 190966370304,
  56. "utilization": "38.0%"
  57. }
  58. ],
  59. "garbageCollection": [
  60. {
  61. "name": "G1 Young Generation",
  62. "collectionCount": 344,
  63. "collectionTime": "00:00:06.239",
  64. "collectionMillis": 6239
  65. },
  66. {
  67. "name": "G1 Old Generation",
  68. "collectionCount": 0,
  69. "collectionTime": "00:00:00.000",
  70. "collectionMillis": 0
  71. }
  72. ],
  73. "statsLastRefreshed": "09:30:20 SGT",
  74. "versionInfo": {
  75. "niFiVersion": "1.7.1",
  76. "javaVendor": "Oracle Corporation",
  77. "javaVersion": "1.8.0_151",
  78. "osName": "Windows 7",
  79. "osVersion": "6.1",
  80. "osArchitecture": "amd64",
  81. "buildTag": "nifi-1.7.1-RC1",
  82. "buildTimestamp": "07/12/2018 12:54:43 SGT"
  83. }
  84. }
  85. }
  86. }