/// <summary> /// Updates the fusionDirector collection. /// </summary> /// <param name="model">The model.</param> /// <param name="existObj">The exist object.</param> private void UpdateFusionDirectorCollection(FusionDirectorCollection model, MonitoringObject existObj) { var propertys = this.FusionDirectorCollectionClass.PropertyCollection; existObj[propertys["ResourceName"]].Value = model.ResourceName; existObj[propertys["Health"]].Value = model.Health.ToString(); existObj[this.DisplayNameField].Value = model.ResourceName; }
/// <summary> /// Creates the fusionDirector collection. /// </summary> /// <param name="model">The model.</param> /// <returns>MPObject.</returns> private MPObject CreateFusionDirectorCollection(FusionDirectorCollection model) { var propertys = this.FusionDirectorCollectionClass.PropertyCollection; var obj = new MPObject(MGroup.Instance, this.FusionDirectorCollectionClass); obj[propertys["ResourceName"]].Value = model.ResourceName; obj[propertys["Health"]].Value = model.Health.ToString(); obj[this.DisplayNameField].Value = model.ResourceName; return(obj); }
private void CreateOrCloseFusionDirectorAlarm(List <MonitoringAlert> existAlarmData, FusionDirectorCollection currentState) { var fdStatuses = JsonConvert.DeserializeObject <Dictionary <string, string> >(currentState.ErrorMsg); foreach (var fdStatus in fdStatuses) { var fdIp = fdStatus.Key; var error = fdStatus.Value; bool isHaveOldAlarm = existAlarmData.Any(x => x.CustomField1 == EnumAlarmType.FdConnectError.ToString() && x.CustomField4.Contains(fdIp)); if (fdStatus.Value != "OK")//本次有告警,则插入或更新告警 { OnLog($"[{fdIp}] Insert Or Update Event:FusionDirector connect Error"); var alarm = new ApplianceAlarm { OptType = "1", AlarmName = "FusionDirector Connect Error", AlarmType = EnumAlarmType.FdConnectError, PossibleCause = $"{error}", Suggstion = "check whether the FusionDirector server is shut down or whether the network is abnormal.", Additional = error }; var applianceEvent = new ApplianceEvent(alarm); ApplianceConnector.Instance.InsertEvent(applianceEvent, fdIp); } else { //本次没有告警 且有旧的告警,则关闭 if (isHaveOldAlarm) { OnLog($"[{fdIp}] Close Event:FusionDirector Connect Error"); var alarm = new ApplianceAlarm { OptType = "2", AlarmType = EnumAlarmType.FdConnectError, }; var applianceEvent = new ApplianceEvent(alarm); ApplianceConnector.Instance.InsertEvent(applianceEvent, fdIp); } } } }