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

View File

@@ -19,7 +19,7 @@ public class IpDomainUtil {
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

View File

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

View File

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

View File

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

View File

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