Ad Widget

Collapse

Create calculated item based on multiple values

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • xmmm
    Junior Member
    • Sep 2014
    • 2

    #1

    Create calculated item based on multiple values

    All,

    I have 2 items collecting decimal data every minute. I am looking to create a calculated item to keep result of a calculation:

    (item1.last_value - item1.prev_value) / (item2.last_value - item2.prev_value)

    Or: item1.change() - item2.change()

    I searched several previous posts and tested many combinations but cannot make it work.

    Can someone please share?

    Thank you.
  • ingus.vilnis
    Senior Member
    Zabbix Certified Trainer
    Zabbix Certified SpecialistZabbix Certified Professional
    • Mar 2014
    • 908

    #2
    Hello and welcome!

    Please take a look at Zabbix documentation here: https://www.zabbix.com/documentation...pes/calculated
    There you may find useful information on calculated items and get yours to work.

    Best Regards,
    Ingus

    Comment

    • xmmm
      Junior Member
      • Sep 2014
      • 2

      #3
      I read the doc but it does not clearly describe why below usage is not accepted

      (last("key1",0)-last("key1",1))/(last("key2",0)-last("key2",1))

      As I tested, it seems that below syntax is accepted.
      last("key1",0)-last("key1",1)

      Any suggestions? Thank you.

      Comment

      • aib
        Senior Member
        • Jan 2014
        • 1615

        #4
        silly notes : try to add spaces around "/"
        like
        Code:
        (last("key1",0)-last("key1",1))[U] / [/U](last("key2",0)-last("key2",1))
        Sincerely yours,
        Aleksey

        Comment

        • karmukis
          Member
          • Aug 2014
          • 37

          #5
          Use external checks for calculated Items

          Hi,
          I know you asked for a different thing, but I was wondering, is it possible to create and "calculated item", using and external check???

          Because, in normal checks the "key" is just a name, but, in the external check, is becomes a formula....

          So... we try to create a calculated item and it didn't work... error: "can not evaluate function"

          Any help will be more than appreciated.

          thanks so much.

          karina costa

          Comment

          • ingus.vilnis
            Senior Member
            Zabbix Certified Trainer
            Zabbix Certified SpecialistZabbix Certified Professional
            • Mar 2014
            • 908

            #6
            Hi Karina,

            This is a complicated question with no real examples provided.
            Here are some directions I could point you to:
            • Data type of the original external scripts (text vs numreic) do not match
            • The returned data is not a number or contains some extra characters or something
            • Division by zero
            • Typo in the calculated formula itself
            • You modified the key of external check but did not update the calculated formula manually




            Hard to tell really. If you like, you can share a bit more detailed information about the actual item configurations (screenshots and item keys as text) so we can have a look and see if anybody has some ideas.

            Best Regards,
            Ingus

            Comment

            • karmukis
              Member
              • Aug 2014
              • 37

              #7
              Hi Ingus,
              thanks you for the answer, I´ll check the data and what I manage to do, be back with the results in some days.
              thanks!!

              karina

              Comment

              • emmanux
                Member
                Zabbix Certified Specialist
                • Mar 2013
                • 47

                #8
                Originally posted by xmmm
                I read the doc but it does not clearly describe why below usage is not accepted

                (last("key1",0)-last("key1",1))/(last("key2",0)-last("key2",1))

                As I tested, it seems that below syntax is accepted.
                last("key1",0)-last("key1",1)

                Any suggestions? Thank you.
                Did you tried inverting the terms?

                (last("key2",0)-last("key2",1))/(last("key1",0)-last("key1",1))

                Can you provide a real example?

                Comment

                Working...