Ad Widget

Collapse

Calculated items and mathematical power function

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Calculated items and mathematical power function

    Hello Zabbix users, guru and creator,

    In a discovery context, I need complexes rules to manage sensors.

    I have two items, the first one is the value, the second one is the decimal digit (The sensor reading as a signed integer. The value of this OID variable should be scaled by externalSensorDecimalDigits. For example, if the value is 1 and externalSensorDecimalDigits is 2, then actual value is 0.01).

    Exemple:
    Item1: 23323
    Item2: 2
    Real value that I need to store in the database: 233.23

    The mathematical operation to apply is: item1 / 10^item2 (23323/10^2) = 233.23

    Any idea to perform this operation in a simple way with Zabbix?

    Thank you for your help on this topic.

    Regards,
    Eric
    Last edited by eric_at_2037; 04-09-2019, 07:45. Reason: Fix tipo

    #2
    I'm not aware of a way to do it simple. Zabbix now support Javascript pre-processing, so maybe you could use Zabbix 4.2 and try it.

    Comment


      #3
      Thanks for your reply Bruno.

      I accordance with the doc (https://www.zabbix.com/documentation...ing_javascript), it seems it's no possible to manipulate multiple values.

      Comment


        #4
        You only need to use javascript on Item2 (implement pow function) and store Item2 not as 1, 2, 3... but 10, 100, 1000....

        From your example:
        new_item2 = pow (10, value) = 100

        The mathematical operation will be: item1 / new_item2 (For this you can use calculated item)
        (23323/100) = 233.23

        Comment


          #5
          Thank you for sharing your knowledge splitek.

          The JS solution in my case :
          return (Math.pow(0.1, value))

          item1 / 10^item2 == item1 * 0.1^item2

          Comment


            #6
            BTW it is only about multiplying about staic values like 10, 100, 1000 and so on it is easier to use custom multiplier as filter.
            This will cause not waste time on calculatin on 10^n each time when new value will pass over zabbix stack.
            http://uk.linkedin.com/pub/tomasz-k%...zko/6/940/430/
            https://kloczek.wordpress.com/
            zapish - Zabbix API SHell binding https://github.com/kloczek/zapish
            My zabbix templates https://github.com/kloczek/zabbix-templates

            Comment


              #7
              Originally posted by kloczek View Post
              BTW it is only about multiplying about staic values like 10, 100, 1000 and so on it is easier to use custom multiplier as filter.
              This will cause not waste time on calculatin on 10^n each time when new value will pass over zabbix stack.
              And how do you use Custom multiplier to change function "multiply" to the "power"?

              Comment

              Announcement

              Collapse
              No announcement yet.
              Working...
              X