Getting Started with Prometheus | Minimal Setup (Download, Config & Run)

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
hi everyone I'm Julius and in this video we're going to download configure and run Prometheus in the most minimal way possible so we're literally only going to make it pull metrics from itself and from some demo targets that are already running on the internet and we're going to keep alerting dashboarding or anything else besides bear metrics collections for later videos so this is just to give you an idea of what the install process looks like and how easy it is to get started and by the way if you are a completely new to Prometheus I made this other video up here that gives you a high level introduction to its main Concepts and features so you might want to check out that one first anyway let's get going [Music] all right so we start out by heading to the Prometheus homepage at prometheus.io and going to the downloads page and we can find tables on here with pre-built binaries for some of the most common OS and architecture combinations but just in case yours isn't listed here you can also go check out the GitHub releases page which has a far wider selection of Platforms in my case though I'm on Linux and amd64 so I will download that now I'll head to a terminal here and I go to where I just downloaded the tarball then we can unpack the tower ball using the tar command change into the unpacked directory and let's check out which files got extracted here so we can see some license and boilerplate files as well as these other consoles related directories that you will almost never need since they're only needed for some super optional features in Prometheus so just to show you that I'm going to remove everything in here that's not essential so this prompt tool command line tool can often be helpful for checking configs running queries or other debugging and testing purposes but we don't need it today so I'm also just going to remove it okay so the only thing we need to run Prometheus is a config file and the Primitive server binary itself so let's edit the config file here and remove its existing contents so we can start from scratch we're going to be adding two top level configuration sections the first one is the global section which allows us to set a number of global defaults for prometheus's behavior and in this case we are just going to set the default scrape interval to 5 Seconds actually five seconds is really aggressive and not common at all for most production setups but this way we get data to play with really quickly the second section is the scrape config section that tells Prometheus which targets it should monitor how it should discover and scrape them and what labels to apply to each Target so in our case we are going to keep it simple and not use any service Discovery instead we are just going to hard code targets right into the configuration file first we are going to add a scrape configuration to make Prometheus pull metrics from itself so of course the Primitive server also exposes metrics in the Prometheus format about its own inner workings so every scrape configuration needs to have a job name field that sets the default value for the job label for any pulled Time series so the job label in Prometheus is usually used to group together one or multiple targets of the same type for example multiple replicated instances of an API server in the case of the Prometheus server there's only one Target and since the server will be listening on Port 1990 that is the TCP scrape address we are going to configure by default the endpoint that perimeters will scrape is slash metrics over plain HTTP but you can override this in many other HTTP and authentication settings if you need to as a second scrape config we're going to add three instances of a demo service that prom Labs is running publicly on the internet and the nice thing about Prometheus is pull-based monitoring model is that we can just pull metrics from these demo service instances without having to reconfigure or letting them know in any way alright so that's all we need as a minimal config to get started so let's have a look at the Prometheus server binary here if you're curious about all the command line Flags it supports you can run it with a dash dash help flag to see all the options but most of them already have reasonable defaults and by default Prometheus will load its configuration from a file called Prometheus yaml so that's the file we just edited and it'll store the collected metrics in a data subdirectory of its current working path and finally it'll start listening on Port 1990 after startup so we can actually start Prometheus without setting any flags at all as you can see Prometheus starts up and blocks some life cycle events to the terminal and everything looks good so now let's head to its web interface in the browser the web interface gives you a bunch of different status pages that tell you about build and runtime information of the server and it also allows you to query and visualize the collected data using the promql query language a good first thing to check on any new Prometheus setup is whether the targets we just configured are actually being scraped correctly by going to the targets overview page as we can see here all four targets are listed with a state of up meaning that Prometheus has already successfully scraped metrics from each of them in general the targets page is a great place to go to for figuring out whether all target scrapes are working fine and it'll also show you detailed errors in case anything is going wrong here okay we should be getting metrics both from the Prometheus server itself and from the demo service now so let's head over to the graph page which we also call the expression browser where we can enter prompt ql queries and evaluate them to show the results either as a table or as a graph over time and as you can see here the auto completion is already showing us a bunch of metric names prefixed with Prometheus which are metrics coming from Prometheus itself so let's enter an example query here to show a counter metric that tracks the total number of samples that Prometheus has ingested so far we can see the current value of this metric in the table view but we can also switch over to the graph view to see the metric developing over time and since a counter metric usually only goes up over time we are interested in its rate of increase rather than the raw value so let's compute that instead using the rate function we can query the demo service metrics in just the same way so let's for example query for the services 90th percentile request duration split up by the path label on the underlying metric now I won't go into the details of the promptl query in this video but for sure we're going to be talking much more about prompt ql in the future all right we now got a minimal primitive server running and we got an idea how to use its web interface to check the configuration and whether everything is working correctly and how to query the data and of course there's many other ways you could download and run Prometheus like using Docker or a package coming with your Linux distribution but I just wanted to start with a raw binary here to make it clear what's happening and in future videos I'll go into dashboarding alerting instrumentation exporters various Integrations and best practices so be sure to like And subscribe if you found this video helpful and want to learn more in the future and if you want to learn Prometheus in more depth right now check out my self-paced training courses at training.promlabs.com and I'll see you in the next one
Info
Channel: Prometheus Monitoring with Julius | PromLabs
Views: 17,311
Rating: undefined out of 5
Keywords: prometheus, monitoring, time series, metrics, querying, downloading, configuring, running, installing, minimal, tutorial, guide, howto
Id: OxZmn4svOyA
Channel Id: undefined
Length: 8min 7sec (487 seconds)
Published: Mon Dec 19 2022
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.