Ad Widget

Collapse

Count the number of Items with the same value inside a Group

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Giacomo
    Junior Member
    • Dec 2020
    • 14

    #1

    Count the number of Items with the same value inside a Group

    Hi All!

    I'm playing with Calculated Item to count the number of Items (with the same name = exstreamingStreamNumber) inside a Group that have value =1.

    I can count the Items with this:
    item_count(/*/exstreamingStreamNumber?[group="Exstreamer"])

    But, how to specify the value of the Item?
    Is this the right way to count the number of Items inside a Group that match a value?

    Thank you!
  • Brambo
    Senior Member
    • Jul 2023
    • 245

    #2
    First of all, you say you want item values but then later you say the amount of items?
    Both can't be in 1 item.
    If you want the sum of all item values matching your expression use a calculated item with sum(last_foreach(<expression>))

    Comment

    • Giacomo
      Junior Member
      • Dec 2020
      • 14

      #3
      Hi Brambo,

      thanks for answering... I try to explain better using my Dashboard (below).
      Here are reported my hosts.
      I want to count how many hosts have the key StreamNumber = 3.
      I've tried with Aggregate Functions with no luck.

      Click image for larger version

Name:	immagine.png
Views:	649
Size:	132.1 KB
ID:	482825​​
      Attached Files

      Comment

      • Brambo
        Senior Member
        • Jul 2023
        • 245

        #4
        I understand what you want.
        And this is maybe possible when the items are discovered by LLD, not sure though.
        As the item count function cant filter on item value, but it can on tags.
        What you could test in a LLD rule is to set the item TAG with a value. Then you could write the calculated item with ?[tag="tagname:3"] I'm only not really certain if the tags are overwritten every time.
        Otherwise triggers is the route to go but then you can only show it as a problem and I guess you are not looking for that.

        Comment

        Working...