UNLIMITED
Collect and graph metrics with Python
We collect metrics because we want to explore and understand a situation. This is usually because there’s a need to improve the performance of a system and eliminate bottlenecks. Therefore, when collecting metrics, always bear in mind the problem that needs solving or the system that we want to understand better, else the amount of metrics you could collect would become overwhelming! It’s a good idea to have a scenario in mind and then try to collect the appropriate metrics.
This tutorial will explain how to use Python 3 to collect metrics and enable Prometheus to pull and store them, using practical scenarios that include Linux System metrics, and metrics from the timing of database servers.
Prometheus has basic visualisation capabilities that are only useful for debugging purposes. As a result, there’s no point in keeping metrics in Prometheus or any other data storage if you’re not going to visualise them in another piece of software. In this tutorial we’ll visualise the metrics in Grafana, but feel free to use any visualisation software you’re comfortable with.
Docker-compose
For the purposes of this tutorial, we are going to use a docker-compose.yml file to run and use and . Later on, we’re going to add more Docker images,) shows the initial version docker-compose.yml – this version is for running and only because these are the essential parts of the process. The prometheus directory is where the configuration file (prometheus.yml) is stored.
You’re reading a preview, subscribe to read more.
Start your free 30 days