In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/03 Report--
Here are some of the pits I encountered when developing my own Prometheus Exporter. The so-called pits are actually several key points that need to be noticed in the development process, which, if ignored, may lead to errors and unexpected results.
If you don't know anything about Prometheus, you can Google or Baidu yourself, or you can take a look at one of my previous articles. Prometheus is a working mode based on Pull, which needs to collect data from the Agent side on a regular basis and store it into the database. The Agent here is called Exporter. There are many mature expoter available on the official website and in the community, such as node_exporter for monitoring linux machines, mysqld_exporter for monitoring mysql, and so on. Most of the here are written in the GE language, in fact, after understanding the working principles of Exporter and Prometheus, we know that exporter actually converts the collected data into text format, and exposes the interface to provide http requests, so it is very easy to achieve one by yourself, you do not have to rigidly use that language, you can use Java, PHP or Python, whatever you are good at. I have written an Exporter to monitor vSphere Datastore using the Python Flask framework here. You need to pay attention to several points in the development process:
The overall text data format of Exporter:
Exporter returns text content, where blank lines are ignored in behavior units, and the last behavior blank line of text content
Behavior comments that start with "# HELP" to indicate help information, and lines that begin with "# TYPE" indicate the type of this Metric
Exporter has four data types, which are: counter/gauge/histogram/summary.
The format of each line of text in Exporter
There can be no spaces at the end of each line of text, otherwise it will not be recognized
Each Metric line represents a pair of Key and Value, and the value of Value is of type float. If there are two values, the last
One is considered to be a timestamp to save, such as:
Http_requests_total {method= "post", code= "200"} 1027 1395066363000
The value of Metrics's Label must be enclosed in double quotation marks.
The Content-Type of Exporter must be of type text:
Here the Content-Type of the returned page of my flask is set to: text/plain
4. Prometheus has its own client of python:
The address of the project is as follows:
Https://github.com/prometheus/client_python
If you don't want to repeat the wheel, you can choose to use the lient end provided on the official website.
5. Response time of Exporter interface
The default Prometheus is to fetch data every 15 seconds, and the timeout timeout for each time is 10s, which can also be customized in the configuration file. Note that the interface response time of Exporter must be smaller than that of server configuration.
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.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.