Examples
Basic Scenarios
Scenario 1: Get the last value of tags every 60 seconds
Set sample and send parameters.
Set pollingInterval < sendOut time to ensure that all uploads 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
Check the result.
The message group will send the following message to the target every 60 seconds.
{
"cpuUsage": 12,
"memoryUsage": 51
}
Scenario 2: Get all values of tags every 60 seconds
Set sample and send parameters.
- Set pollingInterval = 0 to enable subscribe mode to subscribe to all tags published from origin.
- Set send out time = 60 to publish the message every 60 seconds.
Select tags.
Update the format.
default format already includes an array for each tag to store all values.
Here is another format to reduce the message size.
Format:
{
(.srcName+"_"+.tagName): [
.dataValue
]
}Check the result.
The message group will send the following message to the target every 60 seconds.
{
"status_cpuUsage": [
11,
9
],
"status_memoryUsage": [
51,
51
]
}
Advanced Scenarios
Calculating values from data
- Example
tag:format:
{
"dataType": "uint64",
"dataValue": 11,
"prvdName": "system",
"srcName": "status",
"tagName": "cpuUsage",
"ts": 1581659603000000
}result:{
value: ( .dataValue + 1000 )
}{
"value": 1011
}
- Example
tag:
Using conditionals
- Example
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
}
- Example
tag:
Last updated on 2022-07-22 by Cecilia Fernandes