How-To Guides
Applications Guides

Visualize Data Using Grafana

12min

You can use Grafana to visualize data in Manufacturing Connect Edge.

Step 1: Install Docker Container

You have two options to install the Docker container.

Option 1: Deploy Grafana from Manufacturing Connect

If you have access to Manufacturing Connect (MC), you can use MC to deploy Grafana in your Manufacturing Connect Edge instance.

To deploy Grafana from Manufacturing Connect:

  1. In Manufacturing Connect, follow the steps to Manage Applications. For Grafana, follow the steps to Deploy an Application to Edge Devices.
    • For Step 2: Application Settings, if the default port number is already in use, you will need to enter another port.
  2. In Manufacturing Connect Edge, navigate to Applications Containers. The Containers pane appears.
  3. Verify that the Grafana Docker Container is running.
Operational Grafana Docker Container
Operational Grafana Docker Container


Option 2: Run Grafana Container in Manufacturing Connect Edge

If you don't have access to Manufacturing Connect, you can run the Grafana container in Manufacturing Connect Edge.

To run the Grafana container in Manufacturing Connect Edge:

  1. Navigate to Applications Containers. The Containers pane appears.
  2. From the Containers pane, click Run. The Enter command to run field appears.
  3. Enter the following Docker run command and click Run.
Linux


If needed, replace -p 3000:3000 with a different port.

4. Verify that the Grafana Docker Container is running.

Operational Grafana Docker Container
Operational Grafana Docker Container


Step 2: Access Grafana

To connect to Grafana, you will use your Manufacturing Connect Edge IP address and the port configured in the Grafana container.

Grafana port
Grafana port


To access Grafana:

  1. In a new browser window, enter the URL to connect to Grafana using this format: [Manufacturing Connect Edge IP address]:[port]. For example, if your Manufacturing Connect Edge instance uses the IP address https://192.168.0.146, and the Grafana container uses port 3000, enter 192.168.0.146:3000. The Grafana login screen appears.
  2. Enter admin as the username and password, and then change the password. The Grafana Home screen appears.

Step 3: Set up Database

Grafana needs a database to extract from to display results. Manufacturing Connect Edge allows you to configure the internal timeseries database (tsdata) to connect to Grafana.

You also have the option to set up a database to your specific requirements.

Step 1: Create DB User

You will need to create a user that has read access to the database.

To create a DB user:

  1. In Manufacturing Connect Edge, navigate to DataHub > DB Users.
  2. Click the Add (+) icon.

    The Add user icon
    The Add user icon
    
  3. Configure the user details.
    • Username
    • Password: Copy and save this for later use.
    • Database: Select tsdata.
    • Privilege: Select Read.
  4. Click Add User.

Step 2: Ensure Database Has a Measurement

The database will not connect successfully to Grafana unless at least one measurement is in the database.

To confirm if the database has a measurement, navigate to DataHub > DB Management and click the arrow to expand the tsdata database.

Expand the tsdata database
Expand the tsdata database


If there are no measurements listed, follow the steps below.

Step 2a: Connect Device

Follow the steps to Connect a Device and do the following:

  • Select the Device Type Simulator and the Driver Name Generator.
  • Select the Enable Data Store check box in the device configuration.
  • Enter a value in the Retention Hours field.

Step 2b: Add Tag to Device

Follow the steps to Add Tags and add at least one tag to the device you created.

After connecting the device and adding the tag, navigate to DataHub > DB Management and click the arrow to expand the tsdata database again to confirm a measurement is now available.

tsdata measurement
tsdata measurement


Step 4: Add a Data Source in Grafana

You will need to add a data source in Grafana that connects to the database you created. See the Influx data source documentation from Grafana to learn more.

When configuring the data source, do the following:

  • Select the InfluxDB time-series database.
  • In the URL field, enter http://10.30.50.1:8086. 10.30.50.1 is the IP address of Manufacturing Connect Edge on the internal docker network by default.
  • In the Database field, enter tsdata.
  • In the User field, enter the username you configured for the DB user in Manufacturing Connect Edge.
  • In the Password field, paste or enter the password you configured for the DB user in Manufacturing Connect Edge.

Step 5: Add a Dashboard in Grafana

Now that the database is successfully connected to Grafana, you can start visualizing the data by using a dashboard. See the Create a dashboard documentation from Grafana to learn more.