{D2} - Prometheus配置详解之global,alerting,rule_files,scrape_configs,remote_read,remote_write

六二三
今天这里就不做过多解释了,直接上配置,可以先对prometheus的配置参数有个了解。 global: # 抓取指标的间隔,默认1m scrape_interval: 10s # 抓取指标的超时时间,默认10s scrape_timeout: 15s # 指定Prometheus评估规则的频率[记录规则(record)和告警规则(alert)],默认1m. # 可以理解为执行规则的时间间隔 evaluation_interval: 15s # PromQL查询日志的相关记录文件,有点类似mysql slowlog query_log_file: prometheus_query_log # 用于区分不同的prometheus external_labels: datacenter: 'hangzhou-1' region: 'huadong' # Alertmanager configuration alerting: alertmanagers: - static_configs: - targets: - 192.168.56.11:9093 alert_relabel_configs: - source_labels: [dc] regex: (.+)\d+ target_label: dc - source_labels: "host" target_label: "instance" regex:

{D1} - Prometheus初识和服务部署

六二三
+++ 第一部分:Prometheus简介及一些必要的名词解释 +++ From metrics to insight Power your metrics and alerting with the leading open-source monitoring solution. 从指标到洞察力,使用领先的开源监控解决方案为您的数据指标和警报提供助力。 什么是Prometheus? Prometheus是一个开源系统监控和警报工具包,最初在 SoundCloud构建。自 2012 年成立以来,许多公司和组织都采用了 Prometheus,该项目拥有非常活跃的开发者和用户社区。它现在是一个独立的开源项目,独立于任何公司维护。为了强调这一点,并明确项目的治理

Using Raspberry PI to flash Esp-01s with Micropython firmware

六二三
Flashing esp-01s micropython firmware workflow raspberrypi4B board <---> esp-link <---> esp-01s board Download micropython firmware for esp-01s 1M // https://micropython.org/download/esp8266-1m/ wget -c https://micropython.org/resources/firmware/esp8266-1m-20210902-v1.17.bin Flashing with Thonny IDE // Install flash tool - esptool pip3 install -U esptool // find connect esp01s port dmesg|grep tty // check esp01s board info esptool.py -p /dev/ttyACM0 flash_id

Split string with multiple delimiters in Python

六二三
Python string split() method allows a string to be easily split into a list based on a delimiter. Though in some cases, you might need the separation to occur based on not just one but multiple delimiter values. This quick 101 article introduces two convenient approaches this can be achieved in Python. Split String With Two Delimiters in Python Assume the following string. text = "python is, an easy;language; to, learn." For our example, we need to split it either by a semicolon followed by a space ;, or by a comma followed by a space ,. In this case, any occurrences of singular semicolons or commas i.e. , , ; with no trailing spaces should not be concerned. Regular Expressions A delimiter is a sequence of one or more characters used to specify the boundary between separate, independent regions in plain text or other data streams. An example of a delimiter is the comma character, which acts as a field delimiter in a sequence of comma-separated values. Use Basic Expression Python’s built-in module re has a split() method we can use for this case. Let’s use a basic a or b regular expression (a|b) for separating our multiple delimiters. import re text = "python is, an easy;language; to, learn." print(re.split('; |, ', text)) Output: ['python is', 'an easy;language', 'to', 'learn.'] As mentioned on the Wikipedia page, Regular Expressions use IEEE POSIX as the standard for its syntax.