Ad Widget

Collapse

Calculated items and mathematical power function

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • eric_at_2037
    Junior Member
    • May 2008
    • 12

    #1

    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
  • brunohl
    Senior Member
    Zabbix Certified Specialist
    • Mar 2019
    • 215

    #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

    • eric_at_2037
      Junior Member
      • May 2008
      • 12

      #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

      • eric_at_2037
        Junior Member
        • May 2008
        • 12

        #4
        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

        • kloczek
          Senior Member
          • Jun 2006
          • 1771

          #5
          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

          Working...