OK. Here you are…
- First create Constant variable with each url for each dashboard (or link):
- Now we need to note every identificative value for each row (that will be used to determine witch link we need to present). On this example we can see there is only one row for host, however Process DB value can be repeated for more than one host. So we will use (on this example) a variable that will contain a host list:
Now we will create a new variable (for ejemple expr ) that will generate an expression necessary for a PostgreSQL. This new var will be Query type, using a working PostgreSQL (or other SQL datasource). Really we don’t need to query data, only need a Datasource to a SQL server (PostgreSQL, Oracle, MariaDB…). New var will be like this:
Query will be like this:
SELECT '(''' || REPLACE('${host:raw}', ',', '''),(''') || ''')'
This will be create a string needed to PostgreSQL (or other SQL) that will be used on other query:
- Now we create a new table panelwith a PostgreSQL query. The query that I used was like this:
SELECT
tt2.host_windows,
tt.instance_bd,
tt.description,
tt.url
FROM
(VALUES ${expr:raw}) AS tt2(host_windows)
CROSS JOIN
(VALUES
('influxd', 'Dashbaoard Influx', '$urlINFLUX'),
('sqlservr', 'Dashbaoard SQL', '$urlSQL')
) AS tt(instance_bd, description, url);
EXPLANATION: With this query we are generating an output of all the combinations of HOSTS (contained in the host variable using the expression generated in the expr variable) combined with the possible options of the Process DDBB values (influxd and sqlservr), along with their respective description (which will appear as a tooltip of the data link) and its respective URL (contained in the constant type variables generated in step 1). This generates a table with values like this:
host_windows |
instance_bd |
description |
url |
sv**********04 |
influxd |
Dashbaoard Influx |
./d/**********/influxdb?orgId=1&var-ServerName= |
sv**********04 |
sqlservr |
Dashbaoard SQL |
./d/**********/sql-server?orgId=1&refresh=1m&var-host= |
sv**********06 |
influxd |
Dashbaoard Influx |
./d/**********/influxdb?orgId=1&var-ServerName= |
sv**********06 |
sqlservr |
Dashbaoard SQL |
./d/**********/sql-server?orgId=1&refresh=1m&var-host= |
sv**********07 |
influxd |
Dashbaoard Influx |
./d/**********/influxdb?orgId=1&var-ServerName= |
… |
… |
… |
… |
NOTE: It is important that the name of the first field MATCH the name of the field in the InfluxQL query:
SELECT "host" AS "host_windows", "instance_bd"
FROM (
SELECT last("Percent_Processor_Time"), "instance" as "instance_bd"
FROM "1week"."Windows.Process"
WHERE "host" =~ /^$host$/ AND "instance" =~ /^$process_bd$/ AND $timeFilter
GROUP BY "instance", "host"
)