Grafana newbie and first time poster here. Using grafana 8.5.10.
My DDG/google foo is failing me at the moment. I can’t seem to find anything close enough to adopt or hints as to what solution to look for.
I am trying to build a dashboard to monitor switch port LACP load-balancing.
For this I have a query that generates a list of connected hosts with the switches and ports this host is connected to. This table is actually generated from a mariadb database using SQL. Something like
I’d like to be able to select 1 host from a list and have some stacked (to 100%) traffic graphs of all ports for that server in a dashboard.
For server1 this would be a stacked graph of ports Ethernet3 and Ethernet4 on sw1
For server2 this would be a stacked graph of port Ethernet10 on sw2 and port Ethernet11 on sw5
Any examples, pointers, hints, tips, etc. appreciated.
I did manage to cobble something together in a way that is very rigid and depends on way to many external factors IMO.
All graphs are graphs are set to stacked
This uses a query for the storage node (host) drop-down and four more queries based on storage node to select switch1, port1 switch2 and port2 as separate variables. See below.
I am looking to make everything more flexible. For example by setting switch1 and port1 from the same query. A way to dynamically handle more the number of interfaces would also be nice.
-- $ports (storage node drop-down) [visible]
SELECT SUBSTRING_INDEX(p.ifAlias, ' ',-1) FROM ports AS p JOIN devices AS sw ON p.device_id = sw.device_id WHERE sw.hostname like 'storage-sw%' AND p.ifName like 'Ethernet%' AND p.ifAlias like '% storage%';
-- $switch1 [hidden]
SELECT sw.hostname FROM ports AS p JOIN devices AS sw ON sw.device_id = p.device_id WHERE p.ifName like 'Ethernet%' AND p.ifAlias LIKE "%$ports%" ORDER BY p.port_id ASC LIMIT 1;
-- $port1 [hidden]
SELECT p.ifName FROM ports AS p JOIN devices AS sw ON sw.device_id = p.device_id WHERE p.ifName like 'Ethernet%' AND p.ifAlias LIKE "%$ports%" ORDER BY p.port_id ASC LIMIT 1;
-- $switch2 [hidden]
SELECT sw.hostname FROM ports AS p JOIN devices AS sw ON sw.device_id = p.device_id WHERE p.ifName like 'Ethernet%' AND p.ifAlias LIKE "%$ports%" ORDER BY p.port_id DESC LIMIT 1;
-- $port2 [hidden]
SELECT p.ifName FROM ports AS p JOIN devices AS sw ON sw.device_id = p.device_id WHERE p.ifName like 'Ethernet%' AND p.ifAlias LIKE "%$ports%" ORDER BY p.port_id DESC LIMIT 1;