674 lines
23 KiB
HTML
674 lines
23 KiB
HTML
<!DOCTYPE html>
|
||
<html lang="zh-CN">
|
||
<head>
|
||
<meta charset="UTF-8">
|
||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||
<title>Jenkins资源消耗告警</title>
|
||
<style>
|
||
* {
|
||
margin: 0;
|
||
padding: 0;
|
||
box-sizing: border-box;
|
||
font-family: 'Segoe UI', 'Microsoft YaHei', Arial, sans-serif;
|
||
}
|
||
|
||
body {
|
||
background-color: #f5f7fa;
|
||
color: #333;
|
||
line-height: 1.6;
|
||
padding: 20px;
|
||
}
|
||
|
||
.email-container {
|
||
max-width: 800px;
|
||
margin: 0 auto;
|
||
background: #ffffff;
|
||
border-radius: 12px;
|
||
box-shadow: 0 6px 18px rgba(0, 0, 0, 0.1);
|
||
overflow: hidden;
|
||
}
|
||
|
||
.email-header {
|
||
background: linear-gradient(135deg, #FF9800 0%, #F57C00 100%);
|
||
color: white;
|
||
padding: 30px;
|
||
text-align: center;
|
||
position: relative;
|
||
}
|
||
|
||
.email-header h1 {
|
||
font-size: 28px;
|
||
margin-bottom: 10px;
|
||
display: flex;
|
||
align-items: center;
|
||
justify-content: center;
|
||
gap: 12px;
|
||
}
|
||
|
||
.status-badge {
|
||
display: inline-block;
|
||
background: rgba(255, 255, 255, 0.25);
|
||
padding: 8px 20px;
|
||
border-radius: 20px;
|
||
font-size: 15px;
|
||
font-weight: 600;
|
||
margin-top: 10px;
|
||
backdrop-filter: blur(5px);
|
||
}
|
||
|
||
.email-body {
|
||
padding: 30px;
|
||
}
|
||
|
||
.section {
|
||
margin-bottom: 30px;
|
||
}
|
||
|
||
.section-title {
|
||
font-size: 20px;
|
||
color: #F57C00;
|
||
margin-bottom: 20px;
|
||
padding-bottom: 10px;
|
||
border-bottom: 2px solid #f0f0f0;
|
||
display: flex;
|
||
align-items: center;
|
||
gap: 10px;
|
||
}
|
||
|
||
.info-grid {
|
||
display: grid;
|
||
grid-template-columns: 1fr 1fr;
|
||
gap: 20px;
|
||
}
|
||
|
||
.info-item {
|
||
margin-bottom: 15px;
|
||
}
|
||
|
||
.info-label {
|
||
font-weight: 600;
|
||
color: #666;
|
||
font-size: 14px;
|
||
margin-bottom: 5px;
|
||
}
|
||
|
||
.info-value {
|
||
font-size: 16px;
|
||
color: #333;
|
||
word-break: break-word;
|
||
padding: 8px 0;
|
||
}
|
||
|
||
/* 状态标签样式 */
|
||
.status-tag {
|
||
display: inline-block;
|
||
padding: 6px 12px;
|
||
border-radius: 20px;
|
||
font-size: 14px;
|
||
font-weight: 600;
|
||
}
|
||
|
||
.status-warning {
|
||
background-color: #FFF3E0;
|
||
color: #EF6C00;
|
||
}
|
||
|
||
.status-critical {
|
||
background-color: #FFEBEE;
|
||
color: #C62828;
|
||
}
|
||
|
||
.status-info {
|
||
background-color: #E3F2FD;
|
||
color: #1565C0;
|
||
}
|
||
|
||
/* 告警信息板块样式 */
|
||
.alert-info {
|
||
background: #FFF3E0;
|
||
border-radius: 8px;
|
||
padding: 20px;
|
||
margin-top: 15px;
|
||
border-left: 4px solid #FF9800;
|
||
}
|
||
|
||
.alert-header {
|
||
display: flex;
|
||
align-items: center;
|
||
margin-bottom: 15px;
|
||
}
|
||
|
||
.alert-icon {
|
||
font-size: 24px;
|
||
margin-right: 15px;
|
||
}
|
||
|
||
.alert-title {
|
||
font-weight: 600;
|
||
font-size: 18px;
|
||
color: #EF6C00;
|
||
}
|
||
|
||
.alert-content {
|
||
margin-bottom: 15px;
|
||
}
|
||
|
||
.alert-details {
|
||
display: grid;
|
||
grid-template-columns: 1fr 1fr;
|
||
gap: 15px;
|
||
margin-top: 15px;
|
||
}
|
||
|
||
.alert-detail {
|
||
background: rgba(255, 255, 255, 0.7);
|
||
border-radius: 6px;
|
||
padding: 15px;
|
||
}
|
||
|
||
.detail-label {
|
||
font-size: 12px;
|
||
color: #666;
|
||
margin-bottom: 5px;
|
||
}
|
||
|
||
.detail-value {
|
||
font-size: 16px;
|
||
font-weight: 600;
|
||
color: #333;
|
||
}
|
||
|
||
/* 资源使用情况 */
|
||
.resource-usage {
|
||
display: grid;
|
||
grid-template-columns: repeat(2, 1fr);
|
||
gap: 20px;
|
||
margin-top: 15px;
|
||
}
|
||
|
||
.resource-card {
|
||
background: #f8f9fa;
|
||
border-radius: 8px;
|
||
padding: 20px;
|
||
}
|
||
|
||
.resource-title {
|
||
font-weight: 600;
|
||
margin-bottom: 15px;
|
||
color: #F57C00;
|
||
font-size: 16px;
|
||
}
|
||
|
||
.resource-bar {
|
||
margin-bottom: 15px;
|
||
}
|
||
|
||
.resource-label {
|
||
display: flex;
|
||
justify-content: space-between;
|
||
margin-bottom: 5px;
|
||
font-size: 14px;
|
||
}
|
||
|
||
.bar-container {
|
||
height: 10px;
|
||
background: #e0e0e0;
|
||
border-radius: 5px;
|
||
overflow: hidden;
|
||
}
|
||
|
||
.bar-fill {
|
||
height: 100%;
|
||
border-radius: 5px;
|
||
}
|
||
|
||
.bar-normal {
|
||
background: #4CAF50;
|
||
}
|
||
|
||
.bar-warning {
|
||
background: #FF9800;
|
||
}
|
||
|
||
.bar-critical {
|
||
background: #F44336;
|
||
}
|
||
|
||
/* 构建时间线样式优化 */
|
||
.timeline {
|
||
position: relative;
|
||
margin: 25px 0;
|
||
}
|
||
|
||
.timeline::before {
|
||
content: '';
|
||
position: absolute;
|
||
left: 20px;
|
||
top: 0;
|
||
bottom: 0;
|
||
width: 3px;
|
||
background: linear-gradient(to bottom, #FF9800, #F57C00);
|
||
border-radius: 3px;
|
||
}
|
||
|
||
.timeline-item {
|
||
position: relative;
|
||
margin-bottom: 25px;
|
||
padding-left: 60px;
|
||
}
|
||
|
||
.timeline-marker {
|
||
position: absolute;
|
||
left: 12px;
|
||
top: 0;
|
||
width: 22px;
|
||
height: 22px;
|
||
border-radius: 50%;
|
||
background: #FF9800;
|
||
border: 4px solid white;
|
||
box-shadow: 0 0 0 3px #FF9800;
|
||
z-index: 2;
|
||
display: flex;
|
||
align-items: center;
|
||
justify-content: center;
|
||
color: white;
|
||
font-size: 12px;
|
||
font-weight: bold;
|
||
}
|
||
|
||
.timeline-content {
|
||
background: #f8f9fa;
|
||
padding: 18px;
|
||
border-radius: 8px;
|
||
border-left: 4px solid #FF9800;
|
||
box-shadow: 0 2px 5px rgba(0,0,0,0.05);
|
||
transition: transform 0.2s, box-shadow 0.2s;
|
||
}
|
||
|
||
.timeline-content:hover {
|
||
transform: translateY(-2px);
|
||
box-shadow: 0 4px 8px rgba(0,0,0,0.1);
|
||
}
|
||
|
||
.timeline-title {
|
||
font-weight: 600;
|
||
margin-bottom: 8px;
|
||
color: #F57C00;
|
||
font-size: 16px;
|
||
display: flex;
|
||
align-items: center;
|
||
gap: 8px;
|
||
}
|
||
|
||
.timeline-time {
|
||
font-size: 14px;
|
||
color: #666;
|
||
margin-bottom: 5px;
|
||
}
|
||
|
||
.timeline-duration {
|
||
font-size: 13px;
|
||
color: #FF9800;
|
||
font-weight: 600;
|
||
background: rgba(255, 152, 0, 0.1);
|
||
padding: 4px 8px;
|
||
border-radius: 4px;
|
||
display: inline-block;
|
||
}
|
||
|
||
/* 建议措施板块 */
|
||
.recommendations {
|
||
background: #E3F2FD;
|
||
border-radius: 8px;
|
||
padding: 20px;
|
||
margin-top: 15px;
|
||
border-left: 4px solid #2196F3;
|
||
}
|
||
|
||
.recommendation-list {
|
||
list-style-type: none;
|
||
}
|
||
|
||
.recommendation-item {
|
||
margin-bottom: 10px;
|
||
padding-left: 25px;
|
||
position: relative;
|
||
}
|
||
|
||
.recommendation-item:before {
|
||
content: "•";
|
||
color: #2196F3;
|
||
font-size: 20px;
|
||
position: absolute;
|
||
left: 0;
|
||
top: -2px;
|
||
}
|
||
|
||
/* 操作按钮 */
|
||
.action-buttons {
|
||
text-align: center;
|
||
margin-top: 30px;
|
||
}
|
||
|
||
.btn {
|
||
display: inline-block;
|
||
padding: 12px 24px;
|
||
background: #FF9800;
|
||
color: white;
|
||
text-decoration: none;
|
||
border-radius: 6px;
|
||
font-weight: 600;
|
||
margin: 0 8px;
|
||
transition: all 0.3s;
|
||
box-shadow: 0 2px 5px rgba(255, 152, 0, 0.3);
|
||
}
|
||
|
||
.btn:hover {
|
||
background: #F57C00;
|
||
transform: translateY(-2px);
|
||
box-shadow: 0 4px 8px rgba(255, 152, 0, 0.4);
|
||
}
|
||
|
||
.btn-outline {
|
||
background: transparent;
|
||
border: 2px solid #FF9800;
|
||
color: #FF9800;
|
||
box-shadow: none;
|
||
}
|
||
|
||
.btn-outline:hover {
|
||
background: #fff3e0;
|
||
}
|
||
|
||
.email-footer {
|
||
background: #f0f2f5;
|
||
padding: 25px 30px;
|
||
text-align: center;
|
||
font-size: 14px;
|
||
color: #666;
|
||
border-top: 1px solid #eaeaea;
|
||
}
|
||
|
||
.footer-links {
|
||
margin-top: 15px;
|
||
}
|
||
|
||
.footer-links a {
|
||
color: #FF9800;
|
||
text-decoration: none;
|
||
margin: 0 12px;
|
||
transition: color 0.2s;
|
||
}
|
||
|
||
.footer-links a:hover {
|
||
text-decoration: underline;
|
||
color: #F57C00;
|
||
}
|
||
|
||
@media (max-width: 700px) {
|
||
body {
|
||
padding: 10px;
|
||
}
|
||
|
||
.email-container {
|
||
border-radius: 8px;
|
||
}
|
||
|
||
.info-grid {
|
||
grid-template-columns: 1fr;
|
||
}
|
||
|
||
.timeline::before {
|
||
left: 18px;
|
||
}
|
||
|
||
.timeline-item {
|
||
padding-left: 50px;
|
||
}
|
||
|
||
.timeline-marker {
|
||
left: 10px;
|
||
width: 18px;
|
||
height: 18px;
|
||
}
|
||
|
||
.resource-usage,
|
||
.alert-details {
|
||
grid-template-columns: 1fr;
|
||
}
|
||
|
||
.btn {
|
||
display: block;
|
||
margin: 10px auto;
|
||
width: 90%;
|
||
max-width: 250px;
|
||
}
|
||
}
|
||
</style>
|
||
</head>
|
||
<body>
|
||
<div class="email-container">
|
||
<div class="email-header">
|
||
<h1>⚠️ Jenkins资源消耗告警</h1>
|
||
<p>检测到构建过程中的资源使用超过阈值</p>
|
||
<div class="status-badge">需要管理员关注</div>
|
||
</div>
|
||
|
||
<div class="email-body">
|
||
<div class="section">
|
||
<h2 class="section-title">🚨 告警概览</h2>
|
||
<div class="info-grid">
|
||
<div class="info-item">
|
||
<div class="info-label">项目名称</div>
|
||
<div class="info-value">user-service-api</div>
|
||
</div>
|
||
<div class="info-item">
|
||
<div class="info-label">构建编号</div>
|
||
<div class="info-value">#183</div>
|
||
</div>
|
||
<div class="info-item">
|
||
<div class="info-label">告警级别</div>
|
||
<div class="info-value"><span class="status-tag status-critical">严重</span></div>
|
||
</div>
|
||
<div class="info-item">
|
||
<div class="info-label">告警时间</div>
|
||
<div class="info-value">2023-10-15 14:35:42</div>
|
||
</div>
|
||
<div class="info-item">
|
||
<div class="info-label">触发条件</div>
|
||
<div class="info-value">CPU使用率 > 85% 持续5分钟</div>
|
||
</div>
|
||
<div class="info-item">
|
||
<div class="info-label">当前状态</div>
|
||
<div class="info-value"><span class="status-tag status-warning">持续中</span></div>
|
||
</div>
|
||
<div class="info-item">
|
||
<div class="info-label">持续时间</div>
|
||
<div class="info-value">7分钟 23秒</div>
|
||
</div>
|
||
<div class="info-item">
|
||
<div class="info-label">构建节点</div>
|
||
<div class="info-value">master-node-01</div>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
|
||
<div class="section">
|
||
<h2 class="section-title">📊 资源使用详情</h2>
|
||
<div class="resource-usage">
|
||
<div class="resource-card">
|
||
<div class="resource-title">CPU使用情况</div>
|
||
<div class="resource-bar">
|
||
<div class="resource-label">
|
||
<span>当前使用率</span>
|
||
<span>92%</span>
|
||
</div>
|
||
<div class="bar-container">
|
||
<div class="bar-fill bar-critical" style="width: 92%"></div>
|
||
</div>
|
||
</div>
|
||
<div class="resource-bar">
|
||
<div class="resource-label">
|
||
<span>5分钟平均值</span>
|
||
<span>88%</span>
|
||
</div>
|
||
<div class="bar-container">
|
||
<div class="bar-fill bar-warning" style="width: 88%"></div>
|
||
</div>
|
||
</div>
|
||
<div class="resource-bar">
|
||
<div class="resource-label">
|
||
<span>阈值设定</span>
|
||
<span>85%</span>
|
||
</div>
|
||
<div class="bar-container">
|
||
<div class="bar-fill bar-normal" style="width: 85%"></div>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
|
||
<div class="resource-card">
|
||
<div class="resource-title">其他资源指标</div>
|
||
<div class="resource-bar">
|
||
<div class="resource-label">
|
||
<span>内存使用</span>
|
||
<span>3.7GB/4GB</span>
|
||
</div>
|
||
<div class="bar-container">
|
||
<div class="bar-fill bar-warning" style="width: 92.5%"></div>
|
||
</div>
|
||
</div>
|
||
<div class="resource-bar">
|
||
<div class="resource-label">
|
||
<span>磁盘I/O</span>
|
||
<span>78MB/s</span>
|
||
</div>
|
||
<div class="bar-container">
|
||
<div class="bar-fill bar-normal" style="width: 78%"></div>
|
||
</div>
|
||
</div>
|
||
<div class="resource-bar">
|
||
<div class="resource-label">
|
||
<span>网络流量</span>
|
||
<span>45MB/s</span>
|
||
</div>
|
||
<div class="bar-container">
|
||
<div class="bar-fill bar-normal" style="width: 45%"></div>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
|
||
<div class="section">
|
||
<h2 class="section-title">🔍 告警详情</h2>
|
||
<div class="alert-info">
|
||
<div class="alert-header">
|
||
<div class="alert-icon">⚠️</div>
|
||
<div class="alert-title">CPU使用率持续超过阈值</div>
|
||
</div>
|
||
<div class="alert-content">
|
||
<p>检测到构建节点 <strong>master-node-01</strong> 的CPU使用率在构建过程中持续超过设定的阈值(85%),当前峰值达到92%,可能影响构建性能和其他任务的执行。</p>
|
||
</div>
|
||
<div class="alert-details">
|
||
<div class="alert-detail">
|
||
<div class="detail-label">峰值使用率</div>
|
||
<div class="detail-value">92%</div>
|
||
</div>
|
||
<div class="alert-detail">
|
||
<div class="detail-label">持续时间</div>
|
||
<div class="detail-value">7分钟 23秒</div>
|
||
</div>
|
||
<div class="alert-detail">
|
||
<div class="detail-label">阈值设定</div>
|
||
<div class="detail-value">85%</div>
|
||
</div>
|
||
<div class="alert-detail">
|
||
<div class="detail-label">触发时间</div>
|
||
<div class="detail-value">2023-10-15 14:35:42</div>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
|
||
<div class="section">
|
||
<h2 class="section-title">⏱️ 构建时间线</h2>
|
||
<div class="timeline">
|
||
<div class="timeline-item">
|
||
<div class="timeline-marker">1</div>
|
||
<div class="timeline-content">
|
||
<div class="timeline-title">📥 代码检出</div>
|
||
<div class="timeline-time">开始: 14:30:25 | 结束: 14:31:10</div>
|
||
<div class="timeline-duration">耗时: 45秒</div>
|
||
</div>
|
||
</div>
|
||
<div class="timeline-item">
|
||
<div class="timeline-marker">2</div>
|
||
<div class="timeline-content">
|
||
<div class="timeline-title">📦 依赖安装</div>
|
||
<div class="timeline-time">开始: 14:31:10 | 结束: 14:33:25</div>
|
||
<div class="timeline-duration">耗时: 2分钟 15秒</div>
|
||
<div style="margin-top: 10px; padding: 8px; background: #FFF3E0; border-radius: 4px; font-size: 14px;">
|
||
<strong>注意:</strong> 此阶段CPU使用率开始上升至75%
|
||
</div>
|
||
</div>
|
||
</div>
|
||
<div class="timeline-item">
|
||
<div class="timeline-marker">3</div>
|
||
<div class="timeline-content">
|
||
<div class="timeline-title">⚙️ 代码编译</div>
|
||
<div class="timeline-time">开始: 14:33:25 | 结束: 14:37:40</div>
|
||
<div class="timeline-duration">耗时: 4分钟 15秒</div>
|
||
<div style="margin-top: 10px; padding: 8px; background: #FFEBEE; border-radius: 4px; font-size: 14px;">
|
||
<strong>告警:</strong> 此阶段CPU使用率超过阈值,峰值达到92%
|
||
</div>
|
||
</div>
|
||
</div>
|
||
<div class="timeline-item">
|
||
<div class="timeline-marker">4</div>
|
||
<div class="timeline-content">
|
||
<div class="timeline-title">🧪 测试执行</div>
|
||
<div class="timeline-time">开始: 14:37:40 | 结束: 14:39:20</div>
|
||
<div class="timeline-duration">耗时: 1分钟 40秒</div>
|
||
<div style="margin-top: 10px; padding: 8px; background: #FFF3E0; border-radius: 4px; font-size: 14px;">
|
||
<strong>注意:</strong> 此阶段CPU使用率维持在85%-90%
|
||
</div>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
|
||
<div class="section">
|
||
<h2 class="section-title">💡 建议措施</h2>
|
||
<div class="recommendations">
|
||
<ul class="recommendation-list">
|
||
<li class="recommendation-item">检查构建节点当前负载,考虑将部分任务迁移到其他节点</li>
|
||
<li class="recommendation-item">优化构建脚本,减少CPU密集型操作或增加并行处理</li>
|
||
<li class="recommendation-item">考虑升级构建节点的硬件配置或增加节点数量</li>
|
||
<li class="recommendation-item">检查是否有异常进程占用大量CPU资源</li>
|
||
<li class="recommendation-item">评估是否需要调整构建任务的调度策略</li>
|
||
</ul>
|
||
</div>
|
||
</div>
|
||
|
||
<div class="action-buttons">
|
||
<a href="https://jenkins.example.com/computer/master-node-01" class="btn">查看节点状态</a>
|
||
<a href="https://jenkins.example.com/job/user-service-api/183" class="btn btn-outline">查看构建详情</a>
|
||
<a href="https://monitoring.example.com/dashboard/node-resources" class="btn btn-outline">监控仪表板</a>
|
||
</div>
|
||
</div>
|
||
|
||
<div class="email-footer">
|
||
<p>此邮件由 Jenkins CI/CD 监控系统自动发送,请勿直接回复。</p>
|
||
<div class="footer-links">
|
||
<a href="https://jenkins.example.com">Jenkins首页</a> |
|
||
<a href="https://jenkins.example.com/systemInfo">系统信息</a> |
|
||
<a href="mailto:admin@example.com?subject=Jenkins资源告警反馈">问题反馈</a>
|
||
</div>
|
||
<p style="margin-top: 15px; font-size: 12px; color: #999;">
|
||
© 2023 公司名称 - 自动化部署平台
|
||
</p>
|
||
</div>
|
||
</div>
|
||
</body>
|
||
</html> |