需求设计
Prometheus的blackbox_exporter组件,可探测网站(80、443端口)、端口的运行状态。
云景系统的运维模块,用户可自行添加网站、端口的监控任务。
坤元系统需要根据云景系统添加的监控任务,调整Prometheus的配置文件并动态加载,固需要坤元系统接管Prometheus配置。
使用场景
- 云景系统运维模块,站点分类的网站状态、端口状态
- 态势大屏,核心服务站点状态
配置要求
- Prometheus服务(中坤系统同一主机)
- blackbox_exporter服务(中坤系统同一主机)
- alertmanager服务
- mimir服务
配置方法
坤元系统 - 全局配置 - 站点参数
- prometheus服务地址
http://127.0.0.1:9090
- promtheus基础配置文件
global: scrape_interval: 30s evaluation_interval: 30s alerting: alertmanagers: - static_configs: - targets: - zhongkun.cstcloud.cn # 告警发送至一体化云服务平台中坤系统 - xxxxkunyuan.cstcloud.cn # 告警发送至当前坤元系统 scheme: https - static_configs: - targets: - localhost:9093 # 告警发送至当前alertmanager rule_files: - rules-vm.yml - rules-host.yml - rules-ceph.yml - rules-tidb.yml - rules-web.yml scrape_config_files: - prometheus_exporter_node.yml # 主机监控 - prometheus_exporter_ceph.yml # Ceph监控 - prometheus_exporter_tidb.yml # TiDB监控 - prometheus_blackbox_http.yml # 网站监控(动态) - prometheus_blackbox_tcp.yml # 端口监控(动态) remote_write: - url: http://localhost:9009/api/v1/push # Mimir服务地址
- promtheus blackbox http 配置文件模板
- job_name: '{url_hash}' metrics_path: /probe params: module: [http_2xx] static_configs: - targets: - '{url}' labels: group: web relabel_configs: - source_labels: [__address__] target_label: __param_target - source_labels: [__param_target] target_label: url - target_label: __address__ replacement: {local_ip}
- promtheus blackbox tcp 配置文件模板
- job_name: '{tcp_hash}' metrics_path: /probe params: module: [tcp_connect] static_configs: - targets: - '{tcp_url}' labels: group: tcp url: {tcp_url} relabel_configs: - source_labels: [__address__] target_label: __param_target - target_label: __address__ replacement: {local_ip}
- promtheus exporter node 配置文件
scrape_configs: - job_name: xxxx_hosts_node_metric static_configs: - targets: - 10.16.x.1:9100 - 10.16.x.2:9100 - 10.16.x.3:9100 - 10.16.x.4:9100 - 10.16.x.5:9100 - job_name: xxxx_vms_node_metric static_configs: - targets: - 10.16.x.24:9100 - 10.16.x.25:9100 - 10.16.x.26:9100 - 10.16.x.27:9100 - 10.16.x.28:9100
- promtheus exporter tidb 配置文件
scrape_configs: - job_name: xxxx_tidb_metric static_configs: - targets: - 10.16.x.249:22020 - 10.16.x.246:19100 - 10.16.x.247:19100 - 10.16.x.248:19100 - targets: - 10.16.x.246:2379 - 10.16.x.247:2379 - 10.16.x.248:2379 labels: group_type: pd - targets: - 10.16.x.246:10080 - 10.16.x.247:10080 - 10.16.x.248:10080 labels: group_type: tidb - targets: - 10.16.x.246:20180 - 10.16.x.247:20180 - 10.16.x.248:20180 labels: group_type: tikv
- promtheus exporter ceph 配置文件
scrape_configs: - job_name: xxxx_ceph_metric static_configs: - targets: - 10.16.x.1:9283
中坤系统 - 全局配置 - IP访问白名单
- 添加告警接收API白名单0.0.0.0/0