In this tutorial we’re learning about Prometheus Introduction and Architecture. Prometheus is a great DevOps Monitoring Tool. We’re going to go through Prometheus architecture. So different components that it contains and also some of these key characteristics. It became so widely accepted and popular especially in containerized environment.
Especially in containerized environments. The Prometheus was created to monitor highly dynamic container environments like Kubernetes docker swarm etc.
However it can also be used in a traditional non container infrastructure. Where you have just bare-metal servers with applications deployed directly on them. So over the past years Prometheus has become the mainstream monitoring tool of choice in container and micro service world.
Prometheus offers such automated monitoring and alerting. Is exactly what as a part of a modern DevOps workflow So how does Prometheus actually work or how does it architecture actually looks like and its core the block diagram is given below:
Prometheus has the main component called Prometheus server. That does the actual monitoring work and is made up of three parts:
- Time series database
- Data retrieval worker
- Accepts PromQL Queries
1. Time series database
It has a time series database that stores all the metrics data like current CPU usage or a number of exceptions in an application .
2. Data retrieval worker
It has a data retrieval worker that is responsible for getting or pulling those metrics from applications services servers. Other target resources and storing them and pushing them into that database.
3. Accepts PromQL Queries
It has a web server or server API that accepts queries for that stored data. That web server component or the server API is used to display the data in a dashboard or UI either through Prometheus dashboard. Some other data visualization tool like graph Anna.
The Prometheus server monitors Linux server or Windows Server it could be a standalone server a single application or service like database. That Prometheus monitors are called targets.
Each target has units of monitoring for Linux server target it could be current CPU status its memory usage disk space usage etc.
For an application for example it could be a number of exceptions number of requests or request duration. That unit that you would like to monitor for a specific target is called a metric. Metrics are what gets saved into Prometheus database component.
Prometheus defines human readable text based format for these metrics metrics entries or data has type. Help attributes to increase its readability so help is basically a description.
Just describe what the metrics is about and type is one of three metrics types for metrics about. How many times something happened like number of exceptions that application had.
Number of requests it has received there is a counter type metric that can go both up and down is represented by a example.
What is the current value of CPU usage now or what is the current capacity of disk space now. What is the number of concurrent requests at that given moment. For tracking how long something took or how big for example the size of a request was there is a histogram type.
So now the interesting question is how does Prometheus actually collect those metrics from the targets. Prometheus pulls metrics data from the targets from an HTTP endpoint. Which by default is host address slash metrics and for that to work one targets must expose that slash metrics endpoint. Two data available at slash metrics endpoint must be in the format that Prometheus understands.
You don’t need extra work to gather metrics from them but many services. Don’t have native Prometheus endpoints so extra component is required to do that.
This component is exporter so exporter is basically a script or service. That fetches metrics from your target and converts them in format. It understands and exposes this converted data at its own slash metrics endpoint.
It has a list of exporters for different services like MYSQL, Elasticsearch, Linux server built tools cloud platforms.
Conclusion : Finally, you have learning about Prometheus Introduction and Architecture. If you have any query about this topic you can use the comment section below.