Ad Widget

Collapse

LLD Macro usage in calculated item prototype

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • VACOM
    Junior Member
    • Jun 2013
    • 2

    #1

    LLD Macro usage in calculated item prototype

    Hello Zabbix Friends,

    I have a problem using calculated item prototypes in low level discovery.

    Here it is:


    # LLD is defined to read OID .1.3.6.1.2.1.43.11.1.1.5 with key prtMarkerSuppliesType.Discovery

    As expected {#SNMPINDEX} is e.g. "1.1".
    That works fine.

    # One item prototype is in key prtMarkerSuppliesLevel.["{#SNMPINDEX}"]
    That works fine.

    # The calculated item prototype is defined as:

    key=calc_Toner_Usage.["{#SNMPINDEX}"]
    formula=last("prtMarkerSuppliesLevel.[\"{#SNMPINDEX}\"]")

    Note: the formula is just for testing purposes

    so far so good. But: the formula can not be evaluated on the host.
    But why?

    Does anyone have an idea?

    I am using Zabbix 2.1.0.

    Thank you.
    Jan (VACOM)
  • VACOM
    Junior Member
    • Jun 2013
    • 2

    #2
    solved! function last() expected parameter.

    Comment

    • Navern
      Member
      • May 2013
      • 33

      #3
      My 2 cents, it should be in following view

      last(key.[{#SNMPINDEX}], 0)

      without this "0" as second argument calculated items don't work. It's not related to LLD.

      Comment

      • aib
        Senior Member
        • Jan 2014
        • 1615

        #4
        and my formula for Toner usage Item Prototype from LLD is:
        Formula: 100*last(current_capacity.alt.["{#SNMPVALUE}"])/last(total_capacity.alt.["{#SNMPVALUE}"])
        Sincerely yours,
        Aleksey

        Comment

        • Navern
          Member
          • May 2013
          • 33

          #5
          Originally posted by aib
          and my formula for Toner usage Item Prototype from LLD is:
          Formula: 100*last(current_capacity.alt.["{#SNMPVALUE}"])/last(total_capacity.alt.["{#SNMPVALUE}"])
          In zabbix 2.2 if you don't use it like 100*last(current_capacity.alt.["{#SNMPVALUE}"], 0)/last(total_capacity.alt.["{#SNMPVALUE}"], 0) it won't work. Correct me if i wrong.

          And it's recommended that you use it like this according to official documentation:
          100*last("current_capacity.alt.[\"{#SNMPVALUE}\"]", 0)/last("total_capacity.alt.[\"{#SNMPVALUE}\"]", 0)

          Comment

          • aib
            Senior Member
            • Jan 2014
            • 1615

            #6
            It works in 2.2.3 - see attached screenshots.
            Attached Files
            Sincerely yours,
            Aleksey

            Comment

            • Navern
              Member
              • May 2013
              • 33

              #7
              I have zabbix 2.2.1 and it wasn't working without second argument(it had given me much pain because of this).

              Ok, it looks like it was fixed somehow

              Comment

              Working...