EDA 监控告警:Prometheus + Grafana 盯住集群、License 与任务
EDA 运维最怕“用户先发现问题”:license 占满了用户才来报,磁盘满了仿真跑一半才死,节点挂了回归挂了一晚上没人知道。监控要覆盖三层:机器、license、任务。这篇讲 Prometheus + Grafana 在 EDA 环境里的落地做法。
一、监控什么
- 机器层:CPU、内存、磁盘容量和 inode、网络流量、节点存活。仿真机内存一满,任务直接被 OOM kill。
- license 层:各 feature 已用和总量、占用率曲线、排队等待的任务数。这是 EDA 特有的指标,通用监控没有。
- 任务层:LSF 队列积压、运行中任务数、失败率、长尾任务。回归失败率突然翻倍,往往是环境先出问题。
二、Prometheus + node_exporter 落地
# 在每台计算节点上装 node_exporter
useradd -rs /bin/false node_exporter
tar xzf node_exporter-1.8.0.linux-amd64.tar.gz -C /opt/
cat > /etc/systemd/system/node_exporter.service <<'EOF'
[Unit]
Description=Node Exporter
After=network.target
[Service]
User=node_exporter
ExecStart=/opt/node_exporter-1.8.0.linux-amd64/node_exporter
[Install]
WantedBy=multi-user.target
EOF
systemctl enable --now node_exporter
机器层用 node_exporter 就够了,CPU、内存、磁盘、网络全齐。Prometheus 的抓取间隔设 15 秒,保留 30 天;EDA 的故障排查经常要回看一周前的曲线,保留期别太短。
三、自定义 exporter:license 与 LSF 队列
license 和队列没有现成 exporter,自己写一个很简单:定时跑 lmstat 和 bqueues,解析结果按 Prometheus 文本格式吐出来。
# license_exporter.py(示意):把 lmstat 结果转成 Prometheus 指标
import re
import subprocess
from http.server import BaseHTTPRequestHandler, HTTPServer
def collect():
out = subprocess.check_output(
["lmstat", "-a", "-c", "27000@lic-server"], text=True)
lines = []
for line in out.splitlines():
m = re.match(r"Users of (\S+):.*Total of (\d+) licenses issued;"
r" Total of (\d+) licenses in use", line)
if m:
feature, total, used = m.group(1), m.group(2), m.group(3)
lines.append(f'eda_license_total{{feature="{feature}"}} {total}')
lines.append(f'eda_license_used{{feature="{feature}"}} {used}')
return "\n".join(lines) + "\n"
class Handler(BaseHTTPRequestHandler):
def do_GET(self):
body = collect().encode()
self.send_response(200)
self.send_header("Content-Type", "text/plain")
self.end_headers()
self.wfile.write(body)
HTTPServer(("0.0.0.0", 9101), Handler).serve_forever()
四、Grafana 看板
- license 占用曲线:各 feature 一张图,占用率叠总量,一眼看出哪个 feature 长期在 90% 以上。
- 队列积压:各队列 PEND 任务数,积压爬升就是资源不够的信号。
- 节点负载 Top:内存和 CPU 最高的十台机器,OOM kill 之前就能看到。
- 回归成功率:按天统计 pass/fail,失败率突增先查环境再查用例。
五、告警规则与值班响应
# 告警规则示例(Prometheus rules)
- alert: LicenseHighUsage
expr: eda_license_used / eda_license_total > 0.85
for: 15m
labels:
severity: warning
annotations:
summary: "license {{ $labels.feature }} 占用率超过 85%"
- alert: DiskAlmostFull
expr: (1 - node_filesystem_avail_bytes / node_filesystem_size_bytes) > 0.85
for: 10m
labels:
severity: critical
告警分两级:warning 进群里,critical 打电话。值班响应要有记录:谁接的、怎么处理的、多长时间恢复,事后复盘进文档。监控的终点不是看板好看,是故障发生时比用户先知道。
一句话总结:机器层用现成 exporter,license 和队列自己写,Grafana 只放四张图,告警只设真正需要半夜起来的那几条。监控不在多,在准。
声明:本站所有文章,如无特殊说明或标注,均为本站原创发布。任何个人或组织,在未征得本站同意时,禁止复制、盗用、采集、发布本站内容到任何网站、书籍等各类媒体平台。如若本站内容侵犯了原著者的合法权益,可联系我们进行处理。






