Integrations & Setup
...
MQTT
Configuring an MQTT Sparkplug B collector
prerequisites permissions in factry historian to manage collectors see privileges docid\ k2nnyecuxqqsiuclmpfkh an installed collector if you have not done so already, first installing a collector docid\ iv4 sd56tdxcqkrkcj4kv a running mqtt broker that your collector can connect to if you are running into issues or setting this up for the first time, follow our guide to testing an mqtt connection docid 9wwofhat2n58ssdmpv2rv a configured creating a time series database connection docid\ sq5uvlchyg7umi930nyml to write the collected data to configure the collector after installing the collector, you should see that the collector is in an initial state initial state and is actively running this means that the collector has established a connection to factry historian and is awaiting further configuration to configure the collector, select it from the collectors overview in factry historian and click the edit button configure the following fields mqtturl the connection url of the mqtt broker you wish to connect to should be in the following format example clientcertificate if your mqtt broker requires client certificate authentication , enable this option otherwise, leave it as false username & password if the mqtt broker requires authentication, provide a valid username and password if the broker allows anonymous connections, you can leave these fields empty topics the list of topics to subscribe to is essential in sparkplug b format (e g , spbv1 0/group id/edge node id/metric name) you can use wildcards to capture multiple topics for example, to subscribe to all topics example qos (quality of service) this defines the qos level at which messages are delivered the available options are 0 at most once 1 at least once 2 exactly once keepalivesecs the keep alive interval in seconds specifies how often the client will ping the broker to maintain the connection the default value is 30 seconds persistentsession if enabled , the mqtt broker will store the session information, ensuring that messages are delivered to the client even after reconnections after completing the configuration, click save measurement discovery & auto onboarding if enabled, the discovermeasurements setting allows the collector to automatically discover new measurements by parsing incoming messages discovered measurements are initially created in discovered status if autoonboard is enabled, the collector will automatically promote these to active status for instance, an incoming message for a non configured measurement will be automatically linked to a new measurement in the form of nameregexmatcher & nameregexreplaceby you can customize the automatically generated names for measurements using nameregexmatcher and nameregexreplaceby fields for example, you can use regular expressions to match the default names and replace parts of them with a custom naming convention expected outcome once configured, the collector will display a start button in the top right corner of the collector page click start to begin collecting data if the connection is successful, the collector will show a status of collecting troubleshooting for guidance on connection issues, status codes, and other collection problems, please refer to the page troubleshooting mqtt connections adding measurements best practices mqtt qos for most use cases, set the qos to 1 to ensure reliable message delivery avoid using qos 2 unless necessary, as it introduces additional overhead measurement naming conventions ensure a clear and consistent naming convention for metrics, edge nodes, and devices this will make it easier to track and identify metrics across multiple sparkplug b topics limits the mqtt sparkplugb collector can handle a large number of measurements and messages however, performance may be affected by the broker’s capacity and the complexity of the topic structure if performance issues arise, consider splitting measurements across multiple collectors or increasing hardware resources