Skip to main content
Version: 2.2.1

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

    mg-overview

  • select tags mg-overview

  • 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

    mg-overview

  • 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.

    mg-overview

  • select tags mg-overview

  • 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:
      {
      "dataType": "uint64",
      "dataValue": 11,
      "prvdName": "system",
      "srcName": "status",
      "tagName": "cpuUsage",
      "ts": 1581659603000000
      }
      format:
      {
      value: ( .dataValue + 1000 )
      }
      result:
      {
      "value": 1011
      }
  • conditionals
    • example1 tag:
      {
      "dataType": "uint64",
      "dataValue": 11,
      "prvdName": "system",
      "srcName": "status",
      "tagName": "cpuUsage",
      "ts": 1581659603000000
      }
      format:
      {
      stable: ( if .dataValue > 80 then false else true end )
      }
      result:
      {
      "stable": true
      }

Last updated on 2021-05-03 by Zack YL Shih