Reporting tasks

Reporting tasks allow you to monitor flow deployments using external applications.

  • If you want to create a reporting task using a custom NAR, you have added a custom NAR to the flow during deployment.

  • You have DFFlowAdmin role for the environment where you want to create the reporting task.

Create a JSON file

To create a reporting task, use the following template:

Replace elements marked [***SOME VALUE***] with actual values valid in your environment. You can specify additional properties that may be necessary to your specific use case.

{
  "name": "[***REPORTING TASK NAME***]",
  "type": "[***FULLY QUALIFIED CLASS NAME***]",
  "properties": {
    "[***PROPERTY NAME 1***]": "[***PROPERTY VALUE 1***]",
    "[***PROPERTY NAME 2***]": "[***PROPERTY VALUE 2***]"
  },
  "scheduledState": "[***RUNNING|DISABLED***]",
  "schedulingPeriod": "[***SCHEDULING PERIOD***]",
  "schedulingStrategy": "[***TIMER_DRIVEN|CRON_DRIVEN***]"
}

To define a schedulingPeriod that corresponds to the TIMER_DRIVEN schedulingStrategy, specify a frequency. For example, "5 min" or "45 sec" or "2 hours".

To define a schedulingPeriod that corresponds to the CRON_DRIVEN schedulingStrategy specify, for example, "* * * * * ?"

By setting scheduledState to RUNNING, the task automatically starts upon creation. Otherwise, it remains stopped.

For example:

{
  "name": "My Reporting Task",
  "type": "org.apache.nifi.controller.ControllerStatusReportingTask",
  "properties": {
    "Show Deltas": "true",
    "reporting-granularity": "five-minutes"
  },
  "scheduledState": "RUNNING",
  "schedulingPeriod": "5 min",
  "schedulingStrategy": "TIMER_DRIVEN"
}

If there is more than one reporting task with the same class name in the deployment, you can select the required one using a "bundle", as the following example shows:

{
  "name": "ControllerStatusReportingTask",
  "type": "org.apache.nifi.controller.ControllerStatusReportingTask",
  "bundle": {
    "group": "org.apache.nifi",
    "artifact": "nifi-standard-nar",
    "version": "1.23.2.2.3.12.0-7"
  },
  "properties": {
    "Show Deltas": "true",
    "reporting-granularity": "five-minutes"
  },
  "scheduledState": "RUNNING",
  "schedulingPeriod": "5 mins",
  "schedulingStrategy": "TIMER_DRIVEN"
}

Create a reporting task

Assuming you created a file named reporting-task.json with contents similar to one of the above examples, execute the command:

dfworkload create-reporting-task --environment-crn [***ENVIRONMENT CRN***] --deployment-crn [***DEPLOYMENT CRN***] --file-path reporting-task.json

Replace [***ENVIRONMENT CRN***] and [***DEPLOYMENT CRN***] with actual values valid in your environment.

List all reporting tasks

To list existing reporting tasks, use the following command:

dfworkload list-reporting-tasks --environment-crn [***ENVIRONMENT CRN***] --deployment-crn [***DEPLOYMENT CRN***]

Replace [***ENVIRONMENT CRN***] and [***DEPLOYMENT CRN***] with actual values valid in your environment.

Delete a reporting task

To delete a reporting task, use the following command:

dfworkload delete-reporting-task --environment-crn [***ENVIRONMENT CRN***] --deployment-crn [***DEPLOYMENT CRN***] --reporting-task-crn [***REPORTING TASK CRN***]

Replace [***ENVIRONMENT CRN***], [***DEPLOYMENT CRN***], and [***REPORTING TASK CRN***] with actual values valid in your environment.