Skip to content

Commit 4312af6

Browse files
committed
commit
1 parent abdd769 commit 4312af6

File tree

16 files changed

+218
-72
lines changed

16 files changed

+218
-72
lines changed

HttpReports.Web/DataAccessors/DataAccessorMySql.cs

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -54,15 +54,27 @@ public List<EchartPineDataModel> GetStatusCode(GetIndexDataRequest request)
5454

5555
string sql = $@"
5656
57-
Select '200' Name,COUNT(1) Value From RequestInfo {where} AND StatusCode = 200
57+
Select '200' Name,COUNT(1) Value From RequestInfo {where} AND StatusCode = 200
58+
Union
59+
Select '301' Name,COUNT(1) Value From RequestInfo {where} AND StatusCode = 301
60+
Union
61+
Select '302' Name,COUNT(1) Value From RequestInfo {where} AND StatusCode = 302
62+
Union
63+
Select '303' Name,COUNT(1) Value From RequestInfo {where} AND StatusCode = 303
5864
Union
5965
Select '400' Name,COUNT(1) Value From RequestInfo {where} AND StatusCode = 400
6066
Union
6167
Select '401' Name,COUNT(1) Value From RequestInfo {where} AND StatusCode = 401
6268
Union
69+
Select '403' Name,COUNT(1) Value From RequestInfo {where} AND StatusCode = 403
70+
Union
6371
Select '404' Name,COUNT(1) Value From RequestInfo {where} AND StatusCode = 404
6472
Union
6573
Select '500' Name,COUNT(1) Value From RequestInfo {where} AND StatusCode = 500
74+
Union
75+
Select '502' Name,COUNT(1) Value From RequestInfo {where} AND StatusCode = 502
76+
Union
77+
Select '503' Name,COUNT(1) Value From RequestInfo {where} AND StatusCode = 503
6678
6779
";
6880

@@ -356,7 +368,7 @@ public CheckModel CheckRt(Models.Job job, int minute)
356368
return new CheckModel()
357369
{
358370
Ok = false,
359-
Value = percent.ToString(),
371+
Value = Math.Round(percent, 4).ToString(),
360372
Time = Time
361373
};
362374
}
@@ -395,7 +407,7 @@ public CheckModel CheckHttp(Models.Job job, int minute)
395407
return new CheckModel()
396408
{
397409
Ok = false,
398-
Value = percent.ToString(),
410+
Value = Math.Round(percent, 4).ToString(),
399411
Time = Time
400412
};
401413
}
@@ -434,7 +446,7 @@ public CheckModel CheckIP(Models.Job job, int minute)
434446
return new CheckModel()
435447
{
436448
Ok = false,
437-
Value = percent.ToString(),
449+
Value = Math.Round(percent, 4).ToString(),
438450
Time = Time
439451
};
440452
}

HttpReports.Web/DataAccessors/DataAccessorSqlServer.cs

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -59,13 +59,25 @@ public List<EchartPineDataModel> GetStatusCode(GetIndexDataRequest request)
5959
6060
Select '200' Name,COUNT(1) Value From RequestInfo {where} AND StatusCode = 200
6161
Union
62+
Select '301' Name,COUNT(1) Value From RequestInfo {where} AND StatusCode = 301
63+
Union
64+
Select '302' Name,COUNT(1) Value From RequestInfo {where} AND StatusCode = 302
65+
Union
66+
Select '303' Name,COUNT(1) Value From RequestInfo {where} AND StatusCode = 303
67+
Union
6268
Select '400' Name,COUNT(1) Value From RequestInfo {where} AND StatusCode = 400
6369
Union
6470
Select '401' Name,COUNT(1) Value From RequestInfo {where} AND StatusCode = 401
6571
Union
72+
Select '403' Name,COUNT(1) Value From RequestInfo {where} AND StatusCode = 403
73+
Union
6674
Select '404' Name,COUNT(1) Value From RequestInfo {where} AND StatusCode = 404
6775
Union
6876
Select '500' Name,COUNT(1) Value From RequestInfo {where} AND StatusCode = 500
77+
Union
78+
Select '502' Name,COUNT(1) Value From RequestInfo {where} AND StatusCode = 502
79+
Union
80+
Select '503' Name,COUNT(1) Value From RequestInfo {where} AND StatusCode = 503
6981
7082
";
7183

@@ -354,7 +366,7 @@ public CheckModel CheckRt(Models.Job job, int minute)
354366
return new CheckModel()
355367
{
356368
Ok = false,
357-
Value = percent.ToString(),
369+
Value = Math.Round(percent, 4).ToString(),
358370
Time = Time
359371
};
360372
}
@@ -392,7 +404,7 @@ public CheckModel CheckHttp(Models.Job job, int minute)
392404
return new CheckModel()
393405
{
394406
Ok = false,
395-
Value = percent.ToString(),
407+
Value = Math.Round(percent, 4).ToString(),
396408
Time = Time
397409
};
398410
}
@@ -431,7 +443,7 @@ public CheckModel CheckIP(Models.Job job, int minute)
431443
return new CheckModel()
432444
{
433445
Ok = false,
434-
Value = percent.ToString(),
446+
Value = Math.Round(percent,4).ToString(),
435447
Time = Time
436448
};
437449
}

HttpReports.Web/DataContext/DBFactory.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ [Id] ASC
9292
9393
");
9494

95-
new MockData().MockSqlServer(Constr);
95+
//new MockData().MockSqlServer(Constr);
9696
}
9797

9898
// 检查Job表
@@ -170,7 +170,7 @@ private void InitMySql(string Constr)
170170
PRIMARY KEY (`Id`)
171171
) ENGINE=MyISAM AUTO_INCREMENT=13 DEFAULT CHARSET=utf8; ");
172172

173-
new MockData().MockMySql(Constr);
173+
//new MockData().MockMySql(Constr);
174174

175175
}
176176

HttpReports.Web/Views/Home/AddMonitor.cshtml

Lines changed: 65 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11

22
@{
3-
Layout = "~/Views/Shared/_Layout.cshtml";
4-
3+
Layout = "~/Views/Shared/_Layout.cshtml";
4+
55
List<string> nodes = ViewBag.nodes;
66
}
77

@@ -10,19 +10,17 @@
1010
1111
@@media screen and (min-width:1170px) {
1212
13-
.title, .desc, .rate,.email,.mobiles {
13+
.title, .desc, .email, .mobiles {
1414
width: 75% !important;
1515
}
1616
}
1717
1818
.tab-pane {
19-
20-
margin-top:12px;
21-
padding:20px 15px;
22-
border-radius:6px;
23-
border:1px solid #ccc;
24-
}
25-
19+
margin-top: 12px;
20+
padding: 20px 15px;
21+
border-radius: 6px;
22+
border: 1px solid #ccc;
23+
}
2624
</style>
2725

2826

@@ -32,7 +30,7 @@
3230

3331
<ol class="breadcrumb">
3432
<li><a href="/Home/Monitor">预警监控</a></li>
35-
<li><span href="#">任务编辑</span></li>
33+
<li><span href="#">任务编辑</span></li>
3634
</ol>
3735

3836
<h3 style="margin-bottom:20px;">编辑任务</h3>
@@ -138,17 +136,17 @@
138136
</ul>
139137

140138

141-
</div>
139+
</div>
142140

143141
<div class="tab-content">
144142

145-
<div id="tab11" class="tab-pane active">
143+
<div id="tab11" class="tab-pane active">
146144

147-
<div class="row form-inline form">
145+
<div class="row form-inline form">
148146

149-
<div class="col-sm-12">
147+
<div class="col-sm-12">
150148

151-
<div class="col-lg-3">
149+
<div class="col-lg-3">
152150

153151
<label class="form-label">任务状态</label>
154152
<select class="form-control RtStatus">
@@ -168,11 +166,23 @@
168166

169167
<div class="col-sm-3" style="padding:0">
170168
<label class="form-label">超时率</label>
171-
<input type="text" class="form-control RtRate" placeholder="格式 0.01% 15% ... ">
169+
<input type="text" class="form-control RtRate" placeholder="格式 0.01% 15% ... ">
172170
</div>
173171

174172
</div>
175173

174+
<div class="col-sm-12" style="margin-top:20px;">
175+
176+
<div style="margin-left:12px;margin-right:12px;margin-bottom:0" class="alert alert-info" role="alert">
177+
178+
<p><b>响应超时监控</b>:主要针对一段时间内接口调用超时率过高;</p>
179+
180+
<p>1.设定接口超时时间(毫秒); 2.设置接口超时百分比,支持 两位小数点,5%,0.03%,30%等,超时率达到或大于设定值时会触发预警;</p>
181+
182+
</div>
183+
184+
</div>
185+
176186
</div>
177187

178188
</div>
@@ -207,7 +217,19 @@
207217

208218
</div>
209219

210-
</div>
220+
<div class="col-sm-12" style="margin-top:20px;">
221+
222+
<div style="margin-left:12px;margin-right:12px;margin-bottom:0" class="alert alert-info" role="alert">
223+
224+
<p><b>请求错误监控</b>:主要针对一段时间内接口调用错误率过高;</p>
225+
226+
<p>1.设定Http状态码,500,503,404,多个状态码用英文逗号隔开; 2.设置命中率,支持 两位小数点,5%,0.03%,30%等,命中率达到或大于设定值时会触发预警;</p>
227+
228+
</div>
229+
230+
</div>
231+
232+
</div>
211233

212234
</div>
213235

@@ -241,6 +263,18 @@
241263

242264
</div>
243265

266+
<div class="col-sm-12" style="margin-top:20px;">
267+
268+
<div style="margin-left:12px;margin-right:12px;margin-bottom:0" class="alert alert-info" role="alert">
269+
270+
<p><b>IP异常监控</b>:主要针对一段时间内大量固定IP请求,类似机器人请求;</p>
271+
272+
<p> 1.设置IP白名单(可不填),多个IP地址中间用英文逗号分开; 2.设置重复率,支持 两位小数点,5%,0.03%,30%等,当IP重复率达到或大于设定值时,触发预警; </p>
273+
274+
</div>
275+
276+
</div>
277+
244278
</div>
245279

246280

@@ -269,9 +303,19 @@
269303
<input type="text" class="form-control RequestCount">
270304
</div>
271305

272-
273306
</div>
274307

308+
<div class="col-sm-12" style="margin-top:20px;">
309+
310+
<div style="margin-left:12px;margin-right:12px;margin-bottom:0" class="alert alert-info" role="alert">
311+
312+
<p><b>请求量监控</b>:主要针对一段时间内接口大量请求;</p>
313+
314+
<p> 1.设置单位时间内接口最大请求量,当请求量达到或者大于设定时触发预警 </p>
315+
316+
</div>
317+
318+
</div>
275319
</div>
276320

277321

@@ -300,5 +344,5 @@
300344

301345
</div>
302346

303-
304-
<script src="~/Content/page/addmonitor.js?ver=1.1"></script>
347+
348+
<script src="~/Content/page/addmonitor.js?ver=1.0.1"></script>

HttpReports.Web/Views/Home/Detail.cshtml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,4 +139,4 @@
139139
</div>
140140

141141

142-
<script src="/Content/page/detail.js?ver=1.1"></script>
142+
<script src="/Content/page/detail.js?ver=1.0.1"></script>

HttpReports.Web/Views/Home/Index.cshtml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222

2323
<b><i class="glyphicon glyphicon-signal"></i> 服务节点</b>
2424

25-
<span class="glyphicon glyphicon-info-sign serviceTip" style="font-size:20px;top:0.2em;cursor:pointer;"></span>
25+
<span class="glyphicon glyphicon-info-sign" data-toggle="tooltip" title="服务节点是WebAPI请求的服务节点,点击选中和取消节点" style="font-size:20px;top:0.2em;cursor:pointer;"></span>
2626

2727
@*<button type="button" onclick="select_all(this)" style="width:60px;margin-right:8px;margin-left:8px" class="btn btn-success btn-xs">全选</button>
2828
@@ -87,7 +87,7 @@
8787

8888
<div class="board-row panel panel-default panel-body shadow-box">
8989

90-
<p style="padding-left:20px;color:#3c763d">
90+
<p class="index_time_range" style="padding-left:20px;color:#3c763d">
9191
时间:<b></b>
9292

9393
</p>
@@ -107,7 +107,7 @@
107107
<div class="col-lg-2 col-sm-6 col-xs-6 col-xxs-12">
108108
<div class="smallstat blue-bg">
109109

110-
<b class="glyphicon glyphicon-info-sign badgeIcon" data-toggle="tooltip" data-placement="auto" title="处理时间是接口处理的时间,不能看做处理时间"></b>
110+
<b class="glyphicon glyphicon-info-sign badgeIcon" data-placement="auto" data-toggle="tooltip" title="处理时间是接口处理的时间,不能看做处理时间"></b>
111111

112112
<b><span class="value">0</span></b>
113113
<h4>平均处理时间 (ms)</h4>
@@ -274,5 +274,5 @@
274274

275275

276276

277-
<script src="/Content/page/index.js?ver=1.1"></script>
277+
<script src="/Content/page/index.js?ver=1.0.1"></script>
278278

HttpReports.Web/Views/Home/Monitor.cshtml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626

2727
<div class="col-sm-3" style="padding-left:0">
2828

29-
<a style="min-width:120px;" onclick="QueryClick(this)" href="/Home/AddMonitor" class="btn btn-primary btn-search">添加</a>
29+
<a style="min-width:120px;" href="/Home/AddMonitor" class="btn btn-primary btn-search">添加</a>
3030

3131
</div>
3232

HttpReports.Web/Views/Home/Trend.cshtml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -166,4 +166,4 @@
166166
</div>
167167

168168

169-
<script src="/Content/page/trend.js?ver=1.1"></script>
169+
<script src="/Content/page/trend.js?ver=1.0.1"></script>

0 commit comments

Comments
 (0)