4a1d949e41
完整 Web 管理平台,涵盖: P0 生产加固: - 会话超时(空闲+绝对) + CSRF 防护 + 登录失败限流 - HTTPS/TLS 证书管理(自签生成/上传/删除/过期提醒) - SSL Bump (HTTPS 透明代理) 可视化配置 - 配置文件 diff 预览 + 二次确认才写入 - 服务控制二次确认 + 操作期间按钮锁定 P1 运维能力: - 日志轮转管理(logrotate) + 日志状态监控 - 告警规则(5xx/命中率/磁盘/客户端流量) - 多 Squid 实例管理 + 一键切换 - squidclient mgr 实时性能指标 - 流量异常检测(突增/大文件/高频小包/新客户端) P2 日志分析增强: - 日志持久化到 SQLite + 历史时间范围查询 - 导出 CSV/JSON(日志/KPI/异常/审计) - GeoIP 地图(Leaflet + ip-api.com 离线可选 GeoLite2) - 每客户端 24h 趋势图 - 自定义 Squid logformat 解析器 P3 体验锦上添花: - 暗/亮主题切换(cookie 持久化) - WebSSH 终端(xterm.js + paramiko) - 完整审计日志 + 用户管理 技术栈: Flask 3.0 + SQLAlchemy 2.0 + SQLite + Chart.js + Leaflet 总代码量: ~16500 行 (15 Python 模块 + 34 模板 + CSS) 路由数: 73
72 lines
2.2 KiB
HTML
72 lines
2.2 KiB
HTML
{% extends "base.html" %}
|
||
{% block title %}告警历史 - Squid Manager{% endblock %}
|
||
{% block content %}
|
||
<div class="page-header">
|
||
<h1>📜 告警触发历史</h1>
|
||
<div class="page-actions">
|
||
<a href="{{ url_for('alerts_view') }}" class="btn btn-secondary btn-small">← 返回告警规则</a>
|
||
</div>
|
||
</div>
|
||
|
||
<div class="card">
|
||
<p class="card-desc">最近 {{ triggered | length }} 次实际触发 (来源 audit_log, action=<code>alert_triggered</code>),
|
||
以及最近 {{ extras | length }} 条规则管理事件 (添加/保存/删除/评估)。</p>
|
||
|
||
<h3 class="card-title">🚨 触发记录 ({{ triggered | length }})</h3>
|
||
{% if triggered %}
|
||
<div class="table-scroll">
|
||
<table class="data-table">
|
||
<thead>
|
||
<tr>
|
||
<th style="width:180px;">时间</th>
|
||
<th style="width:120px;">用户</th>
|
||
<th>详情</th>
|
||
</tr>
|
||
</thead>
|
||
<tbody>
|
||
{% for a in triggered %}
|
||
<tr>
|
||
<td class="time-cell">{{ a.timestamp_local }}</td>
|
||
<td>{{ a.username }}</td>
|
||
<td class="detail-cell">{{ a.detail }}</td>
|
||
</tr>
|
||
{% endfor %}
|
||
</tbody>
|
||
</table>
|
||
</div>
|
||
{% else %}
|
||
<p class="meta-text">还没有触发记录。在 <a href="{{ url_for('alerts_view') }}">告警规则</a> 页面点击 “立即评估” 即可触发评估。</p>
|
||
{% endif %}
|
||
</div>
|
||
|
||
<div class="card">
|
||
<h3 class="card-title">⚙️ 规则管理事件 ({{ extras | length }})</h3>
|
||
{% if extras %}
|
||
<div class="table-scroll">
|
||
<table class="data-table">
|
||
<thead>
|
||
<tr>
|
||
<th style="width:180px;">时间</th>
|
||
<th style="width:120px;">用户</th>
|
||
<th style="width:140px;">操作</th>
|
||
<th>详情</th>
|
||
</tr>
|
||
</thead>
|
||
<tbody>
|
||
{% for a in extras %}
|
||
<tr>
|
||
<td class="time-cell">{{ a.timestamp_local }}</td>
|
||
<td>{{ a.username }}</td>
|
||
<td><code>{{ a.action }}</code></td>
|
||
<td class="detail-cell">{{ a.detail }}</td>
|
||
</tr>
|
||
{% endfor %}
|
||
</tbody>
|
||
</table>
|
||
</div>
|
||
{% else %}
|
||
<p class="meta-text">暂无管理事件。</p>
|
||
{% endif %}
|
||
</div>
|
||
{% endblock %}
|