Ad Widget

Collapse

Mathematical operators in JSONpath preprocessing

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • troffasky
    Senior Member
    • Jul 2008
    • 567

    #1

    Mathematical operators in JSONpath preprocessing


    I have three items that work as JSONpath preprocess:

    $.tcp_statistics.connections_opened
    $.udp_statistics.connections_opened
    $.icmp_statistics.connections_opened

    https://www.zabbix.com/documentation..._functionality says we have some numerical operators.

    So I tried this:

    $.icmp_statistics.connections_opened + $.tcp_statistics.connections_opened + $.udp_statistics.connections_opened

    but:

    1. Failed: cannot extract value from json by path "$.icmp_statistics.connections_opened + $.tcp_statistics.connections_opened + $.udp_statistics.connections_opened": unsupported construct in jsonpath starting with: " + $.tcp_statistics.connections_opened + $.udp_statistics.connections_opened"

    It's not clear from the examples if what I am trying to do is supported. The only example with a mathematical operator in returns a string!
  • Markku
    Senior Member
    Zabbix Certified SpecialistZabbix Certified ProfessionalZabbix Certified Expert
    • Sep 2018
    • 1781

    #2
    I think they can only be used in filter expressions.

    If you have three items and you want sum of those, you can create a calculated item and sum them there.

    Markku

    Comment

    • troffasky
      Senior Member
      • Jul 2008
      • 567

      #3
      Yet another Zabbix feature that is about 90% of the way to being useful for me I was trying to avoid having 4 items.

      Comment

      • Markku
        Senior Member
        Zabbix Certified SpecialistZabbix Certified ProfessionalZabbix Certified Expert
        • Sep 2018
        • 1781

        #4
        If those three pieces of data are from a single master item and you don't need them separately, you can use javascript preprocessing step to parse and sum them, to return and save just the single value.

        Markku

        Comment

        Working...