What is this?

This knowledgebase contains questions and answers about PRTG Network Monitor and network monitoring in general.

Learn more

PRTG Network Monitor

Intuitive to Use. Easy to manage.
More than 500,000 users rely on Paessler PRTG every day. Find out how you can reduce cost, increase QoS and ease planning, as well.

Free Download

Top Tags


View all Tags

(MQTT) Filter by Key specified in JSON response

Votes:

0

Hello, thank you for receiving my query. I have a signal hub that receives measurements from many sensors (temperature, humidity, signal and battery), this hub sends the data to the Broker's MQTT queue (all data is in a single JSON). I try to filter each sensor by mac but I don't know the language... as an example I get messy information using: $[1].temperature, $[1].humidity, $[1].rssi and $[1].battery ( but the sensor that displays it is unknown). The JSON in question is as follows: (I want to obtain the values ​​of the 4 measurements for the sensors "AC233FA2110B" and "AC233FA2111A"...)

[{"timestamp":"2022-10-14T13:21:19Z","type":"S1","mac":"AC233FA2110B","bleName":"","rssi":-66,"battery ":100,"temperature":-6.63,"humidity":75.17},{"timestamp":"2022-10-14T13:21:20Z","type":"S1","mac":"AC233FA2111A" ,"bleName":"","rssi":-78,"battery":100,"temperature":8.08,"humidity":59.96},{"timestamp":"2022-10-14T13:21:22Z" ,"type":"S1","mac":"AC233FA2111A","bleName":"","rssi":-81,"battery":100,"temperature":8.08,"humidity":59.96}, {"timestamp":"2022-10-14T13:21:22Z","type":"S1","mac":"AC233FA2110B","bleName":"","rssi":-65,"battery" :100,"temperature":-6.63,"humidity":75.17},{"timestamp":"2022-10-14T13:21:23Z","type":"S1","mac":"AC233FA2111A", "bleName":"","rssi":-79,"battery":100,"temperature":8.04,"humidity":60.41}]

I have not been able to filter by devices independently. I hope you can help me, I am grateful.

json mqtt prtg

Created on Oct 18, 2022 9:59:36 PM

Last change on Oct 19, 2022 6:31:33 AM by  Felix Wiesneth [Paessler Support]



2 Replies

Votes:

0

Hi rorropon,

I'm afraid it is not possible to filter them according to the mac. I would recommend to create for each mac a new sensor. The mac information can be displayed as sensors message. For this you need to enter the path in option Sensor Message JSON Path under MQTT specific. This will allow you to display the mac and for all other values you can enter the paths to the channel fields. To find the right paths I would recommend to use JSONPathfinder.


Kind regards

Felix Wiesneth - Team Tech Support

Created on Oct 20, 2022 10:46:18 AM by  Felix Wiesneth [Paessler Support]



Votes:

0

Hi Felix,

Sensor name: AC233FA2110B
Sensor Message JSONPath: $[*].mac
Channel #1 JSONPath: $[*].temperature

Result:
"The received value is an array instead of a single value. Array size is: 3 Channel 1: The received value is an array instead of a single value. Array size is: 2"

It is important to mention that within the JSON the results are out of order, that is, the arrival of the macs is random. Example, at time 0 the mac=AC233FA2110B comes in the first position of the JSON and at time 1 it can come in the second position of the JSON. For the above I do not use $[1].mac

Created on Oct 20, 2022 12:03:35 PM

Last change on Oct 20, 2022 12:03:35 PM




Disclaimer: The information in the Paessler Knowledge Base comes without warranty of any kind. Use at your own risk. Before applying any instructions please exercise proper system administrator housekeeping. You must make sure that a proper backup of all your data is available.