Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
titleTransform with double metrics, with groups
collapsetrue
_metrics:
    -
        _groups:
            ${root}/*:
                _temp:
                    status: 
                        _text: "status"
                _tags:
                    name:
                        _text: "name"
                    "im.name":
                        _constant: "ntp-server-state"
                    "live-config":
                       _constant: "true"
                    "display-name":
                        _constant: "NTP Servers - State"
                    "im.dstype.displayType":
                        _constant: "state"
                    "im.identity-tags":
                        _constant: "name"
        _transform:
            _value.double: |
                {
                    if ("${temp.status}" == "synched") {print "1.0"} else {print "0.0"}
                }

If you want to try and grab information from a parent element, use ancestor, like here:

Code Block
_metrics:
    -
        _groups:
            ${root}/data-processors/*/second/cpu-load-average/entry:
                _value.double:
                    _text: value
                _temp:
                    coreid:
                        _text: "coreid"
                    dpid:
                        _name: ancestor::node()[3]
                _tags:
                    "im.name":
                        _constant: "cpu-usage"
                    "live-config":
                       _constant: "true"
                    "display-name":
                        _constant: "CPU Usage"
                    "im.dstype.displayType":
                        _constant: "percentage"
                    "im.identity-tags":
                        _constant: "cpu-id"
                    "cpu-is-avg":
                        _constant: "false"
        _transform:
            _tags:
                "cpu-id": |
                    {
                        print "${temp.dpid}: ${temp.coreid}"
                    }