{% extends "ewoooc_base.html" %} {% block title %}基礎設施生命線{% endblock %} {% block ewooo_content %} {% set down = namespace(count=0) %} {% for h in ollama_hosts %}{% if not h.healthy %}{% set down.count = down.count + 1 %}{% endif %}{% endfor %} {% set active_playbooks = namespace(count=0) %} {% for p in playbook_ranking %}{% if p.is_active %}{% set active_playbooks.count = active_playbooks.count + 1 %}{% endif %}{% endfor %} {% set throttled = namespace(count=0) %} {% for provider, info in throttle_state.items() %}{% if info.throttled %}{% set throttled.count = throttled.count + 1 %}{% endif %}{% endfor %}
基礎設施生命線 · AI 建議服務 / 工具服務 / 自癒

基礎設施生命線

先看 AI 建議服務、工具服務與自癒是否正常,避免 AI 建議與比價流程中斷。

建議服務離線
{{ down.count }}{{ ollama_hosts|length }} 台即時探測
AIOps 未解
{{ aiops_summary.incidents_open if aiops_summary else '—' }}7 日事件未解決
自癒成功率
{{ "%.0f"|format(aiops_summary.heal_success_rate) if aiops_summary else '—' }}{% if aiops_summary %}%{% endif %}近 7 日自癒成功率
節流供應商
{{ throttled.count }}成本節流供應商
建議服務

AI 建議服務主機

{{ '需要處理' if down.count > 0 else '全部在線' }}
{% for h in ollama_hosts %}
{{ h.label }} {% if h.healthy %}執行環境正常{% else %}異常{% endif %}
{{ h.host }}
{% if h.error %}
{{ h.error }}
{% endif %}
{% for m in h.models %}{{ m }}{% endfor %} {% if not h.models %}無服務資料 / 未連線{% endif %}
{% if h.unhealthy_mark %}30 秒異常標記{% endif %} {% if h.unhealthy_mark or not h.healthy %}{% endif %}
{% endfor %}
{% if health_history %}
24 小時探測歷史

健康趨勢摘要

{% for h in health_history %}{% endfor %}
角色總探針正常離線在線率平均 ms
{{ h.host_label }}{{ h.total }}{{ h.up_count }}{{ h.down_count }}{{ "%.1f"|format(h.uptime_pct) }}%{{ h.avg_ms }}
{% endif %}
{% if throttle_state %}
成本節流

成本節流狀態

{% for provider, info in throttle_state.items() %}{% endfor %}
供應商已花費預算月底推估使用率狀態
{{ provider }}${{ "%.2f"|format(info.spent) }}${{ "%.2f"|format(info.budget) }}${{ "%.2f"|format(info.projected) }}{{ "%.0f"|format(info.ratio * 100) }}%{% if info.throttled %}已節流{% else %}正常{% endif %}
{% endif %} {% if mcp_24h %}
工具工作量

工具服務 24h 工作量

{% for s in mcp_24h %}{% endfor %}
服務呼叫成功率快取工具平均成本
{{ s.server }}{{ "{:,}".format(s.total_calls) }}{{ "%.1f"|format(s.success_rate) }}%{{ "%.1f"|format(s.cache_rate) }}%{{ s.tools_used }}{{ s.avg_ms }} ms${{ "%.4f"|format(s.total_cost) }}
{% endif %}
事件紀錄

最近 10 筆事件

{% if recent_incidents %}{% set task_labels = {'ElephantAlphaAutonomousEngine': 'AI 自癒監控', 'run_icaim_analysis_task': '市場分析任務'} %}{% set error_labels = {'ollama_unhealthy': 'AI 建議服務不穩', 'scheduler_task_failure': '排程任務異常', 'crawler_timeout': '資料擷取逾時', 'python_exception': '程式例外'} %}{% for i in recent_incidents %}{% endfor %}
時間任務問題等級狀態處置提醒
{{ i.created_at }}{{ task_labels.get(i.task_name, '系統任務') }}{{ error_labels.get(i.error_type, '系統異常') }}{{ i.severity }}{{ i.status }}{% if i.error_type == 'ollama_unhealthy' %}AI 建議服務暫時不穩,已進入自癒監控。{% elif i.error_type == 'python_exception' %}資料流程發生程式例外,需由修復流程處理。{% elif i.error_type == 'scheduler_task_failure' %}排程任務異常,需確認下次執行是否恢復。{% else %}系統事件已記錄,請依狀態追蹤後續是否恢復。{% endif %}
{% else %}
尚無事件紀錄
{% endif %}
自癒紀錄

最近 10 筆自癒

{% if recent_heals %}{% for h in recent_heals %}{% endfor %}
時間動作結果耗時細節
{{ h.created_at }}{{ h.action_type or '—' }}{% if h.result == 'success' %}成功{% elif h.result == 'failed' %}失敗{% else %}{{ h.result }}{% endif %}{{ h.duration_ms }} ms{{ h.action_detail }}
{% else %}
尚無自癒紀錄
{% endif %}
{% if embed_queue_pending > 0 or embed_queue_failed > 0 %}
Embedding 重試佇列:待處理 {{ embed_queue_pending }} 筆 · 失敗 {{ embed_queue_failed }} 筆
{% endif %}

AI 基礎設施生命線

{% set host_health_payload = { 'healSparkline': aiops_summary.heal_sparkline | default([]) } %} {% endblock %}