// Token: 0x060004EB RID: 1259 RVA: 0x0001EBD8 File Offset: 0x0001CDD8 private ThresholdIndicator.InstanceInformation GetInstanceInformation(string entityType, int instanceId) { if (string.IsNullOrEmpty(entityType) || instanceId == 0) { return(null); } ThresholdIndicator.InstanceInformation instanceInformation = new ThresholdIndicator.InstanceInformation(); using (IInformationServiceProxy2 informationServiceProxy = this._swisFactory.CreateConnection()) { DataTable dataTable = informationServiceProxy.Query("SELECT TOP 1 Prefix, KeyProperty, NameProperty FROM Orion.NetObjectTypes WHERE EntityType = @entityType", new Dictionary <string, object> { { "entityType", entityType } }); if (dataTable != null && dataTable.Rows.Count == 1) { string arg = dataTable.Rows[0]["Prefix"] as string; object obj = dataTable.Rows[0]["KeyProperty"]; object obj2 = dataTable.Rows[0]["NameProperty"]; instanceInformation.NetObject = string.Format("{0}:{1}", arg, instanceId); if (obj != DBNull.Value && obj != DBNull.Value) { DataTable dataTable2 = informationServiceProxy.Query(string.Format("SELECT {0} FROM {1} WHERE {2} = @InstanceId", obj2, entityType, obj), new Dictionary <string, object> { { "InstanceId", instanceId } }); if (dataTable2 != null && dataTable2.Rows.Count > 0) { instanceInformation.InstanceName = dataTable2.Rows[0][obj2.ToString()].ToString(); } else { instanceInformation.InstanceName = instanceInformation.NetObject; } } else { instanceInformation.InstanceName = instanceInformation.NetObject; } } } return(instanceInformation); }
private ThresholdIndicator.InstanceInformation GetInstanceInformation( string entityType, int instanceId) { if (string.IsNullOrEmpty(entityType) || instanceId == 0) { return((ThresholdIndicator.InstanceInformation)null); } ThresholdIndicator.InstanceInformation instanceInformation = new ThresholdIndicator.InstanceInformation(); using (IInformationServiceProxy2 connection = this._swisFactory.CreateConnection()) { DataTable dataTable1 = ((IInformationServiceProxy)connection).Query("SELECT TOP 1 Prefix, KeyProperty, NameProperty FROM Orion.NetObjectTypes WHERE EntityType = @entityType", (IDictionary <string, object>) new Dictionary <string, object>() { { nameof(entityType), (object)entityType } }); if (dataTable1 != null) { if (dataTable1.Rows.Count == 1) { string str = dataTable1.Rows[0]["Prefix"] as string; object obj1 = dataTable1.Rows[0]["KeyProperty"]; object obj2 = dataTable1.Rows[0]["NameProperty"]; instanceInformation.NetObject = string.Format("{0}:{1}", (object)str, (object)instanceId); if (obj1 != DBNull.Value && obj1 != DBNull.Value) { DataTable dataTable2 = ((IInformationServiceProxy)connection).Query(string.Format("SELECT {0} FROM {1} WHERE {2} = @InstanceId", obj2, (object)entityType, obj1), (IDictionary <string, object>) new Dictionary <string, object>() { { "InstanceId", (object)instanceId } }); instanceInformation.InstanceName = dataTable2 == null || dataTable2.Rows.Count <= 0 ? instanceInformation.NetObject : dataTable2.Rows[0][obj2.ToString()].ToString(); } else { instanceInformation.InstanceName = instanceInformation.NetObject; } } } } return(instanceInformation); }
public void ReportThresholdNotification(Threshold threshold) { if (threshold == null) { throw new ArgumentNullException(nameof(threshold)); } ThresholdIndicator.InstanceInformation instanceInformation = this.GetInstanceInformation(this.GetThresholdEntityType(threshold.get_ThresholdName()), threshold.get_InstanceId()); PropertyBag propertyBag1 = new PropertyBag(); ((Dictionary <string, object>)propertyBag1).Add("InstanceType", (object)"Orion.Thresholds"); ((Dictionary <string, object>)propertyBag1).Add("Name", (object)threshold.get_ThresholdName()); ((Dictionary <string, object>)propertyBag1).Add("InstanceName", instanceInformation != null ? (object)instanceInformation.InstanceName : (object)threshold.get_InstanceId().ToString()); ((Dictionary <string, object>)propertyBag1).Add("InstanceId", (object)threshold.get_InstanceId()); ((Dictionary <string, object>)propertyBag1).Add("ThresholdType", (object)(int)threshold.get_ThresholdType()); ((Dictionary <string, object>)propertyBag1).Add("ThresholdOperator", (object)(int)threshold.get_ThresholdOperator()); ((Dictionary <string, object>)propertyBag1).Add("Level1Value", (object)threshold.get_Warning()); ((Dictionary <string, object>)propertyBag1).Add("Level2Value", (object)threshold.get_Critical()); ((Dictionary <string, object>)propertyBag1).Add("Level1Formula", (object)threshold.get_WarningFormula()); ((Dictionary <string, object>)propertyBag1).Add("Level2Formula", (object)threshold.get_CriticalFormula()); ((Dictionary <string, object>)propertyBag1).Add("WarningPolls", (object)threshold.get_WarningPolls()); ((Dictionary <string, object>)propertyBag1).Add("WarningPollsInterval", (object)threshold.get_WarningPollsInterval()); ((Dictionary <string, object>)propertyBag1).Add("CriticalPolls", (object)threshold.get_CriticalPolls()); ((Dictionary <string, object>)propertyBag1).Add("CriticalPollsInterval", (object)threshold.get_CriticalPollsInterval()); ((Dictionary <string, object>)propertyBag1).Add("WarningEnabled", (object)threshold.get_WarningEnabled()); ((Dictionary <string, object>)propertyBag1).Add("CriticalEnabled", (object)threshold.get_CriticalEnabled()); PropertyBag propertyBag2 = propertyBag1; if (instanceInformation != null && !string.IsNullOrEmpty(instanceInformation.NetObject)) { ((Dictionary <string, object>)propertyBag2).Add("NetObject", (object)instanceInformation.NetObject); } if (this._previousThresholdValues != null && this._previousThresholdValues.Rows.Count > 0) { Dictionary <string, object> dictionary = new Dictionary <string, object>(); object obj1 = this._previousThresholdValues.Rows[0]["ThresholdOperator"]; object obj2 = this._previousThresholdValues.Rows[0]["Level1Value"]; object obj3 = this._previousThresholdValues.Rows[0]["Level2Value"]; object obj4 = this._previousThresholdValues.Rows[0]["Level1Formula"]; object obj5 = this._previousThresholdValues.Rows[0]["Level2Formula"]; object obj6 = this._previousThresholdValues.Rows[0]["WarningPolls"]; object obj7 = this._previousThresholdValues.Rows[0]["WarningPollsInterval"]; object obj8 = this._previousThresholdValues.Rows[0]["CriticalPolls"]; object obj9 = this._previousThresholdValues.Rows[0]["CriticalPollsInterval"]; object obj10 = this._previousThresholdValues.Rows[0]["WarningEnabled"]; object obj11 = this._previousThresholdValues.Rows[0]["CriticalEnabled"]; dictionary.Add("ThresholdOperator", obj1 != DBNull.Value ? obj1 : (object)null); dictionary.Add("Level1Value", obj2 != DBNull.Value ? obj2 : (object)null); dictionary.Add("Level2Value", obj3 != DBNull.Value ? obj3 : (object)null); dictionary.Add("Level1Formula", obj4 != DBNull.Value ? obj4 : (object)null); dictionary.Add("Level2Formula", obj5 != DBNull.Value ? obj5 : (object)null); dictionary.Add("WarningPolls", obj6 != DBNull.Value ? obj6 : (object)null); dictionary.Add("WarningPollsInterval", obj7 != DBNull.Value ? obj7 : (object)null); dictionary.Add("CriticalPolls", obj8 != DBNull.Value ? obj8 : (object)null); dictionary.Add("CriticalPollsInterval", obj9 != DBNull.Value ? obj9 : (object)null); dictionary.Add("WarningEnabled", obj10 != DBNull.Value ? obj10 : (object)null); dictionary.Add("CriticalEnabled", obj11 != DBNull.Value ? obj11 : (object)null); if (dictionary.Count > 0) { ((Dictionary <string, object>)propertyBag2).Add("PreviousProperties", (object)dictionary); } this._previousThresholdValues.Clear(); } this._publishManager.Publish((INotification) new ThresholdNotification(IndicationHelper.GetIndicationType((IndicationType)2), (IDictionary <string, object>)propertyBag2)); }
// Token: 0x060004EE RID: 1262 RVA: 0x0001EE44 File Offset: 0x0001D044 public void ReportThresholdIndication(Threshold threshold) { if (threshold == null) { throw new ArgumentNullException("threshold"); } string thresholdEntityType = this.GetThresholdEntityType(threshold.ThresholdName); ThresholdIndicator.InstanceInformation instanceInformation = this.GetInstanceInformation(thresholdEntityType, threshold.InstanceId); PropertyBag propertyBag = new PropertyBag(); propertyBag.Add("InstanceType", "Orion.Thresholds"); propertyBag.Add("Name", threshold.ThresholdName); propertyBag.Add("InstanceName", (instanceInformation != null) ? instanceInformation.InstanceName : threshold.InstanceId.ToString()); propertyBag.Add("InstanceId", threshold.InstanceId); propertyBag.Add("ThresholdType", (int)threshold.ThresholdType); propertyBag.Add("ThresholdOperator", (int)threshold.ThresholdOperator); propertyBag.Add("Level1Value", threshold.Warning); propertyBag.Add("Level2Value", threshold.Critical); propertyBag.Add("Level1Formula", threshold.WarningFormula); propertyBag.Add("Level2Formula", threshold.CriticalFormula); propertyBag.Add("WarningPolls", threshold.WarningPolls); propertyBag.Add("WarningPollsInterval", threshold.WarningPollsInterval); propertyBag.Add("CriticalPolls", threshold.CriticalPolls); propertyBag.Add("CriticalPollsInterval", threshold.CriticalPollsInterval); propertyBag.Add("WarningEnabled", threshold.WarningEnabled); propertyBag.Add("CriticalEnabled", threshold.CriticalEnabled); PropertyBag propertyBag2 = propertyBag; if (instanceInformation != null && !string.IsNullOrEmpty(instanceInformation.NetObject)) { propertyBag2.Add("NetObject", instanceInformation.NetObject); } if (this._previousThresholdValues != null && this._previousThresholdValues.Rows.Count > 0) { PropertyBag propertyBag3 = new PropertyBag(); object obj = this._previousThresholdValues.Rows[0]["ThresholdOperator"]; object obj2 = this._previousThresholdValues.Rows[0]["Level1Value"]; object obj3 = this._previousThresholdValues.Rows[0]["Level2Value"]; object obj4 = this._previousThresholdValues.Rows[0]["Level1Formula"]; object obj5 = this._previousThresholdValues.Rows[0]["Level2Formula"]; object obj6 = this._previousThresholdValues.Rows[0]["WarningPolls"]; object obj7 = this._previousThresholdValues.Rows[0]["WarningPollsInterval"]; object obj8 = this._previousThresholdValues.Rows[0]["CriticalPolls"]; object obj9 = this._previousThresholdValues.Rows[0]["CriticalPollsInterval"]; object obj10 = this._previousThresholdValues.Rows[0]["WarningEnabled"]; object obj11 = this._previousThresholdValues.Rows[0]["CriticalEnabled"]; propertyBag3.Add("ThresholdOperator", (obj != DBNull.Value) ? obj : null); propertyBag3.Add("Level1Value", (obj2 != DBNull.Value) ? obj2 : null); propertyBag3.Add("Level2Value", (obj3 != DBNull.Value) ? obj3 : null); propertyBag3.Add("Level1Formula", (obj4 != DBNull.Value) ? obj4 : null); propertyBag3.Add("Level2Formula", (obj5 != DBNull.Value) ? obj5 : null); propertyBag3.Add("WarningPolls", (obj6 != DBNull.Value) ? obj6 : null); propertyBag3.Add("WarningPollsInterval", (obj7 != DBNull.Value) ? obj7 : null); propertyBag3.Add("CriticalPolls", (obj8 != DBNull.Value) ? obj8 : null); propertyBag3.Add("CriticalPollsInterval", (obj9 != DBNull.Value) ? obj9 : null); propertyBag3.Add("WarningEnabled", (obj10 != DBNull.Value) ? obj10 : null); propertyBag3.Add("CriticalEnabled", (obj11 != DBNull.Value) ? obj11 : null); if (propertyBag3.Count > 0) { propertyBag2.Add("PreviousProperties", propertyBag3); } this._previousThresholdValues.Clear(); } this._indicationPublisher.ReportIndication(new ThresholdIndication(2, propertyBag2)); }