Use a simple example to illustrate.
I built a simple server with Express and HTTP, listening on port 8081.
On the Metrics endpoint, I’ll print out how many requests this server has served since startup. Here I simply use a counter maintained in memory to simulate the number of service requests. Every time metrics is requested, the counter is incremented by one. Localhost :8081/metrics
Open the promethe. yml configuration file on the Prometheus server:
Add a job with the target of static_configs set to my own server localhost:8081.
Localhost :9090 Access Prometheus web UI:
Switch to the graphical interface and you can see the trend of my server responding to service requests over time. On the horizontal axis are points in time, and on the vertical axis are service response requests collected by the Prometheus server from my test server at default intervals of 15 seconds.
For more of Jerry’s original articles, please follow the public account “Wang Zixi “: