Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to use Prometheus to collect custom parameters for your own server

2025-04-05 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/01 Report--

How to use Prometheus to collect custom parameters for your own server, I believe many inexperienced people are at a loss about this. Therefore, this paper summarizes the causes and solutions of the problem. Through this article, I hope you can solve this problem.

Use a simple example to illustrate.

I built the simplest server with express and http, listening on port 8081.

On metrics endpoint, I will print out how many requests the server has served since it was started. Here I simply use a counter maintained in memory to simulate the number of service requests. Each time metrics is requested, the counter is incremented by one.

Localhost:8081/metrics test:

Open the configuration file prometheus.yml for the Prometheus server:

To add a job, static_configs 's target is configured as my own server localhost:8081.

Localhost:9090 accesses Prometheus's web UI:

By switching to the graphical interface, you can see the trend graph of my server responding to service requests over time. The horizontal axis is the point in time, and the vertical axis is the service response request collected by the Prometheus server from my test server every 15 seconds by default.

After reading the above, do you know how to use Prometheus to collect custom parameters for your own server? If you want to learn more skills or want to know more about it, you are welcome to follow the industry information channel, thank you for reading!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report