Ad Widget

Collapse

LLD macro in calculated item formula

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • zabbixuserfk
    Member
    • Apr 2020
    • 37

    #1

    LLD macro in calculated item formula

    Hi,

    I'm on Zabbix 5.0 and I'm trying to use a LLD macro in calculated item prototype formula like this.

    1. First I have a rather simple calculated item with the key "calculated.ldap.services", which returns a float representing the states of the LDAP services on a the host. 1 means they are all ok, less than 1 means that some of them are down.

    2. Then I created a discovery rule which is an external check that gives the following json (I've changed the real values for security issue) :
    Code:
    [{"{#NOMINST}":"XXXXXX","{#NOMSERVEUR}":"masterserver.krj.gie","{#NOMLOG}":"ForgeRock DS Ldap","{#VERLOG}":"ForgeRock DS Ldap 7.1","{#ENV}":"D","{#OS}":"Red Hat Entreprise Linux","{#TMOVAL1}":"55555","{#TMOVAL2}":"backupserveur.krj.gie","{#TMOVAL3}":"XXXXXX","{#TMOVAL4}":"","{#TMOVAL5}":"","{#COULOIR}":""}]
    3. Then, I have a calculated item protoype named "Sum of the LDAP services states on the active/passive couple {#NOMSERVEUR}/{#TMOVAL2}" in english with the key "ldap.pra.[{#NOMSERVEUR}]" and with the following formula, where {#TMOVAL2} is the backup host :
    Code:
    last("{#NOMSERVEUR}:calculated.ldap.services")+last("{#TMOVAL2}:calculated.ldap.services")

    The LLD macros seem to be correctly interpreted in the name or the key of the item prototype, but not in the formula since I have this error :
    Code:
    [COLOR=#c0392b]Cannot update item, error in formula: Invalid first parameter "{#NOMSERVEUR}:calculated.ldap.services".[/COLOR]
    Yet, the documentation of Zabbix 5.0 says the LLD macros are supported in calculated item formula (see attachment)

    Can you explain why this isn't working please ?

    A test calculated item on one of the hosts with the following formula returns the desired value by the way :
    Code:
    last("masterserver.krj.gie:calculated.ldap.services")+last("backupserveur.krj.gie:calculated.ldap.services")
    Attached Files
  • zabbixuserfk
    Member
    • Apr 2020
    • 37

    #2
    Any idea please ?
    I can provide more information if necessary of course.

    Comment

    • zabbixuserfk
      Member
      • Apr 2020
      • 37

      #3
      Hello,
      FYI, I've tried also with this syntax but the error is still the same, and the macros don't seem to be interpreted in the formula :

      Code:
      last("[\"{#NOMSERVEUR}\"]:calculated.ldap.services",0)+last("[\"{#TMOVAL4}\"]:calculated.ldap.services",0)
      Cannot create item, error in formula: Invalid first parameter "["{#NOMSERVEUR}"]:calculated.ldap.services".

      Comment

      Working...