Ad Widget

Collapse

Calculated field based on agent2 and mqtt

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • mario.in.dcstar
    Junior Member
    • Feb 2021
    • 5

    #1

    Calculated field based on agent2 and mqtt

    hello

    we get the power from our shelly devices with mqtt and agent 2 but when i want to make a calculated field for the current (power/voltage), than I get an error on the key from mqtt field
    name: current
    key: "mqtt.get["192.168.0.10:1883","shellies/power/3402/emeter/1/power"]".

    preprocessing: custom multiplier 0.1 (i know, just for this example)

    error: Item with key "mqtt.get["192.168.0.10:1883","shellies/power/3402/emeter/1/power"]" already exists on "System-10.21-PreProd". ====> that is the power measurement

    same concept with rest calls works

    any ideas what i am doing wrong?

    Mario
  • mario.in.dcstar
    Junior Member
    • Feb 2021
    • 5

    #2
    Hello cyber,


    I messed up my explanantion, sorry!
    Let me start again:

    1. power meassurement (via mqtt on agent go)

    type: Zabbix agent (active)
    Key: mqtt.get["192.168.0.10:1883","shellies/power/3402/emeter/1/power"]
    Type of info: Numeric (float)
    units: W


    2. current calculation

    type: calculated
    key: 3402current
    formula: last(mqtt.get["192.168.0.10:1883","shellies/power/3402/emeter/1/power"])/220
    ==> last('key ref')/220
    Type of info: Numeric (float)
    units: A


    ERROR: Invalid parameter "/1/params": incorrect calculated item formula starting from "last(mqtt.get["192.168.0.10:1883","shellies/power/3402/emeter/1/power"])/220".




    The working version with rest calls:

    1. power measurement (rest call)

    type: http agent
    Key: RSSI3405power
    URL: http://192.168.0.167/status

    preprocessing:
    JSONPath: $.body.emeters[1].power


    2. current calculation

    type: calculated
    Key: RSSI3405current
    Formula: last("RSSI3405power")/last("RSSI3405voltage")


    So if I am correct, the formula should contain the "Key" of the referenced fields ... correct?
    For the rest, that is a text but for mqtt/agent that is a request .


    Mario


    Comment

    • cyber
      Senior Member
      Zabbix Certified SpecialistZabbix Certified Professional
      • Dec 2006
      • 4807

      #3
      Where is the calculation in your calculated item? All I can see is trying to add a item named "current" with exactly same key as some other item already has... Preprocessing is not a "calculated item"...
      https://www.zabbix.com/documentation...pes/calculated

      Comment

      Working...