Ad Widget

Collapse

Graphs on dependent discovery items

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • cstackpole
    Senior Member
    Zabbix Certified Specialist
    • Oct 2006
    • 225

    #1

    Graphs on dependent discovery items

    Greetings,
    While I use Zabbix heavily, recently I've been able to just use the amazing community templates for everything. Well, I just got some new gear in and not finding what I need so I'm crafting my own. This new gear spits out data from Prometheus. I used this excellent blog post [1] to build an HTTP agent item from which I built item prototype under discovery. Worked like a champ! Sub-30 minutes and I had the first items poling in. Just to keep in theme with that blog post (and not confuse the issue with the items I'm monitoring), my template is pulling in data from the low level discovery rule using the equivalent of:
    Code:
     {#METRIC}{device="{#DEVICE}"}
    Great! Now I've got all these individual items in my latest data. But, that's really not useful to me. What would be useful, however, is if I had the sum of the latest. Now, I kinda hacked this together in a graph where I pulled in each individual item, but not only is that really laborious but it would break every time one of these items changes, removes, adds, ect. What I want is a graph that is the equivalent of "add all the last values of known items together and display that as a graph with history". I tried Aggregate checks, but I'm just not getting data. Sticking with the blog theme, I did a grpsum["Prometheus", Total, last, 0] with nothing returned. I tweaked it to match the MACRO definitions but got an error "No items for key "Total in groups {#METRIC}".

    I tried creating graph prototypes, but all of them failed except for creating a single graph per item, which is not at all what i want and is duplicate from just going to the Latest Data.

    I did some online searching, but nothing has come up that has worked for me under Zabbix 4.4.4. I've now been trying for twice as long as it took to pull the metrics in and so I figured it was time to ask for help.

    Can someone help point me in the right direction to get a single sum graph of all the discovered items, please?
    Thanks!

    [1] https://blog.zabbix.com/zabbix-4-2-p...egration/7558/
    Dmitry Lambert, Zabbix Certified Expert & Trainer In latest release of Zabbix prometheus integration is available out of the box. It allows us to easily collect and parse metrics from collector…
  • Semiadmin
    Senior Member
    • Oct 2014
    • 1625

    #2
    Hi, cstackpole!
    You can convert Prometheus to JSON and create a dependent LLD rule via JSONPath. Great! Now just create a dependent item alongside this dependent LLD rule using the same JSONPath with the sum function at the end.

    Comment

    • cstackpole
      Senior Member
      Zabbix Certified Specialist
      • Oct 2006
      • 225

      #3
      Thanks for responding Semiadmin.
      Sorry, but I don't understand and I'm not finding any documentation on functions inside the dependent LLD.

      Since I have a LLD item working, I cloned that and adjusted the name/item to not be a duplicate. Then under the Preprocessing where I have "Prometheus to JSON" and its paremeters, no form of sum works here without me getting a "incorrect value for field Params" error. Even what I believe should be valid to Prometheus expressions. Sticking with the blog it was the equivalent of
      Code:
      sum (node_network_transmit_bytes_total{device=~".*"})
      that I found in the Prometheus documentation.

      I'm sure that I'm getting closer, but I'm just not finding quite the right order on it.

      Thanks!

      Comment

      • Semiadmin
        Senior Member
        • Oct 2014
        • 1625

        #4
        I think you misunderstood me, cstackpole.
        I didn't mean the PromQL function sum, I meant the JSONPath function sum: Sum of numbers in the input array.

        I didn't suggest to do anything with the dependent LLD rule or its item prototypes also. I think you need a dependent item (not a prototype) for summarization from the same HTTP agent item.

        Comment

        • cstackpole
          Senior Member
          Zabbix Certified Specialist
          • Oct 2006
          • 225

          #5
          Beautiful! Oh yeah! That was spot on what I was missing. I was making it too complicated being a discovery for that instead of an item.
          I also imported the Prometheus template [1] just to see how it worked and had already been kinda putting the picture together but it wasn't quite complete. You gave me the hint needed for all the pieces to fall together. I've just made huge strides in pulling in items. I'm sure I will have more questions as I progress with the many items available to me, but this was exactly what I needed to get going. Thank you so much!!

          [1] https://www.zabbix.com/integrations/prometheus

          Comment

          Working...