[collector,webapp]开放sitemap全站类型监控

This commit is contained in:
tomsun28
2022-02-16 09:35:28 +08:00
parent e6673325a8
commit 6d37d5bc14
6 changed files with 30 additions and 19 deletions

View File

@@ -207,7 +207,7 @@ public class HttpCollectImpl extends AbstractCollect {
} }
} }
} catch (Exception e) { } catch (Exception e) {
log.warn(e.getMessage(), e); log.warn(e.getMessage());
isXmlFormat = false; isXmlFormat = false;
} }
// 若xml解析失败 用txt格式解析 // 若xml解析失败 用txt格式解析
@@ -222,14 +222,8 @@ public class HttpCollectImpl extends AbstractCollect {
log.warn(e.getMessage(), e); log.warn(e.getMessage(), e);
} }
} }
// todo siteUrl 限制数量
// 开始循环访问每个site url 采集其 http status code, responseTime, 异常信息 // 开始循环访问每个site url 采集其 http status code, responseTime, 异常信息
int maxUrlNum = 100;
for (String siteUrl : siteUrls) { for (String siteUrl : siteUrls) {
maxUrlNum --;
if (maxUrlNum <= 0) {
break;
}
String errorMsg = ""; String errorMsg = "";
Integer statusCode = null; Integer statusCode = null;
long startTime = System.currentTimeMillis(); long startTime = System.currentTimeMillis();

View File

@@ -19,7 +19,7 @@ public class IpDomainUtil {
private static final String LOCALHOST = "localhost"; private static final String LOCALHOST = "localhost";
private static final Pattern DOMAIN_SCHEMA = Pattern.compile("^([hH][tT]{2}[pP]://|[hH][tT]{2}[pP][sS]://)"); private static final Pattern DOMAIN_SCHEMA = Pattern.compile("^([hH][tT]{2}[pP]://|[hH][tT]{2}[pP][sS]://){1}[^\\s]*");
/** /**
* 校验判断是否是 ip或者domain * 校验判断是否是 ip或者domain

View File

@@ -113,9 +113,10 @@ public class TdEngineDataStorage implements DisposableBean {
//组建DATA SQL //组建DATA SQL
List<CollectRep.Field> fields = metricsData.getFieldsList(); List<CollectRep.Field> fields = metricsData.getFieldsList();
StringBuilder sqlBuffer = new StringBuilder(); StringBuilder sqlBuffer = new StringBuilder();
int i = 0;
for (CollectRep.ValueRow valueRow : metricsData.getValuesList()) { for (CollectRep.ValueRow valueRow : metricsData.getValuesList()) {
StringBuilder sqlRowBuffer = new StringBuilder("("); StringBuilder sqlRowBuffer = new StringBuilder("(");
sqlRowBuffer.append(metricsData.getTime()).append(", "); sqlRowBuffer.append(metricsData.getTime() + i++).append(", ");
sqlRowBuffer.append("'").append(valueRow.getInstance()).append("', "); sqlRowBuffer.append("'").append(valueRow.getInstance()).append("', ");
for (int index = 0; index < fields.size(); index++) { for (int index = 0; index < fields.size(); index++) {
CollectRep.Field field = fields.get(index); CollectRep.Field field = fields.get(index);

View File

@@ -213,17 +213,27 @@ export class MonitorDataChartComponent implements OnInit {
if (legend.length > 1) { if (legend.length > 1) {
this.lineHistoryTheme.legend = { this.lineHistoryTheme.legend = {
orient: 'vertical', orient: 'vertical',
align: 'auto',
right: '10%',
top: '10%',
data: legend data: legend
}; };
} }
Object.keys(values).forEach(key => { this.lineHistoryTheme.series = [];
let maxLegend = 5;
let valueKeyArr = Object.keys(values);
for (let index = 0; index < valueKeyArr.length; index++) {
if (maxLegend-- <= 0) {
break;
}
let key = valueKeyArr[index];
let seriesData: Array<{ value: any }> = []; let seriesData: Array<{ value: any }> = [];
values[key].forEach((item: { time: number; origin: any }) => { values[key].forEach((item: { time: number; origin: any }) => {
seriesData.push({ seriesData.push({
value: [item.time, item.origin] value: [item.time, item.origin]
}); });
}); });
this.lineHistoryTheme.series = []; // @ts-ignore
this.lineHistoryTheme.series.push({ this.lineHistoryTheme.series.push({
name: key, name: key,
type: 'line', type: 'line',
@@ -231,13 +241,13 @@ export class MonitorDataChartComponent implements OnInit {
showSymbol: false, showSymbol: false,
data: seriesData data: seriesData
}); });
this.eChartOption = this.lineHistoryTheme; }
if (this.echartsInstance != undefined) { this.eChartOption = this.lineHistoryTheme;
this.echartsInstance.setOption(this.eChartOption, { if (this.echartsInstance != undefined) {
replaceMerge: ['xAxis', 'yAxis', 'series'] this.echartsInstance.setOption(this.eChartOption, {
}); replaceMerge: ['xAxis', 'yAxis', 'series']
} });
}); }
} else { } else {
this.eChartOption = this.lineHistoryTheme; this.eChartOption = this.lineHistoryTheme;
this.eChartOption.title = { this.eChartOption.title = {

View File

@@ -53,6 +53,11 @@
"text": "port", "text": "port",
"link": "/monitors?app=port", "link": "/monitors?app=port",
"i18n": "monitor.app.port" "i18n": "monitor.app.port"
},
{
"text": "fullsite",
"link": "/monitors?app=fullsite",
"i18n": "monitor.app.fullsite"
} }
] ]
}, },

View File

@@ -54,7 +54,8 @@
"port": "端口可用性", "port": "端口可用性",
"mysql": "Mysql", "mysql": "Mysql",
"oracle": "Oracle", "oracle": "Oracle",
"redis": "Redis" "redis": "Redis",
"fullsite": "全站监控"
} }
}, },
"alert": { "alert": {