The code
VISUALISING IN GRAFANA
»PROMETHEUS DATA TYPES
Get it from linuxform at. com/archives and on the DVD
The quickest way to start using Grafana is by downloading and executing its official Docker image. This means that apart from the Docker image, you won’t need to download, set up or install anything else for Grafana to work. However, you’ll still need to define the port number that Grafana listens to as well as the local directory where Grafana will store its files in order to have data persistency.
Prometheus pulls data from its sources, which means it acts as a client in order to get its data. This is a crucial detail that you should keep in mind while developing applications that collect Prometheus metrics. In practice, this means that apart from collecting the desired metrics, the Python script should also offer support for HTTP connections each time Prometheus asks for metrics.
In order to plot data, you first need to obtain that data. In the case of Grafana, data comes from one or more data sources. A Grafana Data Source is a data base, file or service that provides data to Grafana – the program won’t work without data. Prometheus is going to act as the Grafana data source in this tutorial.
Prometheus supports four different types of data:
OUR EXPERT
The visualisation process is described as follows: Go to http://localhost:3000 to connect to Grafana – use a different hostname if Grafana is a different machine.
>Counter This is a cumulative value that’s used for representing increasing counters. The value of a counter can stay the same, go up or be reset to zero, but it can’t decrease. Counters are usually used to represent cumulative values such as number of requests served so far or the total number of errors.
Mihalis Tsoukalos