Message Group Examples
Scenario 1: Get the last value of tags every 60 seconds
sampling and sending parameter
set pollingInterval < sendOut time to ensure that every upload will be sampled at least once
select tags
update format format:
{
(.tagName): .dataValue
}- because we only need last values of tags every 60 seconds, so you may not need array to buffer values of tags
- Each tagName's value will be overwritten by the last value
result
The message group will send below message to target every 60 seconds.
{
"cpuUsage": 12,
"memoryUsage": 51
}
Scenario 2: Get all values of tags every 60 seconds
sampling and sending parameter
- set pollingInterval = 0 to enable subscribe mode to subscribe all tags that published from origin.
- set send out time = 60 to publish message every 60 seconds.
select tags
update format
default format already includes an array for each tags to store all values
Here is another format to reduce message size
format:
{
(.srcName+"_"+.tagName): [
.dataValue
]
}result
The message group will send below message to target every 60 seconds.
{
"status_cpuUsage": [
11,
9
],
"status_memoryUsage": [
51,
51
]
}
Advance JQ Example
- math
- example1
tag:format:{
"dataType": "uint64",
"dataValue": 11,
"prvdName": "system",
"srcName": "status",
"tagName": "cpuUsage",
"ts": 1581659603000000
}result:{
value: ( .dataValue + 1000 )
}{
"value": 1011
}
- example1
- conditionals
- example1
tag:format:
{
"dataType": "uint64",
"dataValue": 11,
"prvdName": "system",
"srcName": "status",
"tagName": "cpuUsage",
"ts": 1581659603000000
}result:{
stable: ( if .dataValue > 80 then false else true end )
}{
"stable": true
}
- example1
tag:
Last updated on 2021-05-03 by Zack YL Shih