See www.zabbix.com for the official Zabbix site.

Docs/specs/ZBXNEXT-1

From Zabbix.org
Jump to: navigation, search

Referencing item values in graph titles

ZBXNEXT-1

Status: v1.2

Owner: Alexei & Sasha

Summary

Currently there is no way to show item values in graph titles. Common use case - referencing ifAlias in the title.

Specification

Referencing item values in graph titles will be possible using standard macro syntax:

 {host:key.func(param)}

or

 {{HOST.HOST}:key.func(param)}
 {{HOSTNAME}:key.func(param)}

or

 {{HOST.HOST<1..9>}:key.func(param)}
 {{HOSTNAME<1..9>}:key.func(param)}

Low Level Discovery (LLD)

LLD macros could also be used as a parameter to item key, for example:

 {Cisco switch:ifAlias[{#SNMPINDEX}].last(0)}

This macro will be expanded to, say, {Cisco switch:ifAlias[Port001].last(0)} for a real graph created by LLD rule.

Details

  • Similarly to map elements, only functions last(), avg(), max() and min() with seconds as arguments will be supported.
  • Graph can contain items from multiple hosts. In this case host of first item can be referenced using {HOST.HOST}, {HOSTNAME}, {HOST.HOST1} or {HOSTNAME1}, second - {HOST.HOST2} or {HOSTNAME2}, etc.
  • Macro will be substituted by string '*UNKNOWN*' in case of (1) incorrect host or item (2) function cannot be evaluated.
  • Value mapping should be resolved
  • Item units should be used

API changes

  • graph.get
    • Additional parameters
      • expandName - flag, expand macros in the graph name;

Documentation

  • Update macro page
  • Update what's new
  • API graph.get method

Test cases

  • Use macro in a graph on a host
  • Use macro in a templated graph on a template
  • Use macro in a templated graph on a host
  • Use macro in graph prototypes
  • Use incorrectly defined macros
    • Wrong host name
    • Wrong item key
    • {HOST.HOST5} on a graph with 3 items
    • Incorrect function name
    • Correct but unsupported function name

ChangeLog

  • v1.1
    • added {HOSTNAME} macro
  • v1.2
    • added API documentation