|
@@ -1746,23 +1746,42 @@ namespace PMS.BusinessService.CloudMonitorManage
|
|
|
|
|
|
if (info.Value != null)
|
|
|
{
|
|
|
- var customServiceInfo = dbCloudMonitor.GetCustomServiceInfoById(info.CustomServiceId);
|
|
|
- var json = Strings.JsonToModel<CustomServiceAnalysis>(info.Value);
|
|
|
- if (json.预警类型 <= 0) return;
|
|
|
- ServerAlertDetailModel model = new ServerAlertDetailModel
|
|
|
+ try
|
|
|
{
|
|
|
- ID = Guid.NewGuid().ToString("D"),
|
|
|
- 预警次数 = 1,
|
|
|
- 预警名称 = customServiceInfo.服务名称,
|
|
|
- 预警说明 = Strings.ObjectToJson(info),
|
|
|
- 当前值 = info.Value,
|
|
|
- 预警等级 = json.预警类型,
|
|
|
- 项目ID = customServiceInfo.项目ID,
|
|
|
- 最后修改时间 = info.CurrentTime,
|
|
|
- 预警类型 = (int)AlertTypeEnum.自定义服务,
|
|
|
- };
|
|
|
- model.外部唯一键 = model.预警类型 + "_" + info.CustomServiceId;
|
|
|
- alertId = CheckDuration(model, InsertServerAlert);
|
|
|
+ var customServiceInfo = dbCloudMonitor.GetCustomServiceInfoById(info.CustomServiceId);
|
|
|
+ var json = Strings.JsonToModel<CustomServiceAnalysis>(info.Value);
|
|
|
+ if (json.预警类型 <= 0) return;
|
|
|
+ ServerAlertDetailModel model = new ServerAlertDetailModel
|
|
|
+ {
|
|
|
+ ID = Guid.NewGuid().ToString("D"),
|
|
|
+ 预警次数 = 1,
|
|
|
+ 预警名称 = customServiceInfo.服务名称,
|
|
|
+ 预警说明 = Strings.ObjectToJson(info),
|
|
|
+ 当前值 = info.Value,
|
|
|
+ 预警等级 = json.预警类型,
|
|
|
+ 项目ID = customServiceInfo.项目ID,
|
|
|
+ 最后修改时间 = info.CurrentTime,
|
|
|
+ 预警类型 = (int)AlertTypeEnum.自定义服务,
|
|
|
+ };
|
|
|
+ model.外部唯一键 = model.预警类型 + "_" + info.CustomServiceId;
|
|
|
+ alertId = CheckDuration(model, InsertServerAlert);
|
|
|
+ }
|
|
|
+ catch (Exception ex)
|
|
|
+ {
|
|
|
+ //上报指标记录
|
|
|
+ InsertPushIndexDataByServerId(new PushIndexDataModel()
|
|
|
+ {
|
|
|
+ ID = Guid.NewGuid().ToString("D"),
|
|
|
+ 服务器ID = item.Id,
|
|
|
+ 预警ID = "",
|
|
|
+ 类型 = (int)InfoTypeEnum.自定义服务,
|
|
|
+ 状态 = (int)PushStateTypeEnum.异常,
|
|
|
+ 上报原始数据 = "处理数据异常:" + ex.Message + " 原始内容:" + item.Msg,
|
|
|
+ 创建时间 = item.CurrentTime,
|
|
|
+ 外部唯一键 = item.ExternalId
|
|
|
+ });
|
|
|
+ return;
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
//上报指标记录
|
|
@@ -2314,7 +2333,7 @@ namespace PMS.BusinessService.CloudMonitorManage
|
|
|
{
|
|
|
//不是工作时间直接继续
|
|
|
if (!IsWorkTime()) return true;
|
|
|
- if(_cacheWorkTime.TryGetValue(id, out var num))
|
|
|
+ if (_cacheWorkTime.TryGetValue(id, out var num))
|
|
|
{
|
|
|
num++;
|
|
|
if (num >= workFrequency)
|