Multi row and mutli column dashboard variables

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

| host     | switch | port       |
+----------+--------+------------+
| server1  | sw1    | Ethernet3  |
| server1  | sw1    | Ethernet4  |
| server2  | sw2    | Ethernet10 |
| server2  | sw5    | Ethernet11 |

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.

Welcome,

Is there any numeric value you want to plot? When you mean stacked are you thinking of a bar chart?

I’m sorry I wasn’t clear enough.

I did manage to cobble something together in a way that is very rigid and depends on way to many external factors IMO.

example dashboard

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;
1 Like

Not sure how you want it to be dynamic based on what data and what action?

at the moment the LACP pair queried from sql consist of 2 interfaces, hence variables switch1, port1, switch2 and port2

LACP can be configured on 1 port up to as many as 8 ports (more details)

Dynamic refers to dynamic creating stacked graphs of up to 8 interfaces depending on the results of the sql query.