Docker Monitoring using CAdvisor

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
welcome back alok shrivastav ah so we like in the previous video we had talked about the docker right we had talked about like the storage part so in this video I am going to show you how to do the monitoring right so there are a couple of tools available there are couple of built-in tools like the docker start command the docker top command which you can use to monitor your talker containers so those are one of the things which you can use to monitor your docker containers then there are some third-party tools also like google has got a sea advisor so which is a wonderful tool which actually gives you a decent UI in which you can view the resource consumption per host wise as well as per container wise also so these are the other two things we are going to see normally people don't talk about the sea advisor yeah one word of caution here the sea advisor is a good thing it's it's actually a project which is as I have told you it is actually a project which is being started by Google for monitoring its own continuous internal write project it is a it is available now it gives you a real life or a kind of a a real-time usage of your container on the docker host we are we are going to see that but the problem with see advisor not the problem I write I can say the feature of the sea advisor is that it doesn't store historic data so if you want to go and check the load and the CPU consumption and all those things of yesterday the sea advisor is not at all going to help you in that so for that we have tools like Prometheus or things like that which we are not going to discuss in this video so we will be more focusing on the built in tools and the sea advisor go and check this welcome back to network nazi youtube channel and continuing with the docker series this is going to be more interesting one we are going to check how we can monitor the resources right the docker monitoring part so first in the first section of the video we will be seeing the built in tools those are available inside the docker to get the real-time metrics and the container performances and then secondly we will be seeing if there are some third-party tools available which can give us much better monitoring of the docker host right so first let us try to run some containers I have some images here and I don't have any container running so I will be running some containers say docker container run I put it in the deit so I'll be using different different images that suppose first I use the Indian X so I use name I call it box 1 images Indian X alright this is the first container that I have run I will run another one which image I have got I'll call it the box to call it love learn Linux right web server version 1 this is our custom image which we use in the network no straining it has got a webserver pre-configured on CentOS machine so this is the second container are running and then sorry let me run the third one so I'll be calling it box 3 right so box 3 and in this I can use the normal CentOS machine sent to us that's all right so if I do a darker PS I have got three containers running so the first built-in tool which is available to us is the docker stats command so if you give the say docker stats - - health you will be able to get a lot of information about it so you can give - a to show you all the options all right you can specify a particular container so if I give a docker starts - a it will show me the output of all the containers which are currently running on my machine so what information it is giving me the number one it is showing me the CPU percentage right this this one is the first one which I am talking about so CPU percentage shows you how much of the available CPU the resource is consuming right how much of the available CPU the concurrent resource is consuming and then the memory usage and the limit block which tells you how much RAM the container is using it also shows you how much it can use the write the current and the limit it cannot go beyond this so because I hadn't specified any limits while creating the container so it is so it is consuming my docker host limit but we can limit it that we will be seeing it memory percentage obviously the percentage of RAM which the container is using and the network i/o write the total number of bandwidth which is being transferred in and out of the container so this can be given I do a control C here you can also use the docker strat and specify a particular container name say box one to find out the starts read it to a specific container so that can be done which is very interesting so it is a built in tool which you can use you can also use the docker logs for monitoring so let's check if I have got a docker PS so let me find out the logs of my engine X write the Box one so I can this is again a very interesting place to monitor your I give a docker logs and give the name box one so it will tell me the logs or show me the logs which are related to my box one container so you will be able to see the logs using the docker locks command which is very interesting so never mind about the output what it is coming up but yes we are able to view it so these are the normal things like the docker stats and you you can also use the same command like the docker stat - a is the right way to see the output of all the containers right which is good but if you though it is not required because it's going to be lengthy you can also give darker stats and then pass the output of the docker PS con docker PS - I say aq I can pass it so which is again going to show you the same output so it is much better to use the docker - starts - a to give you the output of like the statistics of all the containers which are running into your machine which is good now I can obviously I can stop a container by using the docker stop command I can any write any time stop it I can remove a container also so we have a lot of continuous running then docker top command is also there like we have our top command in Linux so we we have a docker top command also if I use it talked our top and then I can specify the container name and you can at any point of time use hyphen F and help so I need to specify the container name which container I intend to see so I gave here say top car top and engine X so let me show me the top running processes in this particular container right okay sorry we we have box one not the engine X engine X is the name of the image that's great so I have two processes running inside the engine X so in the same manner I can go for box two and box three right so I have got s to DVD running in our love learn Linux image so docker top can be used to specify the top running processes inside a container like the top command you give it on the host you can also go inside the container and give the same come and see if I give a docker PS I give a docker x''k right - IT interactive down terminal and I go to box - and I save in bash I go inside the container and then I then I can run the top command like this it's same stuff guys so either you go inside the container then and run the top command I press Q here or give a PS - right aux or PS - EF but for that you need to go inside the container the idea behind the docker top is that without going inside the container we are able to see how many processes are are running inside the container so that is a good way of monitoring your containers so you can use this which is again a good thing so these are the built-in types right so apart from this I do exit from here so if I give a docker PS - eh all the containers are running no container is in the exit state that's wonderful so guys these are the built-in tools that comes along with the docker machine right now thou very interesting thing that we are going to see is how can we have a advanced container resource analyst right how can I monitor it in a much more advanced manner the like analysis of the container resources in a much more advanced manner so we will be looking onto a tool recorded see advisor wonderful tool guys see advisor or see advisor or we call it container at advisor you can the full name is a container advisor alright in the short you call it see advisor you can use the see advisor tool so see advisor is a third-party tool right and it's actually a tool by Google so we will be seeing how to use the CSC advisor to collect the matrix and it will be displaying to me in a graphical manner that's very cool so see advisor click provides it it it actually runs all right as a container on the docker host so it has if I go slightly in the history of it this project is started actually by the Google as their internal tool right to get the monitoring of the containers of their own continuous tracks it is written in go we are not interested in that so we we will be seeing how we can run the see advisor so once the see advisor is installed it will run on the host and will capture the matrix like the dog starts right but it will give me in a much more detailed manner and it will give me a very decent UI so we will be running the see advisor as a container it's very simple guys the see advisor images available there so I I will be giving this command to run it so I already have some containers running so if I give add the okapi s these are the containers running so now I am running a C advisor so I give a docker container run right I can give it the detach mode so - D can be given or you can also give detached true this is again a way okay because the command is going to be landing I'm splitting the lines right so - - volume where it is going to store it so I put it here and I you might need to remember this but it is available on the github you can go and fetch it out in the read-only mode right and then the volume where run should be mounted separately and then this should be mounted under where run and this should be in the read write mode right and then the third volume we will also be mounting I have to check the Spelling's once I'm done so I am mounting where Lib docker and this should be mounted under where lambda Corrine the read-only mode live I am mounting my host volumes into the sea advisor try to understand that you read only and then I give I will be you using the port number eight zero eight zero two to access it so I give publish it you know it right so it's zero eight zero I'm not changing the port it's 0 and 0 and then the privileged is PRI so you it it will be running as root so go and read more about the privilege option PRI VI I always do that typo here trust me and believe me so I have to be very careful priv IL e GED right privilege true and the name of the container - - name I can give see adviser and you can give any name but it could to give see adviser and the image that I am going to use is from the Google see adviser latest one so I hope there is no typo error let me check it first docker container run - mode is true - - detach true then - Efrain volume root is mounted on root FS in a read-only mode then the volume vol ume volume where run is mounted in the where run in the read write mode then the sis oh I forgot the cyst so I have to go back i I forget the cyst so what I have to do I have to do a ctrl C here I'll run it again and and and and and and and I will be adding one more volume here so we're run is there where Lib docker is there I forget the cysts so I I can add it anywhere I'll be writing here or let me write it once again so it it will be good for you right let's do it again I don't want you to be confused stalker container run - - detach equal to true it's going to be lengthy one but we have to do it - - volume so first I am mounting the root under Brutus and it is in the read-only mode oh I forgot the equal to sorry volume equal to root mounted inside root FS in the read-only mode then another volume I have to mount Veyron remember that inside the barren this is going to be in the read write mode then the another volume I have to mind this one we skipped equal to cysts and it should be mounted under cysts in the read-only mode and - effing volume is where Lib docker that's the last one we're live docker should be mounted under where Lib docker in the read-only mode right so we had mounted for volumes 1 2 3 4 root Baron says varlet docker and I will be publishing it on the port number 8 0 would 8 0 not changing the port that this is a default put and then finally I'll be using the privilege priv I le GED privileged is true go and read about it what is this option does and the name of the container is sea advisor and finally I have to give the image names is Google see advisor right latest right so this is how you run the see advisor as a container I hope this is good yeah I feel good so if I give a docker PS here the see advisor is running can you see it says on on the top so now it is collecting the matrix of my three containers this is running so we have the seed advisor running so we will be going into the details how it can like gather the like the the matrix so we had used the privilege option remember this so this will the docker will be enabled to have the full access to the device on the host machine because we want it otherwise how the CA advisor is going to fetch the matrix right so docker like the looking all like the SELinux and everything so the privilege flag is to have the full access on the host machine so if you want you you can go and read about the prep the privilege flag more but I had given you a hint now a once it is done we should be able to access it right how we are going to access the matrix so it it it gives us a very decent UI all we have to do is that all I have to do is that I need to open the browser and access on the port number eight zero eight zero so I'm opening up my browser here I've got three containers running so I give HTTP slash slash either I can give localhost right or I can give my machine name I put it at eight zero eight zero I hope yeah it is running C advisor can you check it it's coming up won't take much time so this is a much better way of gathering the matrix just wait I hope it will run without a glitch seems to be running it might take some time in issue for the initial run or I can give my machine name also if this doesn't work but I don't think it's going to give me a problem just wait for a while come on come on you want yeah it is coming so here comes the Owls the brilliant and the intelligent out so here is your docker containers the route the total CPU the course the total ram it gives you a very decent kind of an analog dashboard like you got it in the in the top end of the musti's right that's the same way how much CPU the memory all the things so you can gather a lot of information from it so let us go and check about each container so this is a bird's eye view which which gives me the CPU and the RAM see here so I have got this much of memory still available or used right so you can get this how the CPU is getting consumed it's a live thing right so if the load is increasing it is going to show you in the same manner the usage per core will be given wonderful I like it and this is how actually you should be monitoring your docker and the usage breakdown the total memory right this is hot which is active and this is the total one right so this is the network we are not consuming anything on the network so it's not that much errors and all the things the file system used by the container stood so the total CPU the sub containers so this is a bird's eye view how many processes are running here so just check it out if I go here this I can go inside it so it's the same thing that we had used with the docker stats come on but it is giving me in a much better way so so if I you can also go and gather the information for a particular container also if you see there we have a lot of containers coming up right on the top so this is the total one right so if I go here suppose I wanted to check the docker container so I click on the docker container so these are the containers that we are running Wow all the four containers are coming up box one box two box three information about it the number of images I have got on this machine Wow that's wonderful the driver is overlay remember we are talked about the storage driver so now suppose I wanted to learn more about docker 1 I click here I click on the container and it will show me the details for a particular container that is wonderful that is good so just wait a while yep it gives me so how much a particular box one container is using the memory sorry I think I clicked somewhere else wait I lost it I have to click again no problem I will be doing it again as should it be / / localhost / it's red zero right see advice sometimes the mouse behaves in a weird manner so just great while it is I want you to see that right so we will be going onto the containers and you can gather information about any particular container which container you you wanted to give so this is a decent way of monitoring your containers rather than you using the built in tools which are the docker starts and all those commands which are good you you cannot undermine those commands those are the built in just a minute so we will be gathering a lot of information the network the file system but there is a problem here I will be explaining you the problem what is the problem with the C Advisor come on wake up and walk right how much CPU processes total number processes which is running core it's not it's slightly slow I don't know why we've got a decent amount of RAM and the computer available here right so these are the containers coming up here now I suppose I go to the box one here it is here so how much CPU how much RAM it is consuming you can get a lot of information about a particular container also right so you will be able to get it I will go back feel free to use box one box two box three anyone so you can go back here that is my top level right so gather information the only problem with the C advisor is that it is it is real-time right it it won't give you the historical data so if you wanted to gather what was the performance yesterday here the C advisor won't be able to help so there we have got tools like Prometheus and all those things that I'm going to take it in some other video but not this so this is what I wanted you to share the built-in tools and then how you can use the C advisor to monitor your docker host in a much better manner so I hope you have liked it don't forget to subscribe and like and P share your comments whatever you have for this video and I will be trying to be more ragged more regular so take care guys bye bye stay safe Godspeed you
Info
Channel: networknutsdotnet
Views: 5,539
Rating: undefined out of 5
Keywords: #networknuts, #network nuts, #docker training delhi, #docker containers, #docker monitoring, #docker top, #docker stats, #docker logs, #docker cadvisor, #alok srivastava, #docker videos, #docker container run, #docker container rm, #docker tutorials
Id: 1PWr6az9sM0
Channel Id: undefined
Length: 25min 20sec (1520 seconds)
Published: Mon Jul 06 2020
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.