ZABBIX BUGS AND ISSUES

macros are not scoped

Details

  • Zabbix ID:
    Reviewed 2.0

Description

when you have a macro used in
templateA with name CLUSTER and define a value also in this template like {$CLUSTER} => cA
templateB with name CLUSTER and define a value also in this template like {$CLUSTER} => cB

and use templateA and templateB in the same Host,
you have only the value from TemplateA

it means the the Macro's are global even they are defined only in templates

Activity

Hide
richlv added a comment -

hmm. i don't understand the problem really.
if you define the same macro in two templates of the same level that are linked to same host, quite obviously the resolving of the macro is a bit undefined.

1. what do you mean by "the Macro's are global even they are defined only in templates" ?

2. how would you expect for this to behave ?

Show
richlv added a comment - hmm. i don't understand the problem really. if you define the same macro in two templates of the same level that are linked to same host, quite obviously the resolving of the macro is a bit undefined. 1. what do you mean by "the Macro's are global even they are defined only in templates" ? 2. how would you expect for this to behave ?
Hide
Thomas Spengler added a comment - - edited

I have

HOST
– Template A
---- Macro CLUSTER = cA
---- Value of CLUSTER inside the Template == cA
– Template B
---- Macro CLUSTER = cB
---- Value of CLUSTER inside the Template == cA

you see the problem

I would expect a nearest wins behaviour

e.g.

HOST
– Template A
---- Macro CLUSTER = cA
---- Value of CLUSTER inside the Template == cA
– Template B
---- Macro CLUSTER = cB
---- Value of CLUSTER inside the Template == cB

or

HOST
– Macro CLUSTER = cA
– Template A
---- Value of CLUSTER inside the Template == cA
– Template B
---- Macro CLUSTER = cB
---- Value of CLUSTER inside the Template == cB
– Template C
---- Value of CLUSTER inside the Template == cA

Show
Thomas Spengler added a comment - - edited I have HOST – Template A ---- Macro CLUSTER = cA ---- Value of CLUSTER inside the Template == cA – Template B ---- Macro CLUSTER = cB ---- Value of CLUSTER inside the Template == cA you see the problem I would expect a nearest wins behaviour e.g. HOST – Template A ---- Macro CLUSTER = cA ---- Value of CLUSTER inside the Template == cA – Template B ---- Macro CLUSTER = cB ---- Value of CLUSTER inside the Template == cB or HOST – Macro CLUSTER = cA – Template A ---- Value of CLUSTER inside the Template == cA – Template B ---- Macro CLUSTER = cB ---- Value of CLUSTER inside the Template == cB – Template C ---- Value of CLUSTER inside the Template == cA
Hide
richlv added a comment -

so you mean both templates are linked to the host directly ?
if so, there is no way to determine "nearest" one

Show
richlv added a comment - so you mean both templates are linked to the host directly ? if so, there is no way to determine "nearest" one
Hide
Thomas Spengler added a comment -

yes, both are linked to the same host,

but the items are in different templates

Show
Thomas Spengler added a comment - yes, both are linked to the same host, but the items are in different templates
Hide
Thomas Spengler added a comment -

my expected behavior is also

HOST
– Template A
---- Macro CLUSTER = cA
---- Value of CLUSTER inside the Template == cA
– Template B
---- Macro CLUSTER = cB
---- Value of CLUSTER inside the Template == cB
– Template C
---- NO MACRO defined
---- Value of CLUSTER inside the Template == {$CLUSTER}

Show
Thomas Spengler added a comment - my expected behavior is also HOST – Template A ---- Macro CLUSTER = cA ---- Value of CLUSTER inside the Template == cA – Template B ---- Macro CLUSTER = cB ---- Value of CLUSTER inside the Template == cB – Template C ---- NO MACRO defined ---- Value of CLUSTER inside the Template == {$CLUSTER}
Hide
richlv added a comment -

i don't fully understand your schematics, but i'll try describing the problem as i might have understood it

if two templates that contain the same macro are linked to single host on the same level, you expect items from each template to use macro value from the same template.

is that correct ?

if so, what happens in nested configuration, where normally lower level template would override values coming from a higher level template ?

Show
richlv added a comment - i don't fully understand your schematics, but i'll try describing the problem as i might have understood it if two templates that contain the same macro are linked to single host on the same level, you expect items from each template to use macro value from the same template. is that correct ? if so, what happens in nested configuration, where normally lower level template would override values coming from a higher level template ?
Hide
Thomas Spengler added a comment -

That is my misunderstanding

I expect, that lower level template overwrites it's values, BUT only for them self and not for all others.

Show
Thomas Spengler added a comment - That is my misunderstanding I expect, that lower level template overwrites it's values, BUT only for them self and not for all others.

People

Vote (1)
Watch (1)

Dates

  • Created:
    Updated:
    Resolved: