Using SystemLink Server Jupyter Notebooks as a Data Source in Grafana

Updated Mar 6, 2024

Environment

Software

  • SystemLink Jupyter Notebook Add-On
  • SystemLink Server

This article is a guide on how to configure SystemLink Server Jupyter Notebooks as a data source for SystemLink Grafana dashboards.


Prerequisites

  • The SystemLink Server PC must have the NI SystemLink Server - JupyterHub Module installed.
  • Grafana must be installed on the server PC. Refer to [External] GitHub: NI Grafana Plugins for instructions.

To configure a SystemLink Jupyter Notebook as a data source for a Grafana dashboard, follow the steps below:

1. Access the SystemLink Server web interface.
  • By default, it should load on the Grafana home page. If not select Custom Applications >> Grafana from the menu.
2. Ensure that the SystemLink Notebooks plugin has been added.
  1. Select Connections >> Data sources from the Grafana menu.
  2. Ensure that the SystemLink Notebooks plugin appears as a data source. 
    • Note: if you require access to the Systems data, Tag data, Test Monitor data, or Workspace information, the plugins shown in the image below will also be required.
  3. If these plugins are not visible, click Add new data source and search for "SystemLink". Then click the plugin that you require.
  4. if the plugins still aren't visible, ensure that your Grafana installation was correct by following the exact steps at [External] GitHub: SystemLink Grafana Plugins.
grafana data sources.PNG

3. Create a new dashboard that uses a Jupyter Notebook as a data source.
  1. From the Grafana menu, select Dashboards.
  2. Click New >> New Dashboard >> Add visualization.
  3. In the pop-up window, select SystemLink Notebooks as the data source.
  4. Under the Query section, select a Jupyter Notebook to use.
    • Note: Grafana will search for notebooks saved in C:\ProgramData\National Instruments\Skyline\JupyterHub\notebooks\_shared\reports by default. Ensure that you have an available notebook in this path.
  5. From the Output drop-down menu, select the DataFrame or scalar output defined in the notebook.
    • Note: If your expected output data is not visible, review your notebook and ensure that the output data follows the required data structure, is glued properly, and that the notebook parameters are correctly defined. Refer to Configure Multiple Outputs in SystemLink Jupyter Notebook for more details.
Select Notebook.PNG

7. [OPTIONAL] If the default Time Series Panel does not populate with data as expected:
  1. Try toggling the Table View option. Some Jupyter Notebooks do not output a DataFrame that consists of timestamp information, so the data is not suitable for Time Series Panels.
  2. Select the ellipses (...) in the top right-hand corner of the panel and click Inspect >> Panel JSON.
  3. From the Select Source drop-down menu, select DataFrame JSON and verify that the output data is structured as expected and contains the expected values. If the DataFrame appears incorrect, review the code in your Jupyter Notebook.