WEBVTT

00:00.450 --> 00:05.400
Dashboard variables, dashboard variables allow more interactivity with your dashboard, so you can

00:05.400 --> 00:09.640
dynamically update them, many things can be turned into dashboard variables.

00:09.690 --> 00:14.730
I have a whole list of them here that will go through, but we use all of the data sources that we've

00:14.730 --> 00:18.780
created so far and create different dashboard variables from them.

00:18.780 --> 00:20.820
So you can see it's quite a few there.

00:21.330 --> 00:25.540
So what a dashboard variable looks like if I look at the node exporter dashboard here.

00:26.040 --> 00:29.520
These dropdowns, they are created from dashboard variables.

00:29.580 --> 00:35.400
So here we have some values dynamically added, and if I change one of those to go farther than all

00:35.400 --> 00:38.460
the dashboard updates, depending on that.

00:38.670 --> 00:46.830
So if I select Influx DB, we get information about the influx DB, ServiceNow and Moscow, for example.

00:47.010 --> 00:54.090
Now each of these visualizations here are rating the value behind this particular dashboard variable

00:54.330 --> 00:56.760
to know which host to get his data from.

00:56.850 --> 01:03.300
So if I look at this table here and just press a we can see inside the queries is a dollar node that

01:03.300 --> 01:06.300
is referring to the dashboard variable just here.

01:06.690 --> 01:11.550
So we'll create dashboard variables now looking at all of the different data sources that were credit

01:11.550 --> 01:12.120
so far.

01:12.390 --> 01:19.530
So go into dashboards, manage, discard any changes he made on that dashboard, create a new dashboard

01:20.010 --> 01:22.560
and we'll go straight to dashboard settings.

01:22.890 --> 01:26.340
So I'm going to call it dashboard variables.

01:27.250 --> 01:29.640
OK, save that, OK.

01:29.680 --> 01:35.260
Go back into settings now there's this option here called variables at a variable.

01:35.740 --> 01:37.330
We have many types of variables.

01:37.900 --> 01:44.230
The first one will be a type of interval so that select interval and it's pre created a list for us

01:44.230 --> 01:44.770
already.

01:45.400 --> 01:49.160
I'm going to call the variable interval that nightmare interval.

01:49.180 --> 01:54.880
That means within my visualizations, I'll refer to that as the interval, but I won't use.

01:54.880 --> 02:00.280
$$ in the name here because it's not on the correct, but I'll demonstrate using these in the next few

02:00.280 --> 02:00.790
videos.

02:00.790 --> 02:03.100
But down here you can see a preview of values.

02:03.100 --> 02:04.840
We can add more if we like.

02:04.840 --> 02:10.530
So I can say give me 60 days or one year or 10 years.

02:10.570 --> 02:16.620
For example, 60 days, one year to one year, I can say, give me 10 seconds and ten seconds is a list.

02:16.820 --> 02:19.930
So if I update, that is now showing up as an interval.

02:19.940 --> 02:26.770
If I press that back error that dropdown now exists in my dashboard, I can use that $ interval in my

02:26.770 --> 02:27.760
visualizations.

02:27.790 --> 02:31.910
Also see here how I got the word interval and it's a lowercase I.

02:31.920 --> 02:37.840
I can actually improve on that presentation slightly by going back into variable, clicking it and saying

02:37.840 --> 02:40.210
the display name can be interval.

02:40.660 --> 02:42.730
So my display name of using a capital I.

02:42.760 --> 02:45.360
That my variable name is a little high.

02:45.850 --> 02:53.170
So if you ever want your variable names to be more programmatic looking such as my interval, but you

02:53.170 --> 02:54.760
don't want to show that as your label.

02:55.090 --> 02:59.950
Then you use label here, Thelma, keep that just a lowercase I at that update.

03:00.100 --> 03:02.440
So that's how those dropdowns are created.

03:02.560 --> 03:03.910
That's a very simple one.

03:04.000 --> 03:06.340
The next one will create a custom.

03:06.890 --> 03:13.570
So a new custom, I'm going to call it custom, but my label is going to be custom.

03:14.670 --> 03:18.390
A custom variable is my description.

03:19.280 --> 03:20.600
Comma separated values.

03:21.720 --> 03:22.310
Just copy that.

03:23.480 --> 03:26.150
ABC, I think that's the preview down there.

03:26.870 --> 03:27.170
No.

03:27.290 --> 03:28.400
One to three.

03:28.880 --> 03:29.630
Anything I like.

03:29.840 --> 03:31.490
OK, so there's the preview down there.

03:31.760 --> 03:36.250
Now these multi value and include all option, let's have a look at what we have first.

03:36.260 --> 03:43.490
So uptight that going to there and that's the custom with all my custom comma separated values go back

03:43.490 --> 03:44.030
into it.

03:44.210 --> 03:45.770
Variables custom.

03:45.770 --> 03:55.100
If I select Multi Value and Press Update, go back, I can now select one or none to or what that or

03:55.130 --> 03:56.210
all except for one.

03:56.720 --> 04:01.340
Now, looking at variable skin, they include all option.

04:01.520 --> 04:06.800
All that does is shows update an option like that.

04:07.070 --> 04:07.970
So that means all.

04:08.930 --> 04:11.930
Anyway, moving on a data source type.

04:12.560 --> 04:17.660
OK, so variables new, the type will be a data source.

04:18.260 --> 04:19.790
Cool data source.

04:20.570 --> 04:27.590
And my label complete data source like that type again, referring to which data sources we have configured.

04:27.620 --> 04:28.880
I have quite a few.

04:28.970 --> 04:30.920
I'm going to use ElasticSearch for this example.

04:31.100 --> 04:34.970
And down here it's show me all my ElasticSearch data sources.

04:35.030 --> 04:42.080
So if I update that and view that so I can select whichever data source I want to use for a particular

04:42.080 --> 04:42.710
use case.

04:43.710 --> 04:49.560
I go back into that variables looking at that, also this instance name filter, these are rejects as

04:49.860 --> 04:52.080
most of the variable types have this option.

04:52.200 --> 04:58.020
So what I can say is I can say, give me everything with the word file in it, so I might have many

04:58.020 --> 05:03.660
ElasticSearch data sources configured and they might be something similar, such as the word file,

05:03.720 --> 05:04.410
for example.

05:04.410 --> 05:07.890
So I'd say, give me everything with the word file in it.

05:09.050 --> 05:16.450
And it's given me Volbeat or give me everything with the word metric, or if we look at this first dot

05:16.460 --> 05:19.050
here, that means anything before the metric.

05:19.070 --> 05:25.820
So if I was to type a plastic, for example, the plastic that wouldn't show anything because it's looking

05:25.820 --> 05:28.730
for something for the word logistic support that got away.

05:29.030 --> 05:31.700
It's now show me everything starting with elastic.

05:32.570 --> 05:36.950
Give me everything ending with beat for beat metrically.

05:37.280 --> 05:39.620
Or just give me everything.

05:40.600 --> 05:43.000
But that's the same as just doing that.

05:43.560 --> 05:44.550
OK, excellent.

05:44.560 --> 05:47.800
So update that ElasticSearch, Volbeat.

05:48.760 --> 05:58.240
OK, next one is still school query, we can run a direct MySchool query on our data source, so variables

05:58.540 --> 06:00.340
new, this will be a query.

06:00.640 --> 06:04.450
OK, I'm going to call this username optional.

06:04.450 --> 06:05.350
Use a name.

06:05.890 --> 06:14.350
I'm going to use my my squirrel data source and the query being that they select username as metric

06:14.350 --> 06:19.570
from the example simple table that we set up at the beginning of the course when we're looking at non

06:19.570 --> 06:22.320
time series data or body, click here.

06:22.600 --> 06:30.110
Show me all the names from that flat static table we credit very good updated and username.

06:31.180 --> 06:36.160
And you can dynamically update your visualizations based on that variable called username.

06:36.980 --> 06:38.930
Just their username would be.

06:39.200 --> 06:41.840
That's how it refer to it, anyway, let's create another one.

06:43.780 --> 06:44.290
New.

06:45.300 --> 06:54.630
OK, we'll do some low-key queries first one label names, I'll call it name query label, low key names,

06:55.590 --> 06:57.390
low key and that's my query.

06:58.020 --> 07:04.560
Label names and it's just given me everything I can find on the label names for name host job update

07:04.560 --> 07:10.070
that outside the dashboard safe, we're going to explore the low key data source, low key.

07:10.080 --> 07:12.240
And if I slipped log browser, they're there.

07:12.240 --> 07:14.490
The name is their full name host job.

07:14.970 --> 07:20.750
I'm carrying a variable with those three plus a system level name, so manage.

07:22.030 --> 07:30.580
Dashboard variables added that variables, label names, we get the X-1 down here, which is a system

07:30.580 --> 07:33.880
level name we can hide that be a little bit more tricky with this one.

07:33.880 --> 07:35.270
So that's an example.

07:35.290 --> 07:41.860
That means in rejects the start of a line where he is saying not subject to the same thing, the host.

07:42.670 --> 07:46.660
So everything except the host is there or job.

07:47.910 --> 07:49.620
OK, so if you want that.

07:51.890 --> 07:53.490
I don't want to be there.

07:54.030 --> 07:54.390
OK.

07:54.540 --> 07:55.020
Update.

07:56.390 --> 07:58.880
So we'll look at that so low key times.

07:59.060 --> 07:59.540
There we go.

07:59.990 --> 08:06.870
OK, another one dashboard settings variables we could do one for host in Loki.

08:07.280 --> 08:08.030
That's a query.

08:08.960 --> 08:12.320
Loki host Loki.

08:13.100 --> 08:17.560
The query is labor values host California.

08:17.600 --> 08:23.000
My school, my Loki has two prom tails pushing down it to it, and those tails are on the Gryffindor

08:23.040 --> 08:27.290
muscular server so that we're going to update that to save my progress.

08:27.960 --> 08:28.880
Okay, look at it.

08:29.670 --> 08:32.660
Loki hosts Gryffindor Moscow team.

08:33.720 --> 08:40.450
We do the same with job losses going of Prometheus, query the queries of very similar dashboard variables.

08:40.800 --> 08:45.480
New, I'm going to call this from names query.

08:46.550 --> 08:52.520
Prometheus names, it's going to use Prometheus the query.

08:54.200 --> 08:55.370
Label names.

08:55.500 --> 08:56.030
They would go.

08:57.180 --> 08:58.290
There are many of them.

08:59.520 --> 09:03.540
I can update that or save the dashboard, look at it.

09:04.290 --> 09:12.030
Prometheus names that list that comes from before explore and look at the Prometheus data source metric

09:12.030 --> 09:12.510
browser.

09:12.720 --> 09:21.240
These are all the prom names there, so going back into the dashboard, the variables added variables.

09:21.480 --> 09:25.530
I can exclude that first one on the school name there.

09:29.150 --> 09:30.440
I go, sir.

09:30.830 --> 09:31.760
All right, good update.

09:32.300 --> 09:37.820
Another Prometheus, this one will be prom job about label values job.

09:39.050 --> 09:42.590
Came from Job one label.

09:45.060 --> 09:53.780
Prometheus level values job, so all the jobs that I've set up in Prometheus, my Prometheus, not exporters,

09:54.410 --> 09:55.480
I have various jobs.

09:55.830 --> 09:58.350
Bafana Knight Prometheus update.

09:58.700 --> 09:59.280
All right, good.

09:59.280 --> 10:05.370
Let's have a look at Prometheus Jobs Callisto, another one now that we're more sophisticated prom host.

10:05.550 --> 10:11.080
The variable dropdown will update depending on whatever the value of prom job is.

10:11.100 --> 10:12.490
So from that one just there?

10:12.750 --> 10:14.160
So let's copy that.

10:14.400 --> 10:16.560
We use that from host, I'm going to call it.

10:17.250 --> 10:23.040
OK, so variables, new host, it will be Prometheus.

10:23.610 --> 10:24.690
That's the query.

10:24.990 --> 10:29.610
And it's using prom job from the last variable I credit, which is called prom job.

10:29.790 --> 10:34.110
But look at the dollar sign in front of a lot that to indicate that it's a variable and it's show me

10:34.110 --> 10:36.510
influx DB mice will and Gravano.

10:36.930 --> 10:45.510
So if I update that, OK, well before I'll do the Prometheus posts, I update, Hey, let's do that

10:45.660 --> 10:48.120
now cause a node is selected.

10:48.390 --> 10:51.000
I have not exporter's on the service in flux.

10:51.000 --> 10:52.350
DB mice cool griffon.

10:52.360 --> 10:57.690
OK, so if I select Gravano, I don't have any of those other servers with Agraféna.

10:57.690 --> 10:59.580
Job on it with Prometheus.

10:59.730 --> 11:01.590
I don't have any of those other servers with a permit.

11:01.590 --> 11:02.160
His job on it.

11:02.160 --> 11:03.120
But if I had node.

11:03.360 --> 11:06.480
These are the three servers that I have a node job on.

11:06.900 --> 11:11.910
So that's a variable that changes depending on the value of another variable.

11:12.030 --> 11:16.230
Hey, I'm going to say that, OK, let's look at influx DB queries now.

11:16.260 --> 11:21.540
This is influx DB version two, which if you're familiar with influx DB one, the queries were much

11:21.540 --> 11:23.040
simpler than that influx.

11:23.040 --> 11:26.100
DB two is quite a lot more complicated to use.

11:26.100 --> 11:30.540
But anyway, here's some examples that you can refer to a copy that code source.

11:30.680 --> 11:35.340
OK, so let's create a new variable to query one call source.

11:36.470 --> 11:41.150
In flux, Deb, that's looking at the influx to be a source that we credit early on in the course,

11:41.150 --> 11:46.880
and that is a simple query and broke credit the bucket code Telegraph with S&amp;P measurements.

11:47.090 --> 11:53.330
So if I click out of that preview the values Carafano, MySchool, an influx DB, these are the service

11:53.330 --> 11:57.540
where I store this in a big Damon's set up telegraph to query those.

11:57.560 --> 12:01.490
So it's quite a more complicated query update.

12:02.150 --> 12:04.580
Let's have a look at that source.

12:04.700 --> 12:12.950
Bafana High School in Flux DB we can modify that name to be in flux DB source.

12:14.060 --> 12:19.640
This was informative update to complexity, but a source close to another influx, Debbie.

12:20.780 --> 12:27.550
Variables new, this one will be interface, but if we look at this, it's using the source variable

12:27.560 --> 12:28.610
that is a here.

12:28.610 --> 12:35.480
So copy that interface is called so interface, it's a query.

12:36.470 --> 12:40.910
And Fox TV in a face, this is my astonished interfaces.

12:42.080 --> 12:49.400
Flux to be there we go, and it's using the source from before I click out most of those servers that

12:49.400 --> 12:53.490
I'm getting from digital, I should have two interfaces low in a Red Hat device.

12:53.510 --> 12:58.610
One update that I go by look at that I go low.

12:58.790 --> 13:03.340
It's also a dynamic variable because it's using the source variable here.

13:03.350 --> 13:09.080
So if I change it to my key will also sync Docker because I have installed Docker on my MySchool server

13:09.080 --> 13:09.500
as well.

13:10.130 --> 13:12.140
Flux DB, I need to like that.

13:12.530 --> 13:17.170
So that's another example of a dynamic variable based on the value of another Wrobel.

13:17.180 --> 13:20.490
Let's save that and look at another one, Xbox.

13:20.630 --> 13:28.520
If you set up the Xbox data sources, variables new Xbox One, click out of that.

13:28.520 --> 13:30.670
It's showing me Linux Xbox service.

13:30.670 --> 13:35.420
That's the first query, but I'm going to stick to type being host with the group being that and the

13:35.420 --> 13:36.770
host also being that.

13:37.160 --> 13:41.300
It's now show me all the hosts I have set up in Xbox, those down there.

13:41.660 --> 13:47.270
I'm going to call that host the very what I I'm or exists or Xbox hosts.

13:47.270 --> 13:56.000
I'm using Camel Case, the query service host and site that so will look at it on my Xbox hosts so I

13:56.000 --> 14:00.830
could have dynamic tables and graphs stats based on whichever one I click.

14:02.070 --> 14:04.980
And finally, would you want for ElasticSearch as well?

14:05.550 --> 14:11.310
We'll look at the metric beat data source and we'll find everything to do with System D unit.

14:12.470 --> 14:16.760
So variables you want to call it unit.

14:18.160 --> 14:26.800
Query ElasticSearch metric beat system D unit sets finding terms with the field system D unit so we

14:26.800 --> 14:35.260
could have many of those, such as host dot name and there's one of uninstalled ElasticSearch metric

14:35.260 --> 14:36.730
pain, one of my servers.

14:36.730 --> 14:40.330
But let's go back to System D, you know this is a lot more information need.

14:40.390 --> 14:45.890
Look at Shamal so we can look at information about Docker servers if we had it.

14:45.910 --> 14:48.400
Cron log rotate update that.

14:49.090 --> 14:49.510
Very good.

14:49.510 --> 14:54.370
Let's look at the dashboard and we have one for unit and that information is coming from our ElasticSearch.

14:55.360 --> 14:56.010
Fields.

14:56.650 --> 14:57.130
Excellent.

14:57.820 --> 15:00.250
So there are a whole lot of examples there.

15:00.280 --> 15:03.620
The different data sources in the dashboard variables section.

15:03.640 --> 15:09.040
The best way to know how to create these is to look at other examples of dashboards and reverse engineer

15:09.040 --> 15:09.280
them.

15:09.310 --> 15:12.880
There's no real easy way to know exactly what you should write.

15:12.910 --> 15:14.870
Here is a trial and error process.

15:14.920 --> 15:20.200
I've taught myself how to do all these, basically just looking at how other people have done it.

15:20.380 --> 15:26.950
So you guys have a lot of examples anyway in the next few videos will actually start using these.

15:27.070 --> 15:30.220
But more specifically, I'll be focusing on the Prometheus dashboard.

15:30.220 --> 15:36.430
Variables will be creating our own Prometheus dashboard that dynamically updates based on which dashboard

15:36.430 --> 15:38.230
variables we are selecting.

15:38.440 --> 15:38.890
Excellent.
