Add and Configure an MQTT Collector

Before you begin

  1. Deploy Proficy Historian for AWS.
  2. Install collectors. You can install them on-premises or on a VPC (which can be different from the one on which Proficy Historian for AWS is deployed).
  3. Enable TLS encryption for Collectors Connecting to Cloud Historian.
  4. Ensure that you have an MQTT broker.
    Note: We have tested with the MQTT brokers Mosquitto 2.0.15 and HiveMQ-4.2.1. You can, however, use other MQTT brokers as well.
  5. If you want to use username/password-based authentication or certificate-based authentication to connect the MQTT broker and the MQTT collector, configure the authentication in the MQTT broker.
  6. If you want to use certificate-based authentication, ensure that the following files are available on your collector machine:
    • CA server root file
    • Private key file
    • Client certificate file

About this task

The MQTT collector collects data published to a topic using an MQTT broker. For more information, refer to Overview of the MQTT Collector.

This topic describes how to add a collector instance using Configuration Hub. You can also add a collector instance using the RemoteCollectorConfigurator utility, which does not require you to install Web-based Clients.

Procedure

  1. Access Configuration Hub.
  2. In the NAVIGATION section, under the Configuration Hub plugin for Historian, select Collectors.
    A list of collectors in the default system appears.
  3. In the upper-right corner of the main section, select .
    The Add Collector Instance: <system name> window appears, displaying the Collector Selection section. The MACHINE NAME field contains a list of machines on which you have installed collectors.
  4. In the MACHINE NAME field, select the machine in which you want to add a collector instance.
  5. In the COLLECTOR TYPE field, select MQTT Collector, and then select Get Details.
    The INSTALLATION DRIVE and DATA DIRECTORY fields are disabled and populated.
  6. Select Next.
    The Source Configuration section appears.
  7. Enter values as described in the following table.
    Field Description
    MQTT BROKER ADDRESS Enter the host name of the MQTT broker using which you want to collect data. A value is required.
    MQTT BROKER PORT Enter the port number of the MQTT broker. A value is required.
    TOPIC Enter the MQTT topic from which you want to collect data. A value is required. You can enter multiple topics separated by commas.

    If you want to use the Sparkplug B format, enter a value in the following format: namespace/group_id/message_type/edge_node_id/device_id

    where:
    • namespace is the Sparkplug version. Enter spBv1.0.
    • group_id is the ID of the group of nodes from which you want to collect data.
    • message_type is the message type from which you want to collect data. The collector processes data only from NDATA and DDATA message types.
    • edge_node_id is used to identify the MQTT EoN node within the infrastructure.
    • device_id a device attached to the MQTT EoN node either physically or logically.
    You can use the wildcard character # for any of these parameters (except for namespace).
    USERNAME Enter the username to connect to the MQTT broker. A value is required if you have configured username/password-based authentication in the MQTT broker.
    PASSWORD Enter the password to connect to the MQTT broker. A value is required if you have configured username/password-based authentication in the MQTT broker.
    CA SERVER ROOT FILE Enter the path to the CA server root file to connect to the MQTT broker. A value is required if you have configured certificate-based authentication in the MQTT broker.
    PRIVATE KEY FILE Enter the path to the private key file to connect to the MQTT broker. A value is required if you have configured certificate-based authentication in the MQTT broker.
    CLIENT CERTIFICATE FILE Enter the path to the client certificate file to connect to the MQTT broker. A value is required if you have configured certificate-based authentication in the MQTT broker.
    REQUESTED QUALITY OF SERVICE (QOS) LEVEL Select the quality of service that you want to use while collecting data from an MQTT broker.
    • QoS 0: Indicates that the message is delivered at most once or it is not delivered at all.
    • QoS 1: Indicates that the message is always delivered at least once.
    • QoS 2: Indicates that the message is delivered once.
    For more information, refer to https://www.hivemq.com/blog/mqtt-essentials-part-6-mqtt-quality-of-service-levels/.
    MQTT VERSION Select the version of the MQTT that you want to use.
    CLEAN SESSION Select one of the following options:
    • True: Select this option if you do not want to create a new session when the MQTT broker and the collector are disconnected from each other.
    • False: Select this option if you want to retain the session when the MQTT broker and the collector are disconnected from each other. This ensures that there is no loss of data. If you want to choose this option, ensure that you have selected QoS 1 or QoS 2 in the REQUESTED QUALITY OF SERVICE (QOS) LEVEL field.
    SESSION EXPIRY INTERVAL Enter the duration, in seconds, after which the data will be discarded when connection between the MQTT broker and collector is re-established.

    For example, if you enter 100 in this field, and if the MQTT broker and collector are disconnected for 90 seconds, the data is collected. If, however, the MQTT broker and the collector are disconnected for more than 100 seconds, the data will be discarded.

    This field is applicable only for MQTT V5 and only if you set the CLEAN SESSION field to False.

    CONTENT TYPE Select the format that you want to use for the payload:
    • JSON: Select this option if you want to use the KairosDB format.
    • SparkPlug B v1.0: Select this option if you want to use the Sparkplug format.
  8. Select Next.
    The Destination Configuration section appears. The collector machine name provided by you is selected as the Source Configuration by default.

    Under CHOOSE DESTINATION, the Historian Server option is selected by default. In addition, the DESTINATION HISTORIAN SERVER field is disabled and populated with the collector machine name.

  9. Select the destination to which you want to send data, and then enter the values in the corresponding fields. You can send data to an on-premise Historian server or to a cloud destination.
    1. If you need to send data to a cloud destination, select the cloud destinations as needed.
      • Predix Timeseries- Select this if you need to send data to Predix cloud. For more information, refer to Predix Cloud.
      • Azure IoT Hub- Select this if you need to send data to Azure Cloud in KairosDB format. For more information, refer to Azure IoT Hub (KairosDB format).
      • MQTT- Select this if you need to send data to any of the following cloud destination.
        • Alibaba cloud. For more information, refer to Alibaba Cloud.
        • AWS cloud. For more information, refer to AWS Cloud.
        • Google cloud. For more information, refer to Google Cloud.
    2. If you need to send data to an on-premise/Cloud Historian server, select Historian Server.
      If the entered credentials are valid, a successful connection message appears.
  10. Select Next.
    The Collector Initiation section appears.
  11. If needed, modify the value in the COLLECTOR NAME field. The value must be unique, must contain the string MQTT, and must not contain a space.
    The value that you enter:
    • Must be unique.
    • Must contain the string MQTT.
    • Must not exceed 15 characters.
    • Must not contain a space.
    • Must not contain special characters except a hyphen, period, and an underscore.
  12. In the RUNNING MODE field, select one of the following options.
    • Service - Local System Account: Select this option if you want to run the collector as a Windows service using the credentials of the local user (that is, the currently logged-in user). If you select this option, the USERNAME and PASSWORD fields are disabled.
    • Service Under Specific User Account: Select this option if you want to run the collector as a Windows service using a specific user account. If you select this option, you must enter values in the USERNAME and PASSWORD fields.
      If you have enabled the Enforce Strict Collector Authentication option in Historian Administrator, you must provide the credentials of a user who is added to at least one of the following security groups:
      • iH Security Admins
      • iH Collector Admins
      • iH Tag Admins

    You can also configure the collector to start automatically when you start the computer.

  13. Select Add.
    The collector instance is added. The fields specific to the collector section appear in the DETAILS section.
  14. In the COLLECTOR SPECIFIC CONFIGURATION and INSTANCE CONFIGURATION sections, configure the values as described in the following table.

    INSTANCE CONFIGURATION

    Field Description
    MQTT Broker Address Enter the host name of the MQTT broker using which you want to collect data. A value is required.
    MQTT Broker Topic Enter the MQTT topic from which you want to collect data. A value is required. You can enter multiple topics separated by commas.

    If you want to use the Sparkplug B format, enter a value in the following format: namespace/group_id/message_type/edge_node_id/device_id

    where:
    • namespace is the Sparkplug version. Enter spBv1.0.
    • group_id is the ID of the group of nodes from which you want to collect data.
    • message_type is the message type from which you want to collect data. The collector processes data only from NDATA and DDATA message types.
    • edge_node_id is used to identify the MQTT EoN node within the infrastructure.
    • device_id a device attached to the MQTT EoN node either physically or logically.
    You can use the wildcard character # for any of these parameters (except for namespace).
    MQTT Brker Port Enter the port number of the MQTT broker. A value is required.
    Username Enter the username to connect to the MQTT broker. A value is required if you have configured username/password-based authentication in the MQTT broker.
    Password Enter the password to connect to the MQTT broker. A value is required if you have configured username/password-based authentication in the MQTT broker.
    CA Server Root File Enter the path to the CA server root file to connect to the MQTT broker. A value is required if you have configured certificate-based authentication in the MQTT broker.
    Private Key File Enter the path to the private key file to connect to the MQTT broker. A value is required if you have configured certificate-based authentication in the MQTT broker.
    CLIENT Certificate File Enter the path to the client certificate file to connect to the MQTT broker. A value is required if you have configured certificate-based authentication in the MQTT broker.
    Requested Quality Of Service (QoS) Level Select the quality of service that you want to use while collecting data from an MQTT broker.
    • QoS 0: Indicates that the message is delivered at most once or it is not delivered at all.
    • QoS 1: Indicates that the message is always delivered at least once.
    • QoS 2: Indicates that the message is delivered once.
    For more information, refer to https://www.hivemq.com/blog/mqtt-essentials-part-6-mqtt-quality-of-service-levels/.
    MQTT Version Select the version of the MQTT that you want to use.
    CLEAN Session Select one of the following options:
    • True: Select this option if you do not want to create a new session when the MQTT broker and the collector are disconnected from each other.
    • False: Select this option if you want to retain the session when the MQTT broker and the collector are disconnected from each other. This ensures that there is no loss of data. If you want to choose this option, ensure that you have selected QoS 1 or QoS 2 in the REQUESTED QUALITY OF SERVICE (QOS) LEVEL field.
    SESSION Expiry Interval Enter the duration, in seconds, after which the data will be discarded when connection between the MQTT broker and collector is re-established.

    For example, if you enter 100 in this field, and if the MQTT broker and collector are disconnected for 90 seconds, the data is collected. If, however, the MQTT broker and the collector are disconnected for more than 100 seconds, the data will be discarded.

    This field is applicable only for MQTT V5 and only if you set the CLEAN SESSION field to False.

    Content Type Select the format that you want to use for the payload:
    • JSON: Select this option if you want to use the KairosDB format.
    • SparkPlug B v1.0: Select this option if you want to use the Sparkplug format.
  15. As needed, enter values in the other sections common to all collectors.
  16. In the upper-left corner of the page, select Save.
    The changes to the collector instance are saved.
  17. If needed, restart the collector.

What to do next

Specify the tags whose data you want to collect using the collector. In the CHOOSE CONFIGURATION field,