Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Version History

« Previous Version 3 Next »

ZWE nifi process extracts information from the moodle instance to later create analytic data and have further understanding of the progress of the students and how the content is being consumed by them.

This page contains the following information:

Technologies used

Tool

Version

NiFi

1.27.0

Postgres

17

Moodle

4.1

Superset

4.0.2

How to install

You can find all the files related to this process in the following link: https://github.com/KnowTechTure/ZWE_NiFi

1. Create/download NiFi template

First, make sure to have a template that includes all the definition of the NiFi pipeline. This template comes in a .xml format. To create a template, make sure that you are in the desired pipeline. This means that if your definition is inside a process group, you must be inside the process group before creating the template.

Click on create template on the left panel of the screen:

image-20241009-213150.png

This will ask you for a name and description, provide the information to create the template:

image-20241009-214029.png

Once you already have the template, this template will appear in the templates created so you can download it from there.

Click on the hamburger menu on the top right side of the screen and click on templates:

image-20241009-214405.png

A new window will be displayed listing all the templates created. At the end of the row of the desired templated, two options are available: download and delete. Click on download button to download the .xml file (template definition):

image-20241009-214709.png

2. Upload the template in a new NiFi instance

Once the first step is already completed https://psi.atlassian.net/wiki/spaces/ZMO/pages/edit-v2/583630850?draftShareId=0ab54fe1-d538-4710-9283-5b5e5436cdb7#1.-Create%2Fdownload-NiFi-template, it is time to import the template into the desired NiFi instance.

To upload a a template into NiFi, click on upload template button on the left panel of the NiFi window:

image-20241009-220203.png

This will open a window enabling to upload the template from a local storage.

image-20241009-220216.png

It is recommended that before uploading the template, add a process group and name it accordingly to avoid having a mixed flows in the main NiFi screen.

3. Create context parameters

Once the step 1 https://psi.atlassian.net/wiki/spaces/ZMO/pages/edit-v2/583630850?draftShareId=0ab54fe1-d538-4710-9283-5b5e5436cdb7#1.-Create%2Fdownload-NiFi-template and step 2 https://psi.atlassian.net/wiki/spaces/ZMO/pages/edit-v2/583630850?draftShareId=0ab54fe1-d538-4710-9283-5b5e5436cdb7#2.-Upload-the-template-in-a-new-NiFi-instance are completed, you will likely have the pipeline imported in your NiFi instance. The pipelines require you to create a parameter context (that act as environment variables). To create these, first go to your NiFi instance and click on the hamburguer icon on the top right corner of the NiFi screen. Then, select parameter context:

image-20241009-225614.png

Here, a table with a list of the parameter context will be displayed, to create a new parameter context, click on the plus button on the right side of the window:

image-20241009-230123.png

A new window will be displayed for you to add a name and description to the parameter context:

image-20241009-230319.png

Then, to add parameters to the parameter context, click on the parameters tab and click on the plus button on the right corner. A new window will be displayed for you to add one by one the parameters:

image-20241009-230626.png

The following parameters must be added in order to make the flow work properly:

Parameter name

Parameter value

baseurl

your moodle host url

errorLogsDirectory

name of the folder to add the error logs files

moodleanalyticsplugintoken

token to access the functions for the moodle analytics custom plugin

moodletoken

token to access the core functions of the moodle instance

useKeyCloak

no

After creating the parameter context, it is vital to add this parameter context to each process. To add the parameter context to each process, it must be added to the process group by selecting the process group and then clicking on the configuration button on the left panel:

image-20241014-175749.png

This will open a new window to configure the process group. To select the desired parameter context, look for the second option that is a dropdown and select the parameter context created.

image-20241014-181827.png

Parameter context is applied to the processes inside a process group. In case there are more process groups inside the main process group, it is needed to add the parameter context for each process group.

4. Adding controllers

The NiFi flow contains processes that requires to interact with a database. This interaction requires the creation of a controller service called DBCPConnectionPool. The NiFi flow creates this controller services automatically when the user import the process.

To access this controller services, click on the configuration buttton on the left panel:

image-20241015-203345.png

A new window will open. Click on the controller services tab:

image-20241015-204821.png

Here, two controller services will be disabled: DBCPConnectionPool and JsonTreeReader. The JsonTreeReader does not require any additional configuration so it can be enabled right away. The DBPCConnectionPool does require some fields to be updated so before enabling, click on the configuration button for this controller service:

image-20241016-092843.png

And then open click on the properties tab:

image-20241016-093009.png

Here, there are four fields that the user must set up before enabling the controller service:

  • Database Connection URL.

  • Database Driver Class Name.

  • Database Driver Location(s).

  • Database User.

  • Database Password.

This fields are already set up for a postgresql database connection, in case there is a need to change the database instance, this fields may change accordingly.

Also, it is important to have a look on the field called Database Driver Location(s), this field allows NiFi to search for a .jar file that is required for the database connection to work. This driver does not come with the NiFi instance, so the file is required to be downloaded and placed in the location defined.

Database connections made via SSH are not supported.

Once the fields are already set up, click on Apply button at the right bottom of the window and now the controller service can enabled:

image-20241016-094222.png

When clicking on the enable button, a new window will show listing all the components using this controller service. Every component will have a warning icon, once the service is enabled, all the listing components will have a stoped icon referencing that the service is now available for the components:

image-20241016-094248.pngimage-20241016-094657.png

Make sure that either the DBCPConnectionPool and JsonTreeReader controllers are enabled, otherwise there will be components with the warning icon.

  • No labels