Ad Widget

Collapse

Calculated item to summarize data from discovery items

Collapse
This topic has been answered.
X
X
 
  • Time
  • Show
Clear All
new posts
  • ecce
    Junior Member
    • Jun 2023
    • 7

    #1

    Calculated item to summarize data from discovery items

    I have managed to create a discovery rule and item prospects that gets data via SNMP from Cisco switches. As an example I have allocated stackpower, four switches in a stack consumes about 243 watts each. The key for the item prospects is stackpower.allocated.[{#SNMPINDEX}].

    I want to sum() the values, in this case four of them, to a power consumption value for the whole switch stack. My plan was to use a calculated item for this. But the item keys has a macro in it, I'm not sure how to summarize the values in a dynamic range of items. How do I solve this?

    Running Zabbix 6.4 on Linux, no proxy, collecting data via SNMPv3.

    Thanks.
    Last edited by ecce; 08-06-2023, 20:46.
  • Answer selected by ecce at 08-06-2023, 20:13.
    cyber
    Senior Member
    Zabbix Certified SpecialistZabbix Certified Professional
    • Dec 2006
    • 4807

    sum(last_foreach(/*/stackpower.allocated.[*]?[group="your hostgroup"]))
    based on examples 1 and 2 here https://www.zabbix.com/documentation...ated/aggregate
    TBH, never tried, but if they work separately, why shouldn't they work combined... :/

    Comment

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

      #2
      sum(last_foreach(/*/stackpower.allocated.[*]?[group="your hostgroup"]))
      based on examples 1 and 2 here https://www.zabbix.com/documentation...ated/aggregate
      TBH, never tried, but if they work separately, why shouldn't they work combined... :/

      Comment

      • ecce
        Junior Member
        • Jun 2023
        • 7

        #3
        Originally posted by cyber
        sum(last_foreach(/*/stackpower.allocated.[*]?[group="your hostgroup"]))
        based on examples 1 and 2 here https://www.zabbix.com/documentation...ated/aggregate
        TBH, never tried, but if they work separately, why shouldn't they work combined... :/
        Worked perfectly! Thanks!

        Comment

        • Raoul_8
          Junior Member
          • Mar 2024
          • 3

          #4
          Hello, I am having a problem with making a calculated item in a discovery rule.

          I have a discovery rule for the filesystems.
          Now I want to make a forecast item, which calculates how much space is used 30 minutes later.

          This is the formula I have been using:
          forecast(//vfs.fs.dependent[{#FSNAME},pused],30d,30m)

          I get the following error:
          Cannot evaluate function: item "/{HOST}/vfs.fs.dependent[{#FSNAME},pused]" does not exist at "forecast(//vfs.fs.dependent[{#FSNAME},pused],30d,30m)".

          I am currently using Zabbix version 6.4.12

          Thanks in advance!!

          Comment

          • Hamardaban
            Senior Member
            Zabbix Certified SpecialistZabbix Certified Professional
            • May 2019
            • 2713

            #5
            How exactly is the item key written?
            /{HOST}/vfs.fs.dependent[{#FSNAME},pused] or //vfs.fs.dependent[{#FSNAME},pused]​ ?
            In “forecast​”, you need to use exactly the same as the key.

            Comment


            • Raoul_8
              Raoul_8 commented
              Editing a comment
              Thanks for the help.

              I already figured it out. It did not work in the test since I used {#FSNAME} but when I use C: or another drive it works.

              Sorry for my stupidity on this matter.

            • Hamardaban
              Hamardaban commented
              Editing a comment
              You're welcome
          Working...