How to install Factry Historian Datasource for Grafana

Introduction

In this guide, we will complete the installation of the Factry Historian datasource for Grafana.

Prerequisites

  • An installed and properly configured Factry Historian, see installing Factry Historian .
  • A running instance of Grafana of at least v9.1.x

Allowing unsigned plugins

Allow the plugin by changing the /etc/grafana/grafana.ini file and adding factry-historian-datasource to the allowed plugin list (can separate plugin names with a comma if multiple are present) on the Historian server:

[plugins]
allow_loading_unsigned_plugins=factry-historian-datasource

Restart grafana-server.service using following command:

sudo systemctl restart grafana-server.service

Installing the datasource

If you have access to the Factry client portal, browse to the Factry client portal and navigate to the downloads page. Select the Factry Historian datasource and the version (the latest version is chosen by default). Then copy the URI by pressing Copy URI or downloading the zip file.

Perform the following command on the Factry Historian server:

sudo grafana cli --pluginUrl <path or URI to zip file> plugins install factry-historian-datasource

Example

If the server has internet access, the URI can be used to start the installation. Following commands can be executed:

sudo grafana cli --pluginUrl https://portal.factry.cloud/download/factry-historian-datasource/factry-historian-datasource-1.0.0.zip plugins install factry-historian-datasource

or if there is no network access on the server, the zip file can be downloaded and put on the server before executing the following commands:

sudo chmod 775 factry-historian-datasource-v1.0.0.zip
sudo grafana-cli --pluginUrl factry-historian-datasource-v1.0.0.zip plugins install factry-historian-datasource

Additional Note:

  • The filename might vary between “vx.x.x” and “x.x.x”.

Adding a connection

When adding a connection in Grafana you’ll need the following:

The organization UUID is used to determine from which organization you’ll be able to fetch data.

Below we create a user group with read privileges enabled and add a grafana user to this group from which to generate the API token.

In Factry Historian

  • Create a user group with all READ privileges (except READ_AUDIT_LOGS) in the according Historian organization.
    • Go to Factry Historian,
    • Click on Configuration and then Groups,
    • Click on Create user group and give the user group a name f.e. “factry-historian-readers”,
    • Click on the edit button and edit the Privileges
  • Create a user and add it to the newly created group.
    • To add a new user click on Configuration then Users,
    • Click on Add new user button,
    • Fill in the fields and submit,
    • Go back to Groups settings and add the user to the group using Users section
  • Create a token for the newly created user.
    • Go to Users settings and click on the edit button for the newly created user,
    • Navigate to Tokens tab,
    • Click on Generate API token button

Note

You might need to restart the factry-historian-server for permission changes to take immediate effect.

In Grafana

  • Create a new datasource.
  • Fill in the URL. This is the same as the Factry Historian API URL from above, f.e. http://localhost:8000.
  • Fill in the according organization UUID.
    • To find the organization UUID, go to Factry Historian,
    • Click on Organizations,
    • Click on the edit button of the organization and copy the ID.
  • Fill in the token generated in the Historian for the specific user and paste it in Grafana.