{% include "_nav.html" %}

🔧 系统诊断

🕐 刷新时间: {{ refresh_time }}  ·  {{ docker_status_msg }} {% if started_at %} ·  诊断启用: {{ started_at[:19].replace('T', ' ') }}{% endif %}
{% if not diag_enabled %}

⛔ 诊断套件未启用

diagnostics.yaml: diagnostics.enabled = false
启用后将开启后台定时检测(三个定时器,CPU 占用可忽略)。
当前仅保留手动导出功能,自动规则引擎已停止。

📦 手动导出诊断包

{% else %}
规则总数
{{ rule_count }}
严重
{{ crit_count }}
警告
{{ warn_count }}
通过
{{ ok_count }}

⚠️ 规则检测

{% if all_rules %} {% for r in all_rules %}
{{ r.id }}
{{ { 'high': '严重', 'medium': '警告', 'low': '提示', 'info': '信息', 'ok': '通过' }.get(r.severity, '未知') }}  {{ r.message }}
{% if r.hint %}
💡 {{ r.hint }}
{% endif %} {% if r.evidence %}
{% for e in r.evidence %}{{ e }}{% if not loop.last %}\n{% endif %}{% endfor %}
{% endif %} {% if r.skipped and r.skip_reason %}
⏭️ 跳过原因: {{ r.skip_reason }}
{% endif %}
{% if r.run_at %}{{ r.run_at }}{% endif %} {% if r.run_by %}
{{ r.run_by }}{% endif %}
{% endfor %} {% else %}
暂无规则结果(定时器还没跑起来?)
{% endif %}

🧪 引擎状态

{% if engine_health %} {% for name, info in engine_health.items() %} {% endfor %}
引擎状态版本 / 详情
{{ name }} {% if info.get('ok') or info.get('available') %} 在线 {% else %} 离线 {% endif %} {% if info.get('version') %}版本: {{ info.version }}{% endif %} {% if info.get('signature_date') %}· 病毒库: {{ info.signature_date }}{% endif %} {% if info.get('rules_loaded') is not none %}· 规则: {{ info.rules_loaded }}{% endif %}
{% else %}
引擎健康信息不可用
{% endif %}
{% if docker_status == 'full' %}

🐳 容器运行状态

{% if docker_containers %} {% for c in docker_containers %} {% if 'meshsafe' in c.name %} {% endif %} {% endfor %}
容器状态健康Docker重启历史重启运行时长
{{ c.name }} {% if c.oom_killed %}OOM {% endif %} {{ c.status }} {% if c.health %} {% if c.health == 'healthy' %}✓ healthy {% elif c.health == 'unhealthy' %}✗ unhealthy {% elif c.health == 'starting' %}… starting {% else %}{{ c.health }}{% endif %} {% else %}—{% endif %} {% if c.restart_count and c.restart_count > 3 %} {{ c.restart_count }} {% else %} {{ c.restart_count if c.restart_count is not none else '-' }} {% endif %} {% if c.historical_restart_count and c.historical_restart_count > 0 %} {{ c.historical_restart_count }} {% else %} 0 {% endif %} {{ c.uptime or '—' }}
说明:Docker重启 = RestartCount(仅自动崩溃被拉起计数); 历史重启 = R015 检测到的 StartedAt/restart_count 变化(含手动 docker restart)
{% else %}
未发现 meshsafe 容器
{% endif %}
{% elif docker_status == 'partial' %}

🐳 容器运行状态 Docker 访问受限

部分容器信息不可用 — {{ docker_info.get('message', '') }}
{% elif docker_status == 'none' %}

🐳 容器运行状态 未启用

Docker 日志检测未启用 — 如需启用,在 docker-compose.yml 的 api 服务中加
volumes: /var/run/docker.sock:/var/run/docker.sock:ro
并确保 group_add: ["999"]
{% endif %} {% endif %}