Generic JSON Messages
The MQTT collector can be configured to parse generic JSON messages and extract measurements from them. The measurements are extracted using JSONPath expressions.
Measurement settings
The measurement settings reflect the configuration possibilities for mapping a JSON message. The values are extracted from the messages using JSONPath.
JSONPath documentation can be found
here
,
jsonpath.com
is a useful tool to test JSONPath expressions.
The path expressions can either yield a single value, or a list of values. The expressions for the timestamp(s), status(es), and tags and values have to either yield the same amount of results as the expression for the Measurement(s), or only a single value, in which case that single value will be used for all found measurements.
Topic
Description: The topic to listen to. When the topic is specified here, it will override the topic that was set in the collector.
Required: No
MeasurementPath
Description: The json path that leads to a value, or a list of values in the message
Required: Yes
TimestampPath
Description: The json path that leads to a timestamp, or a list of timestamps in the message
Required: No
StatusPath
Description: The json path that leads to a status, or a list of statuses in the message. If not set, status will default to ‘Good’
Required: No
TagNamesAndTagValuePaths
Description: Map describing tags, where keys are the tag names, and the values are the json paths of the tag values
Required: No
TimestampLayout
Description: The default layout of the timestamp of the measurements, if empty RFC3339 will be used, if timestamp are in UNIX format one of [‘UNIX’, ‘UNIXMILLIS’, ‘UNIXMICROS’, ‘UNIXNANOS’] can be used. More info:
https://pkg.go.dev/time#Layout
Required: No