Hello and welcome to this demo.
My name is Mom child my number.
And in this video we will look at how to use Jason path in combat.
That is with the cube control utility.
We will start by discussing why you might want to use Jason path in the first place.
We will then look at viewing and interpreting good control output.
In Jason format post which we look at the different steps involved in using Jason path with the cube
control utility.
We then look at several adjacent path examples and then go through loops before finally looking at custom
columns and sort functionality of cube control.
Once done you will go through a set of practice tests where you get to practice what you'll learn through
some fun and challenging exercises.
So let's get started.
Now before you begin you must know how to work with on path so that's a prerequisite if you have never
worked with Jason power Aquarius before.
Check out the videos and practice tests on that first they're available for free on my YouTube or on
the coach cloud Web site.
If you have work with it already let's continue.
Also it's good to first practice Jason path on COBRA that is data set so that you know how to navigate
through it before actually working on days on path with Cube control utility.
We also have a set of exercises on working with Jason path on COBRA at a status set so make sure you
go through that as well.
In this video our focus will be on how to use Jason path queries with the cube control utility.
So why Jason paths on the first place when you're working with production environments for coordinators.
You will need to view information about hundreds of notes and thousands of objects like deployments
parts and replica sets and services and secrets etc. and you will be using cube control utility to view
information about these objects.
You will often have requirements where you will need to print summary of different states about different
resources.
You will want to view specific fields of all resources query data about the resources based on different
criteria etc. viewing such information by going through thousands of these resources is an overwhelming
task which is why cube control supports a decent path option that makes filtering data across large
datasets using complex criteria.
An easy task but let's take a step back and understand how the cube control utility works.
We know that the cube control utility is the Cuban at UCLA.
Use it for reading and writing.
Cuban that is objects.
Every time you run a cube control command it interacts with the coordinates API through the cube API
server.
The cube API server speaks the Jason language so it returns the requested information in it to some
format.
The cube control the utility on receiving the information in a decent format converts it into a human
readable format and print it out to our screen during that process.
A lot of information that came in in the Jason format is hidden in an effort to make the output readable
by showing only the necessary details.
If you would like to see additional details you could use the dash 0 white option with the cube control
get command.
This prints additional details but again this is not complete.
There are still a lot more details that are not part of this output.
For example the resource capacity available on these nodes and the teen set on the nodes.
The conditions of the nodes the hardware architecture the images available in these nodes etc..
Well you can see them if you're on the cube control described command.
But what if you want to see it like a report.
For example say I'd like to see the nodes and the recipe you count in a tabular format like this or
the list of nodes and the teen set on them the architecture or say print.
The list of paths and the images they use.
None of the built in commands can give me these in this format.
That's where decent path queries can help with decent power queries.
You can filter and format the output of a command as you like and that's what we will see in this lecture
and in the practice exercises that followed this video in order to get started with decent path and
keep control.
You must follow these four steps.
First you need to know the command that will give you the required information in the raw format.
For example if you need information regarding note then you must use cube control.
Get nodes command if you need information regarding pods you must use the cube control get pod command.
We have seen a lot of these commands throughout this course.
So that should be easy.
Once you identify the command inspect its output in some format for this add the option dash 0.
Jason to the command.
It will print the output in a design format.
This is the same format of documents you worked with during the Jason practice test on Cuban notice
objects that I mentioned in the beginning of this video.
The next step is to look through the structure of the Jason document and form the Jason path query that
will retrieve the required information for you for example to get the image you would use to query what
items of 0 dots back the containers of 0 that image and finally use the query you developed with the
same cube control command to do that.
Use the dash 0 Jason path option and pass in the same descent path.
Query that you just developed.
Remember you must encapsulate the Jason path query within a pair of single codes and Carl embraces like
this we now have our cube control command with the Jason path query.
So if you're a beginner to on path and to this kind of logic then I would recommend strictly following
this approach where you first view the Jason version of the output copy the output to a decent path
query evaluator like Jason path dot com then play around with it until you come up with the right Jason
path query and then move that query to the cube control command.
With that you should be able to come up with decent path queries to pull useful information like the
below a decent path query of top items of star dot metadata that name with a cube control get nodes
command gives us the names of the notes in the cluster a query of items starts taters that note in folder
architecture returns me the hardware architecture of the notes and status dot capacity that CPE you
returns me the count of CPE use on these notes finally I can merge these queries together into a single
command for example I could use the first query to get the node names and add the query I used to get
the CPO count to it and that gets me both the results in a single command that's good and I can get
any information from the decent output as long as I can figure out the right decent path queries for
it but that's still not pretty.
Is it.
That's not how I wanted to look.
So let's look at some of the predefined and formatting options in this I have two types of information
in the same line.
I can insert a new line by adding the new line parameter in between the two queries like this the slash
N is for a new line and slash T.
It's for tab.
We will now look at loops using ranges.
This may be a bit advanced for some users so don't worry if you don't fully get it from a certification
and exam standpoint we've covered what we need but I'd like to cover this as well.
Before before we wind up with Aquarius we have built so far we were able to get different sets of information
like names of nodes the CPI accounts etc. In this format but this is not what we really want.
We wanted to look like this one on the right but not names in one column and zip you count in the other.
This is where we use loops to iterate through items in a list and print properties of each item we will
focus on the dis on query part alone for now.
When I run the Q control get nodes command I get a list of items each item representing a node so I
want to be able to say for each item or a node print the node name.
Then insert a tab as a separator and then print the CPO account followed by a new line character.
This will get me the results in the format I want.
To specify the for each statement.
Use the range keyword range items of star means for each item to print the node name.
Use the same query you build earlier that metadata that name.
Then to add a tab at the slash t keyword then to Principi you can't use the query dot status dot capacity
RTP you.
And then to add a new line and the slash and keyword friendly end the loop using the end keyword merge
it all in into a single line and parse it as a parameter to the decent path option of the Q control
command you can also use Jason path for printing custom columns with Cube control at times.
This is an easier approach when compared to using the loop method.
Let's take the previous example where we used the Jason path option to print note names and see if you
capacities.
What we really want is to print them as separate columns one column with the node name and another with
the CBO count instead of using the Jason pad option directly with the command.
You could use the custom columns option of the cube control command.
The custom columns option takes a set of column name and Jason path options for example for the first
column the column name is known.
The decent path corresponding to the node name is Dot metadata not name.
Note that you must exclude the item section of the query has the custom columns assumes the query is
for each item in the list.
This prints the first column with the given column name and its data.
Similarly you can add additional columns by adding additional column and decent path pairs separated
by a comma.
So we add the next column names you with this data add not status Doug positive Doug C P U.
Much easier and cleaner again for this too.
I would recommend first coming up with the Jason path queries for each column and then putting them
together in the comment finally decent path can also be used while sorting objects by specifying the
sort.
By option the cube control command comes with a sort by option where you can sort the output based on
the value of a property from the days on formatted properties of each item.
When you run the Q control get nodes command specify the decent path query redeveloped earlier as these
in the sort by option to sort based on name recipe you come.
Well that's it for this lecture.
Head over to the practice test and practice working with Jason pad and some advance cube control commands.