Ad Widget

Collapse

Using Macros in Calculated Items

Collapse
This topic has been answered.
X
X
 
  • Time
  • Show
Clear All
new posts
  • adaker
    Junior Member
    • Feb 2020
    • 3

    #1

    Using Macros in Calculated Items

    I have a situation where I need to use a macro for a hostname in a calculated field. For example:

    Code:
    last(/{$HOST_NAME}/icmpping)
    I keep getting the following error.

    Code:
    Invalid parameter "/1/params": incorrect expression starting from "last(/{$HOST_NAME}/icmpping)".
    Am I doing this wrong, or is it not possible.

    Thanks in advance.
  • Answer selected by adaker at 31-03-2022, 20:41.
    cyber
    Senior Member
    Zabbix Certified SpecialistZabbix Certified Professional
    • Dec 2006
    • 4806

    Shortly.. no, you cannot use user macro in such place. Would it be a constant in math operation, then yes, but for pointing to some random server it is not going to work...

    Comment

    • cyber
      Senior Member
      Zabbix Certified SpecialistZabbix Certified Professional
      • Dec 2006
      • 4806

      #2
      Shortly.. no, you cannot use user macro in such place. Would it be a constant in math operation, then yes, but for pointing to some random server it is not going to work...

      Comment

      • PavelZ
        Senior Member
        • Dec 2024
        • 162

        #3
        This behavior is very strange, but I found that macros can be expanded by creating calculated items dynamically using LLD rules and using Javascipt .

        A small example is here: https://github.com/pavlozt/somezabbi...affic_7.0.yaml

        Comment

        Working...