Hello,
I am using Grafana v 7.3.1 and trying to build a dashboard for monitoring our network with repeating panels based on values taken from one variable. My datasource is MSSQL database with several tables holding metrics that are important for this dashboard.
One table holds hostnames and unique device id’s for each device while another table holds snmp collected data like timeseries metrics for latency/cpu load/memory utilisation/…
On this dashboard I want to show data for only a subset of devices visible in database, so from what I understand, I need 2 variables, where first variable feeds info to second variable.
Some practical info:
table Monitor.DeviceData contains hostnames and corresponding device id’s.
table Monitor.CPULoad contains snmp collected metrics for each device identified by device id.
So I have created variables like this:
Variable1: (Get devices from table containing hostname and device ID)
SELECT SysName FROM Monitor.dbo.DeviceData WHERE [SysName] LIKE N’%router%’;
Variable2: (Get DeviceID based on selected hostname (SysName) and use in panel for metrics from table Monitor.CPULoad)
SELECT DeviceID from Monitor.dbo.DeviceData WHERE SysName LIKE ‘$Variable1’;
And then create a panel with for example query:
SELECT [DeviceID],[Status],[ResponseTime]
FROM [Monitor].[dbo].[CPULoad]
WHERE [DeviceID] LIKE ‘$Variable2’;
And that works perfectly fine, as long as only one device is selected in variable1.
But if I want to create repeating panels I need all values generated by variable1.
So, if I enable ‘Include ALL’ option in the variable screen then variable2 throws an error
"mssql: Incorrect syntax near ‘$Variable1’ ".
Can somebody point out what am I doing wrong ?