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

Monitoring business services using prometheus and blackbox_exporte

2025-02-28 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

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

Here we share a blackbox_exporter for black box monitoring, which can be used to detect http,https,tcp,dns and ICMP protocols to grab data for monitoring. But what use does this solve for us?

We can monitor the status code of the service through blackbox_exporter. We can check which status codes are returned successfully in the code. The status code monitoring rules can be seen in the following figure.

In this way, we can judge whether the service is still working normally, whether the website is inaccessible, and monitor the service resources from the user's perspective. Of course, you can also monitor the validity period of certificates that support https here. As shown in the figure below, certificates with two domain names still have one and a half years to expire. As long as the data is collected, we can effectively alarm through the data, without having to write the expiration time of the extended service area monitoring certificate.

The same Blackbox_exporter can also do DNS resolution detection for domain names, try different DNS for domain name service resolution problems, such as the renderings I made here.

Similarly, blackbox_exporter, as described in Github, can do http, https, tcp, icmp, DNS and other probes, so you can collect data through your own needs and let the system data speak.

Here we talk about how to achieve these data collection and monitoring: The first step is to install, prepare a blackbox_exporter Agent, and let it act as an agent to collect data for us.

First of all, we should prepare a probe module as the configuration file blackbox_exporter.yml of blackbox_exporter. Here we use HTTP and DNS modules as demonstration cases.

Once the configuration file is ready, we can start running the blackbox_exporter container.

After running, check the runtime logs of some containers

Suppose we have Promtheus services out there. We can now write blackbox_exporter into the promotheus service

Take a closer look at the prometheus configuration file, we will find that the check items are found through dynamic files, where blackbox_dns.json is used to find the domain name to be checked, blackbox_http.json is used to find the configuration file that uses the http module to sniff the service normally. Below we need to add these two files to the sibling directory of the prometheus configuration file.

blackbox_dns.json

blackbox_http.json

In this way, we have achieved a demonstration of DNS and http probe pointers. Let's take a look at the Http module monitoring status in Prometheus.

Similarly, I use Grafana here to display icons for HTTP monitoring data. The IDs of the Dashboard shared here are 9965 and 7587.

【7587】

【9965】

We will share some technical articles from time to time. If you need them, you can pay attention to them.

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