[SOLVED] Display services dynamically according to host name

This forum was archived to /woltlab and is now in read-only mode.
  • Hi all,


    I recently started using @Mikesch's Icingaweb2 x Grafana module. Everything works fine, but I have a question about displaying services.


    First, some background. I have multiple switches, firewalls, NAS units, etc. and am monitoring all of their interfaces. I graphed them all in Grafana, and now I want to show individual graphs for each interface in Icingaweb. I'm very close, but came across one bump in the road. See the following example:



    So, here is an example of what I have so far. As you can see, I'm currently looking at one of the services for my Cisco Catalyst switch, but my graph displays for my Buffalo NAS Unit. This is because the Buffalo NAS Unit is at the top of the list in Grafana:



    However, you can see that the Service is dynamically assigned (Port 0/1), and part of what I want. Therefore, Mike's module dynamically assigns the Service, but not the Host. Is there a way around this so that it can display the Port 0/1 graph for my Cisco Catalyst switch, and overall, dynamically show graphs for individual services?


    Here's my current configs:


    Code: /etc/icingaweb2/modules/grafana/graphs.ini
    1. [Port]
    2. dashboard = "SwitchDashboard"
    3. panelId = "1"
    4. orgId = "1"
    5. repeatable = "no"

    Also, I'm using the v1.1.10 Grafana module. I could also show my Grafana templating configs for my "SwitchDashboard" but I think that is irrelevant.


    Thanks in advance!

  • You need to set the templating variables in the graph like this:


    Then the title of the graph should be fine

  • Interesting, thanks!


    Before, I had it like:

    $hostdisplayname - $service


    I first tried it without the hyphen (to try to make it work with the host display name instead of the hostname), but that didn't work. When I changed it to the $hostname $service configuration, it worked.

    However, this raises a question; would people want to use the host display name like this ($hostdisplayname $service)? Personally, it would be nice, although not necessary. Perhaps I'll make a feature request.


    Update: here's my feature request on github: https://github.com/Mikesch-mp/…module-grafana/issues/109