1
00:00:00,210 --> 00:00:02,040
Hello and welcome to this demo.

2
00:00:02,040 --> 00:00:04,090
My name is Mom child my number.

3
00:00:04,410 --> 00:00:08,970
And in this video we will look at how to use Jason path in combat.

4
00:00:08,980 --> 00:00:11,820
That is with the cube control utility.

5
00:00:11,820 --> 00:00:16,550
We will start by discussing why you might want to use Jason path in the first place.

6
00:00:16,560 --> 00:00:20,310
We will then look at viewing and interpreting good control output.

7
00:00:20,310 --> 00:00:27,060
In Jason format post which we look at the different steps involved in using Jason path with the cube

8
00:00:27,060 --> 00:00:28,610
control utility.

9
00:00:28,680 --> 00:00:35,400
We then look at several adjacent path examples and then go through loops before finally looking at custom

10
00:00:35,400 --> 00:00:38,920
columns and sort functionality of cube control.

11
00:00:39,090 --> 00:00:44,870
Once done you will go through a set of practice tests where you get to practice what you'll learn through

12
00:00:44,910 --> 00:00:47,230
some fun and challenging exercises.

13
00:00:47,250 --> 00:00:48,320
So let's get started.

14
00:00:48,500 --> 00:00:56,830
Now before you begin you must know how to work with on path so that's a prerequisite if you have never

15
00:00:56,830 --> 00:00:59,600
worked with Jason power Aquarius before.

16
00:00:59,620 --> 00:01:05,380
Check out the videos and practice tests on that first they're available for free on my YouTube or on

17
00:01:05,390 --> 00:01:07,130
the coach cloud Web site.

18
00:01:07,240 --> 00:01:10,320
If you have work with it already let's continue.

19
00:01:10,400 --> 00:01:17,920
Also it's good to first practice Jason path on COBRA that is data set so that you know how to navigate

20
00:01:17,950 --> 00:01:23,520
through it before actually working on days on path with Cube control utility.

21
00:01:23,530 --> 00:01:28,900
We also have a set of exercises on working with Jason path on COBRA at a status set so make sure you

22
00:01:28,900 --> 00:01:30,670
go through that as well.

23
00:01:30,670 --> 00:01:37,760
In this video our focus will be on how to use Jason path queries with the cube control utility.

24
00:01:37,990 --> 00:01:45,920
So why Jason paths on the first place when you're working with production environments for coordinators.

25
00:01:46,240 --> 00:01:52,270
You will need to view information about hundreds of notes and thousands of objects like deployments

26
00:01:52,300 --> 00:01:59,710
parts and replica sets and services and secrets etc. and you will be using cube control utility to view

27
00:01:59,710 --> 00:02:02,440
information about these objects.

28
00:02:02,500 --> 00:02:08,230
You will often have requirements where you will need to print summary of different states about different

29
00:02:08,230 --> 00:02:09,490
resources.

30
00:02:09,550 --> 00:02:15,940
You will want to view specific fields of all resources query data about the resources based on different

31
00:02:15,940 --> 00:02:23,950
criteria etc. viewing such information by going through thousands of these resources is an overwhelming

32
00:02:23,950 --> 00:02:31,570
task which is why cube control supports a decent path option that makes filtering data across large

33
00:02:31,600 --> 00:02:34,530
datasets using complex criteria.

34
00:02:34,600 --> 00:02:41,090
An easy task but let's take a step back and understand how the cube control utility works.

35
00:02:41,110 --> 00:02:44,580
We know that the cube control utility is the Cuban at UCLA.

36
00:02:44,590 --> 00:02:46,180
Use it for reading and writing.

37
00:02:46,180 --> 00:02:47,560
Cuban that is objects.

38
00:02:47,770 --> 00:02:54,040
Every time you run a cube control command it interacts with the coordinates API through the cube API

39
00:02:54,070 --> 00:02:55,240
server.

40
00:02:55,240 --> 00:03:01,870
The cube API server speaks the Jason language so it returns the requested information in it to some

41
00:03:01,870 --> 00:03:03,100
format.

42
00:03:03,100 --> 00:03:10,090
The cube control the utility on receiving the information in a decent format converts it into a human

43
00:03:10,120 --> 00:03:15,500
readable format and print it out to our screen during that process.

44
00:03:15,510 --> 00:03:22,860
A lot of information that came in in the Jason format is hidden in an effort to make the output readable

45
00:03:23,160 --> 00:03:26,590
by showing only the necessary details.

46
00:03:26,640 --> 00:03:33,780
If you would like to see additional details you could use the dash 0 white option with the cube control

47
00:03:33,840 --> 00:03:35,130
get command.

48
00:03:35,310 --> 00:03:39,630
This prints additional details but again this is not complete.

49
00:03:39,660 --> 00:03:43,610
There are still a lot more details that are not part of this output.

50
00:03:43,650 --> 00:03:49,380
For example the resource capacity available on these nodes and the teen set on the nodes.

51
00:03:49,380 --> 00:03:55,410
The conditions of the nodes the hardware architecture the images available in these nodes etc..

52
00:03:55,690 --> 00:03:59,280
Well you can see them if you're on the cube control described command.

53
00:03:59,280 --> 00:04:02,150
But what if you want to see it like a report.

54
00:04:02,380 --> 00:04:08,710
For example say I'd like to see the nodes and the recipe you count in a tabular format like this or

55
00:04:08,920 --> 00:04:13,900
the list of nodes and the teen set on them the architecture or say print.

56
00:04:13,900 --> 00:04:17,410
The list of paths and the images they use.

57
00:04:17,410 --> 00:04:21,530
None of the built in commands can give me these in this format.

58
00:04:21,670 --> 00:04:26,400
That's where decent path queries can help with decent power queries.

59
00:04:26,410 --> 00:04:32,980
You can filter and format the output of a command as you like and that's what we will see in this lecture

60
00:04:33,360 --> 00:04:39,130
and in the practice exercises that followed this video in order to get started with decent path and

61
00:04:39,130 --> 00:04:40,050
keep control.

62
00:04:40,060 --> 00:04:42,400
You must follow these four steps.

63
00:04:42,400 --> 00:04:48,710
First you need to know the command that will give you the required information in the raw format.

64
00:04:48,730 --> 00:04:53,790
For example if you need information regarding note then you must use cube control.

65
00:04:53,830 --> 00:05:00,990
Get nodes command if you need information regarding pods you must use the cube control get pod command.

66
00:05:01,240 --> 00:05:04,320
We have seen a lot of these commands throughout this course.

67
00:05:04,540 --> 00:05:06,360
So that should be easy.

68
00:05:06,610 --> 00:05:14,050
Once you identify the command inspect its output in some format for this add the option dash 0.

69
00:05:14,170 --> 00:05:15,880
Jason to the command.

70
00:05:15,880 --> 00:05:18,850
It will print the output in a design format.

71
00:05:18,880 --> 00:05:24,570
This is the same format of documents you worked with during the Jason practice test on Cuban notice

72
00:05:24,640 --> 00:05:28,250
objects that I mentioned in the beginning of this video.

73
00:05:28,300 --> 00:05:34,060
The next step is to look through the structure of the Jason document and form the Jason path query that

74
00:05:34,060 --> 00:05:40,120
will retrieve the required information for you for example to get the image you would use to query what

75
00:05:40,150 --> 00:05:48,160
items of 0 dots back the containers of 0 that image and finally use the query you developed with the

76
00:05:48,160 --> 00:05:51,060
same cube control command to do that.

77
00:05:51,070 --> 00:05:56,070
Use the dash 0 Jason path option and pass in the same descent path.

78
00:05:56,080 --> 00:05:58,210
Query that you just developed.

79
00:05:58,450 --> 00:06:05,740
Remember you must encapsulate the Jason path query within a pair of single codes and Carl embraces like

80
00:06:05,740 --> 00:06:11,980
this we now have our cube control command with the Jason path query.

81
00:06:11,980 --> 00:06:18,430
So if you're a beginner to on path and to this kind of logic then I would recommend strictly following

82
00:06:18,430 --> 00:06:24,390
this approach where you first view the Jason version of the output copy the output to a decent path

83
00:06:24,400 --> 00:06:31,060
query evaluator like Jason path dot com then play around with it until you come up with the right Jason

84
00:06:31,060 --> 00:06:35,690
path query and then move that query to the cube control command.

85
00:06:36,040 --> 00:06:41,260
With that you should be able to come up with decent path queries to pull useful information like the

86
00:06:41,260 --> 00:06:49,570
below a decent path query of top items of star dot metadata that name with a cube control get nodes

87
00:06:49,570 --> 00:06:56,920
command gives us the names of the notes in the cluster a query of items starts taters that note in folder

88
00:06:56,980 --> 00:07:04,340
architecture returns me the hardware architecture of the notes and status dot capacity that CPE you

89
00:07:04,700 --> 00:07:12,920
returns me the count of CPE use on these notes finally I can merge these queries together into a single

90
00:07:12,920 --> 00:07:20,090
command for example I could use the first query to get the node names and add the query I used to get

91
00:07:20,090 --> 00:07:27,620
the CPO count to it and that gets me both the results in a single command that's good and I can get

92
00:07:27,710 --> 00:07:33,560
any information from the decent output as long as I can figure out the right decent path queries for

93
00:07:33,560 --> 00:07:35,990
it but that's still not pretty.

94
00:07:35,990 --> 00:07:36,280
Is it.

95
00:07:37,040 --> 00:07:38,510
That's not how I wanted to look.

96
00:07:39,050 --> 00:07:45,200
So let's look at some of the predefined and formatting options in this I have two types of information

97
00:07:45,290 --> 00:07:46,290
in the same line.

98
00:07:46,610 --> 00:07:53,180
I can insert a new line by adding the new line parameter in between the two queries like this the slash

99
00:07:53,300 --> 00:07:56,930
N is for a new line and slash T.

100
00:07:57,120 --> 00:07:58,620
It's for tab.

101
00:07:58,840 --> 00:08:02,300
We will now look at loops using ranges.

102
00:08:02,300 --> 00:08:09,110
This may be a bit advanced for some users so don't worry if you don't fully get it from a certification

103
00:08:09,170 --> 00:08:14,180
and exam standpoint we've covered what we need but I'd like to cover this as well.

104
00:08:14,180 --> 00:08:21,680
Before before we wind up with Aquarius we have built so far we were able to get different sets of information

105
00:08:21,680 --> 00:08:27,620
like names of nodes the CPI accounts etc. In this format but this is not what we really want.

106
00:08:27,620 --> 00:08:34,600
We wanted to look like this one on the right but not names in one column and zip you count in the other.

107
00:08:34,760 --> 00:08:42,590
This is where we use loops to iterate through items in a list and print properties of each item we will

108
00:08:42,590 --> 00:08:45,890
focus on the dis on query part alone for now.

109
00:08:46,190 --> 00:08:54,080
When I run the Q control get nodes command I get a list of items each item representing a node so I

110
00:08:54,080 --> 00:08:59,500
want to be able to say for each item or a node print the node name.

111
00:08:59,510 --> 00:09:06,190
Then insert a tab as a separator and then print the CPO account followed by a new line character.

112
00:09:06,200 --> 00:09:08,900
This will get me the results in the format I want.

113
00:09:09,900 --> 00:09:12,460
To specify the for each statement.

114
00:09:12,540 --> 00:09:21,250
Use the range keyword range items of star means for each item to print the node name.

115
00:09:21,250 --> 00:09:26,050
Use the same query you build earlier that metadata that name.

116
00:09:26,050 --> 00:09:34,090
Then to add a tab at the slash t keyword then to Principi you can't use the query dot status dot capacity

117
00:09:34,190 --> 00:09:35,140
RTP you.

118
00:09:35,260 --> 00:09:43,650
And then to add a new line and the slash and keyword friendly end the loop using the end keyword merge

119
00:09:43,680 --> 00:09:50,370
it all in into a single line and parse it as a parameter to the decent path option of the Q control

120
00:09:50,380 --> 00:09:59,310
command you can also use Jason path for printing custom columns with Cube control at times.

121
00:09:59,310 --> 00:10:02,740
This is an easier approach when compared to using the loop method.

122
00:10:03,480 --> 00:10:08,340
Let's take the previous example where we used the Jason path option to print note names and see if you

123
00:10:08,340 --> 00:10:10,020
capacities.

124
00:10:10,020 --> 00:10:15,990
What we really want is to print them as separate columns one column with the node name and another with

125
00:10:15,990 --> 00:10:22,070
the CBO count instead of using the Jason pad option directly with the command.

126
00:10:22,140 --> 00:10:26,430
You could use the custom columns option of the cube control command.

127
00:10:26,430 --> 00:10:33,480
The custom columns option takes a set of column name and Jason path options for example for the first

128
00:10:33,480 --> 00:10:35,590
column the column name is known.

129
00:10:35,790 --> 00:10:41,910
The decent path corresponding to the node name is Dot metadata not name.

130
00:10:41,940 --> 00:10:48,510
Note that you must exclude the item section of the query has the custom columns assumes the query is

131
00:10:48,510 --> 00:10:50,450
for each item in the list.

132
00:10:50,460 --> 00:10:55,040
This prints the first column with the given column name and its data.

133
00:10:55,050 --> 00:11:02,070
Similarly you can add additional columns by adding additional column and decent path pairs separated

134
00:11:02,070 --> 00:11:03,430
by a comma.

135
00:11:03,570 --> 00:11:10,850
So we add the next column names you with this data add not status Doug positive Doug C P U.

136
00:11:11,280 --> 00:11:14,490
Much easier and cleaner again for this too.

137
00:11:14,490 --> 00:11:19,530
I would recommend first coming up with the Jason path queries for each column and then putting them

138
00:11:19,530 --> 00:11:26,980
together in the comment finally decent path can also be used while sorting objects by specifying the

139
00:11:26,980 --> 00:11:27,470
sort.

140
00:11:27,490 --> 00:11:34,580
By option the cube control command comes with a sort by option where you can sort the output based on

141
00:11:34,580 --> 00:11:38,800
the value of a property from the days on formatted properties of each item.

142
00:11:40,010 --> 00:11:47,120
When you run the Q control get nodes command specify the decent path query redeveloped earlier as these

143
00:11:47,270 --> 00:11:55,110
in the sort by option to sort based on name recipe you come.

144
00:11:55,280 --> 00:11:57,620
Well that's it for this lecture.

145
00:11:57,620 --> 00:12:03,290
Head over to the practice test and practice working with Jason pad and some advance cube control commands.
