コード例 #1
0
 public Task OnNotificationAsync(Notification notification)
 {
     if (OrionCoreNotificationSubscriber.log.get_IsDebugEnabled())
     {
         OrionCoreNotificationSubscriber.log.DebugFormat("Indication of type \"{0}\" arrived.", (object)notification.get_IndicationType());
     }
     try
     {
         if (notification.get_IndicationType() == IndicationHelper.GetIndicationType((IndicationType)1))
         {
             object obj;
             if (notification.get_SourceInstanceProperties().TryGetValue("InstanceType", out obj))
             {
                 if (string.Equals(obj as string, "Orion.Nodes", StringComparison.OrdinalIgnoreCase))
                 {
                     if (notification.get_SourceInstanceProperties().ContainsKey("NodeID"))
                     {
                         this.InsertIntoDeletedTable(Convert.ToInt32(notification.get_SourceInstanceProperties()["NodeID"]));
                     }
                     else
                     {
                         OrionCoreNotificationSubscriber.log.WarnFormat("Indication is type of {0} but does not contain NodeID", (object)notification.get_IndicationType());
                     }
                 }
             }
         }
     }
     catch (Exception ex)
     {
         OrionCoreNotificationSubscriber.log.Error((object)string.Format("Exception occured when processing incoming indication of type \"{0}\"", (object)notification.get_IndicationType()), ex);
     }
     return(Task.CompletedTask);
 }
 // Token: 0x06000590 RID: 1424 RVA: 0x00021CEC File Offset: 0x0001FEEC
 public void OnIndication(string subscriptionId, string indicationType, PropertyBag indicationProperties, PropertyBag sourceInstanceProperties)
 {
     if (this.subscriptionId != subscriptionId)
     {
         return;
     }
     MaintenanceIndicationSubscriber.log.DebugFormat("Received maintenance mode indication '{0}'.", indicationType);
     MaintenanceIndicationSubscriber.log.DebugFormat("Indication Properties: {0}", indicationProperties);
     MaintenanceIndicationSubscriber.log.DebugFormat("Source Instance Properties: {0}", sourceInstanceProperties);
     try
     {
         MaintenancePlanAssignment assignment = this.CreateAssignment(sourceInstanceProperties);
         if (IndicationHelper.GetIndicationType(0).Equals(indicationType))
         {
             this.manager.Unmanage(assignment);
         }
         else if (IndicationHelper.GetIndicationType(1).Equals(indicationType))
         {
             this.manager.Remanage(assignment);
         }
         else
         {
             IndicationHelper.GetIndicationType(2).Equals(indicationType);
         }
     }
     catch (Exception ex)
     {
         MaintenanceIndicationSubscriber.log.ErrorFormat("Unable to process maintenance mode indication. {0}", ex);
         throw;
     }
 }
コード例 #3
0
 public Task OnNotificationAsync(Notification notification)
 {
     if (!this._subscriptionId.get_Id().Equals((object)notification.get_SubscriptionId()))
     {
         return(Task.CompletedTask);
     }
     MaintenanceIndicationSubscriber.log.DebugFormat("Received maintenance mode indication '{0}'.", (object)notification.get_IndicationType());
     MaintenanceIndicationSubscriber.log.DebugFormat("Indication Properties: {0}", (object)notification.get_IndicationProperties());
     MaintenanceIndicationSubscriber.log.DebugFormat("Source Instance Properties: {0}", (object)notification.get_SourceInstanceProperties());
     try
     {
         MaintenancePlanAssignment assignment = this.CreateAssignment(notification.get_SourceInstanceProperties());
         if (IndicationHelper.GetIndicationType((IndicationType)0).Equals(notification.get_IndicationType()))
         {
             this.manager.Unmanage(assignment);
         }
         else if (IndicationHelper.GetIndicationType((IndicationType)1).Equals(notification.get_IndicationType()))
         {
             this.manager.Remanage(assignment);
         }
         else
         {
             IndicationHelper.GetIndicationType((IndicationType)2).Equals(notification.get_IndicationType());
         }
     }
     catch (Exception ex)
     {
         MaintenanceIndicationSubscriber.log.ErrorFormat("Unable to process maintenance mode indication. {0}", (object)ex);
         throw;
     }
     return(Task.CompletedTask);
 }
 // Token: 0x0600036C RID: 876 RVA: 0x00015654 File Offset: 0x00013854
 public void OnIndication(string subscriptionId, string indicationType, PropertyBag indicationProperties, PropertyBag sourceInstanceProperties)
 {
     if (OrionCoreNotificationSubscriber.log.IsDebugEnabled)
     {
         OrionCoreNotificationSubscriber.log.DebugFormat("Indication of type \"{0}\" arrived.", indicationType);
     }
     try
     {
         object obj;
         if (indicationType == IndicationHelper.GetIndicationType(1) && sourceInstanceProperties.TryGetValue("InstanceType", out obj) && string.Equals(obj as string, "Orion.Nodes", StringComparison.OrdinalIgnoreCase))
         {
             if (sourceInstanceProperties.ContainsKey("NodeID"))
             {
                 int nodeId = Convert.ToInt32(sourceInstanceProperties["NodeID"]);
                 this.InsertIntoDeletedTable(nodeId);
             }
             else
             {
                 OrionCoreNotificationSubscriber.log.WarnFormat("Indication is type of {0} but does not contain NodeID", indicationType);
             }
         }
     }
     catch (Exception ex)
     {
         OrionCoreNotificationSubscriber.log.Error(string.Format("Exception occured when processing incomming indication of type \"{0}\"", indicationType), ex);
     }
 }
        // Token: 0x06000028 RID: 40 RVA: 0x00002B7C File Offset: 0x00000D7C
        private void PublishModificationOfAuditingEvents(AuditDatabaseDecoratedContainer auditDatabaseDecoratedContainer, int insertedId)
        {
            if (this.indicationPublisher == null)
            {
                this.indicationPublisher = IndicationPublisher.CreateV3();
            }
            Dictionary <string, object> dictionary = new Dictionary <string, object>
            {
                {
                    "ActionType",
                    auditDatabaseDecoratedContainer.ActionType.ToString()
                },
                {
                    "AuditEventId",
                    insertedId
                },
                {
                    "InstanceType",
                    "Orion.AuditingEvents"
                },
                {
                    "OriginalAccountId",
                    auditDatabaseDecoratedContainer.AccountId
                }
            };
            Indication indication = new Indication
            {
                IndicationProperties     = IndicationHelper.GetIndicationProperties(),
                IndicationType           = "System.InstanceCreated",
                SourceInstanceProperties = new PropertyBag(dictionary)
            };

            this.indicationPublisher.Publish(indication);
        }
コード例 #6
0
 internal void ProcessIndications(
     IEnumerable <EnhancedNodeStatusIndicator.IndicationInfo> indications)
 {
     foreach (EnhancedNodeStatusIndicator.IndicationInfo indication in indications)
     {
         try
         {
             EnhancedNodeStatusIndicator.NodeStatusIndication statusIndication = (EnhancedNodeStatusIndicator.NodeStatusIndication)OrionSerializationHelper.FromJSON(indication.Data, typeof(EnhancedNodeStatusIndicator.NodeStatusIndication));
             PropertyBag propertyBag1 = new PropertyBag();
             ((Dictionary <string, object>)propertyBag1)["PreviousStatus"] = (object)statusIndication.PreviousStatus;
             PropertyBag propertyBag2 = new PropertyBag();
             ((Dictionary <string, object>)propertyBag2)["NodeID"]             = (object)statusIndication.NodeID;
             ((Dictionary <string, object>)propertyBag2)["Status"]             = (object)statusIndication.Status;
             ((Dictionary <string, object>)propertyBag2)["InstanceType"]       = (object)"Orion.Nodes";
             ((Dictionary <string, object>)propertyBag2)["PreviousProperties"] = (object)propertyBag1;
             this.ip.ReportIndication(IndicationHelper.GetIndicationType((IndicationType)2), IndicationHelper.GetIndicationProperties(), propertyBag2);
             this.DeleteIndicationFromDB(indication);
             EnhancedNodeStatusIndicator.log.Debug((object)("Enhanced node status indication processed " + string.Format("(N:{0} [{1}]->[{2}])", (object)statusIndication.NodeID, (object)statusIndication.PreviousStatus, (object)statusIndication.Status)));
         }
         catch (Exception ex)
         {
             EnhancedNodeStatusIndicator.log.Error((object)"Indication processing failed", ex);
         }
     }
 }
コード例 #7
0
 // Token: 0x060005D2 RID: 1490 RVA: 0x00022D14 File Offset: 0x00020F14
 internal void ProcessIndications(IEnumerable <EnhancedNodeStatusIndicator.IndicationInfo> indications)
 {
     foreach (EnhancedNodeStatusIndicator.IndicationInfo indicationInfo in indications)
     {
         try
         {
             EnhancedNodeStatusIndicator.NodeStatusIndication nodeStatusIndication = (EnhancedNodeStatusIndicator.NodeStatusIndication)OrionSerializationHelper.FromJSON(indicationInfo.Data, typeof(EnhancedNodeStatusIndicator.NodeStatusIndication));
             PropertyBag propertyBag = new PropertyBag();
             propertyBag["PreviousStatus"] = nodeStatusIndication.PreviousStatus;
             PropertyBag propertyBag2 = new PropertyBag();
             propertyBag2["NodeID"]             = nodeStatusIndication.NodeID;
             propertyBag2["Status"]             = nodeStatusIndication.Status;
             propertyBag2["InstanceType"]       = "Orion.Nodes";
             propertyBag2["PreviousProperties"] = propertyBag;
             this.ip.ReportIndication(IndicationHelper.GetIndicationType(2), IndicationHelper.GetIndicationProperties(), propertyBag2);
             this.DeleteIndicationFromDB(indicationInfo);
             EnhancedNodeStatusIndicator.log.Debug("Enhanced node status indication processed " + string.Format("(N:{0} [{1}]->[{2}])", nodeStatusIndication.NodeID, nodeStatusIndication.PreviousStatus, nodeStatusIndication.Status));
         }
         catch (Exception ex)
         {
             EnhancedNodeStatusIndicator.log.Error("Indication processing failed", ex);
         }
     }
 }
コード例 #8
0
 private void PublishModificationOfAuditingEvents(
     AuditDatabaseDecoratedContainer auditDatabaseDecoratedContainer,
     int insertedId)
 {
     if (this.notificationPublisherManager == null)
     {
         this.notificationPublisherManager = PublisherClient.get_Instance();
     }
     this.notificationPublisherManager.Publish((INotification) new Notification("System.InstanceCreated", (IDictionary <string, object>)IndicationHelper.GetIndicationProperties(), (IDictionary <string, object>) new Dictionary <string, object>()
     {
         {
             "ActionType",
             (object)((object)auditDatabaseDecoratedContainer.get_ActionType()).ToString()
         },
         {
             "AuditEventId",
             (object)insertedId
         },
         {
             "InstanceType",
             (object)"Orion.AuditingEvents"
         },
         {
             "OriginalAccountId",
             (object)auditDatabaseDecoratedContainer.AccountId
         }
     }));
 }
コード例 #9
0
        public Task OnNotificationAsync(Notification notification)
        {
            if (AuditingNotificationSubscriber.log.get_IsDebugEnabled())
            {
                AuditingNotificationSubscriber.log.DebugFormat("OnNotification type: {0} SubscriptionId: {1}", (object)notification.get_IndicationType(), (object)notification.get_SubscriptionId());
            }
            PropertyBag propertyBag1 = new PropertyBag(notification.get_SourceInstanceProperties());
            PropertyBag propertyBag2 = new PropertyBag(notification.get_IndicationProperties());

            if (this.checkAuditingSetting)
            {
                try
                {
                    object obj;
                    if (IndicationHelper.GetIndicationType((IndicationType)2) == notification.get_IndicationType() && propertyBag1 != null && ((string)propertyBag1.TryGet <string>("SettingsID") == "SWNetPerfMon-AuditingTrails" && (string)propertyBag1.TryGet <string>("InstanceType") == "Orion.Settings") && ((Dictionary <string, object>)propertyBag1).TryGetValue("CurrentValue", out obj))
                    {
                        this.AuditingTrailsEnabled = Convert.ToBoolean(obj);
                    }
                    else if (!this.AuditingTrailsEnabled)
                    {
                        return(Task.CompletedTask);
                    }
                }
                catch (Exception ex)
                {
                    AuditingNotificationSubscriber.log.FatalFormat("Auditing check error - will be forciby enabled. {0}", (object)ex);
                    this.AuditingTrailsEnabled = true;
                    this.checkAuditingSetting  = false;
                }
            }
            AuditNotificationContainer auditNotificationContainer = new AuditNotificationContainer(notification.get_IndicationType(), propertyBag2, propertyBag1);
            IEnumerable <IAuditing2>   iauditing2s;

            if (this.subscriptionIdToAuditingInstances.TryGetValue(notification.get_SubscriptionId().ToString(), out iauditing2s))
            {
                using (IEnumerator <IAuditing2> enumerator1 = iauditing2s.GetEnumerator())
                {
                    while (((IEnumerator)enumerator1).MoveNext())
                    {
                        IAuditing2 current1 = enumerator1.Current;
                        try
                        {
                            if (AuditingNotificationSubscriber.log.get_IsTraceEnabled())
                            {
                                AuditingNotificationSubscriber.log.TraceFormat("Trying plugin {0}", new object[1]
                                {
                                    (object)current1
                                });
                            }
                            IEnumerable <AuditDataContainer> source = ((IAuditing)current1).ComposeDataContainers(auditNotificationContainer);
                            if (source != null)
                            {
                                if (AuditingNotificationSubscriber.log.get_IsTraceEnabled())
                                {
                                    AuditingNotificationSubscriber.log.Trace((object)"Storing notification.");
                                }
                                CultureInfo currentUiCulture = Thread.CurrentThread.CurrentUICulture;
                                try
                                {
                                    Thread.CurrentThread.CurrentUICulture = LocaleConfiguration.GetNonNeutralLocale(LocaleConfiguration.get_PrimaryLocale());
                                }
                                catch (Exception ex)
                                {
                                    AuditingNotificationSubscriber.log.Warn((object)"Unable set CurrentUICulture to PrimaryLocale.", ex);
                                }
                                using (IEnumerator <AuditDataContainer> enumerator2 = source.Select <AuditDataContainer, AuditDataContainer>((Func <AuditDataContainer, AuditDataContainer>)(composedDataContainer => new AuditDataContainer(composedDataContainer, auditNotificationContainer.get_AccountId()))).GetEnumerator())
                                {
                                    while (((IEnumerator)enumerator2).MoveNext())
                                    {
                                        AuditDataContainer current2 = enumerator2.Current;
                                        AuditDatabaseDecoratedContainer decoratedContainer = new AuditDatabaseDecoratedContainer(current2, auditNotificationContainer, ((IAuditing)current1).GetMessage(current2));
                                        int insertedId = this.auditingDAL.StoreNotification(decoratedContainer);
                                        this.PublishModificationOfAuditingEvents(decoratedContainer, insertedId);
                                    }
                                }
                                try
                                {
                                    Thread.CurrentThread.CurrentUICulture = currentUiCulture;
                                }
                                catch (Exception ex)
                                {
                                    AuditingNotificationSubscriber.log.Warn((object)"Unable set CurrentUICulture back to original locale.", ex);
                                }
                            }
                            else if (AuditingNotificationSubscriber.log.get_IsTraceEnabled())
                            {
                                AuditingNotificationSubscriber.log.Trace((object)"ComposeDataContainers returned null.");
                            }
                        }
                        catch (Exception ex)
                        {
                            string seed = string.Empty;
                            if (propertyBag2 != null)
                            {
                                seed = ((IEnumerable <KeyValuePair <string, object> >)propertyBag2).Aggregate <KeyValuePair <string, object>, string>(Environment.NewLine, (Func <string, KeyValuePair <string, object>, string>)((current, item) => current + this.FormatPropertyData("Indication Property: ", item.Key, item.Value)));
                            }
                            if (propertyBag1 != null)
                            {
                                seed = ((IEnumerable <KeyValuePair <string, object> >)propertyBag1).Aggregate <KeyValuePair <string, object>, string>(seed, (Func <string, KeyValuePair <string, object>, string>)((current, item) => current + this.FormatPropertyData("SourceInstance Property: ", item.Key, item.Value)));
                            }
                            AuditingNotificationSubscriber.log.ErrorFormat("Auditing translation failed. IndicationType: {0}, {1} PluginName: {2}, subscriptionId: {3} Exception: {4}", new object[5]
                            {
                                (object)notification.get_IndicationType(),
                                (object)seed,
                                (object)((IAuditing)current1).get_PluginName(),
                                (object)notification.get_SubscriptionId(),
                                (object)ex
                            });
                        }
                    }
                }
            }
            else if (AuditingNotificationSubscriber.log.get_IsDebugEnabled())
            {
                AuditingNotificationSubscriber.log.DebugFormat("No auditing instances has been registered yet for subscriptionId '{0}'", (object)notification.get_SubscriptionId().ToString());
            }
            return(Task.CompletedTask);
        }
        // Token: 0x06000601 RID: 1537 RVA: 0x00023D38 File Offset: 0x00021F38
        public void OnIndication(string subscriptionId, string indicationType, PropertyBag indicationProperties, PropertyBag sourceInstanceProperties)
        {
            Stopwatch stopwatch = new Stopwatch();

            try
            {
                stopwatch.Start();
                if (sourceInstanceProperties == null)
                {
                    throw new ArgumentNullException("sourceInstanceProperties");
                }
                if (DowntimeMonitoringNotificationSubscriber.log.IsDebugEnabled)
                {
                    DowntimeMonitoringNotificationSubscriber.log.Debug(this.DetailInfo(subscriptionId, indicationType, indicationProperties, sourceInstanceProperties));
                }
                string text = sourceInstanceProperties.TryGet <string>("InstanceType") ?? sourceInstanceProperties.TryGet <string>("SourceInstanceType");
                if (text == null)
                {
                    DowntimeMonitoringNotificationSubscriber.log.Error("Wrong PropertyBag data. InstanceType or SourceInstanceType are null");
                }
                else
                {
                    string netObjectIdColumnForSwisEntity = this.GetNetObjectIdColumnForSwisEntity(text);
                    object obj;
                    if (netObjectIdColumnForSwisEntity == null)
                    {
                        DowntimeMonitoringNotificationSubscriber.log.DebugFormat("Not a supported instance type: {0}", text);
                    }
                    else if (!sourceInstanceProperties.TryGetValue(netObjectIdColumnForSwisEntity, out obj))
                    {
                        DowntimeMonitoringNotificationSubscriber.log.DebugFormat("Unable to get Entity ID. InstanceType : {0}, ID Field: {1}", text, netObjectIdColumnForSwisEntity);
                    }
                    else if (indicationType == IndicationHelper.GetIndicationType(2) || indicationType == IndicationHelper.GetIndicationType(0))
                    {
                        object obj2;
                        sourceInstanceProperties.TryGetValue("Status", out obj2);
                        if (obj2 == null)
                        {
                            DowntimeMonitoringNotificationSubscriber.log.DebugFormat("No Status reported for InstanceType : {0}", text);
                        }
                        else
                        {
                            if (this._nodeNetObjectIdColumn == null)
                            {
                                this._nodeNetObjectIdColumn = this.GetNetObjectIdColumnForSwisEntity("Orion.Nodes");
                            }
                            object obj3;
                            sourceInstanceProperties.TryGetValue(this._nodeNetObjectIdColumn, out obj3);
                            if (obj3 == null)
                            {
                                DowntimeMonitoringNotificationSubscriber.log.DebugFormat("SourceBag must include NodeId. InstanceType : {0}", text);
                            }
                            else
                            {
                                this._netObjectDowntimeDal.Insert(new NetObjectDowntime
                                {
                                    EntityID     = obj.ToString(),
                                    NodeID       = this.ExtractStatusID(obj3),
                                    EntityType   = text,
                                    DateTimeFrom = (DateTime)indicationProperties[IndicationConstants.IndicationTime],
                                    StatusID     = this.ExtractStatusID(obj2)
                                });
                            }
                        }
                    }
                    else if (indicationType == IndicationHelper.GetIndicationType(1))
                    {
                        this._netObjectDowntimeDal.DeleteDowntimeObjects(obj.ToString(), text);
                    }
                }
            }
            catch (Exception ex)
            {
                DowntimeMonitoringNotificationSubscriber.log.Error(string.Format("Exception occured when processing incoming indication of type \"{0}\"", indicationType), ex);
            }
            finally
            {
                stopwatch.Stop();
                DowntimeMonitoringNotificationSubscriber.log.DebugFormat("Downtime notification has been processed in {0} miliseconds.", stopwatch.ElapsedMilliseconds);
            }
        }
コード例 #11
0
        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: 0x06000027 RID: 39 RVA: 0x000027E0 File Offset: 0x000009E0
        public void OnIndication(string subscriptionId, string indicationType, PropertyBag indicationProperties, PropertyBag sourceInstanceProperties)
        {
            if (AuditingNotificationSubscriber.log.IsDebugEnabled)
            {
                AuditingNotificationSubscriber.log.DebugFormat("OnIndication type: {0} SubscriptionId: {1}", indicationType, subscriptionId);
            }
            if (this.checkAuditingSetting)
            {
                try
                {
                    object value;
                    if (IndicationHelper.GetIndicationType(2) == indicationType && sourceInstanceProperties != null && sourceInstanceProperties.TryGet <string>("SettingsID") == "SWNetPerfMon-AuditingTrails" && sourceInstanceProperties.TryGet <string>("InstanceType") == "Orion.Settings" && sourceInstanceProperties.TryGetValue("CurrentValue", out value))
                    {
                        this.AuditingTrailsEnabled = Convert.ToBoolean(value);
                    }
                    else if (!this.AuditingTrailsEnabled)
                    {
                        return;
                    }
                }
                catch (Exception ex)
                {
                    AuditingNotificationSubscriber.log.FatalFormat("Auditing check error - will be forciby enabled. {0}", ex);
                    this.AuditingTrailsEnabled = true;
                    this.checkAuditingSetting  = false;
                }
            }
            AuditNotificationContainer auditNotificationContainer = new AuditNotificationContainer(indicationType, indicationProperties, sourceInstanceProperties);

            Func <AuditDataContainer, AuditDataContainer> < > 9__0;
            Func <string, KeyValuePair <string, object>, string> < > 9__1;
            Func <string, KeyValuePair <string, object>, string> < > 9__2;
            foreach (IAuditing2 auditing in this.subscriptionIdToAuditingInstances[subscriptionId])
            {
                try
                {
                    if (AuditingNotificationSubscriber.log.IsTraceEnabled)
                    {
                        AuditingNotificationSubscriber.log.TraceFormat("Trying plugin {0}", new object[]
                        {
                            auditing
                        });
                    }
                    IEnumerable <AuditDataContainer> enumerable = auditing.ComposeDataContainers(auditNotificationContainer);
                    if (enumerable != null)
                    {
                        if (AuditingNotificationSubscriber.log.IsTraceEnabled)
                        {
                            AuditingNotificationSubscriber.log.Trace("Storing notification.");
                        }
                        CultureInfo currentUICulture = Thread.CurrentThread.CurrentUICulture;
                        try
                        {
                            Thread.CurrentThread.CurrentUICulture = LocaleConfiguration.GetNonNeutralLocale(LocaleConfiguration.PrimaryLocale);
                        }
                        catch (Exception ex2)
                        {
                            AuditingNotificationSubscriber.log.Warn("Unable set CurrentUICulture to PrimaryLocale.", ex2);
                        }
                        IEnumerable <AuditDataContainer> source = enumerable;
                        Func <AuditDataContainer, AuditDataContainer> selector;
                        if ((selector = < > 9__0) == null)
                        {
                            selector = (< > 9__0 = ((AuditDataContainer composedDataContainer) => new AuditDataContainer(composedDataContainer, auditNotificationContainer.AccountId)));
                        }
                        foreach (AuditDataContainer auditDataContainer in source.Select(selector))
                        {
                            AuditDatabaseDecoratedContainer auditDatabaseDecoratedContainer = new AuditDatabaseDecoratedContainer(auditDataContainer, auditNotificationContainer, auditing.GetMessage(auditDataContainer));
                            int insertedId = this.auditingDAL.StoreNotification(auditDatabaseDecoratedContainer);
                            this.PublishModificationOfAuditingEvents(auditDatabaseDecoratedContainer, insertedId);
                        }
                        try
                        {
                            Thread.CurrentThread.CurrentUICulture = currentUICulture;
                            continue;
                        }
                        catch (Exception ex3)
                        {
                            AuditingNotificationSubscriber.log.Warn("Unable set CurrentUICulture back to original locale.", ex3);
                            continue;
                        }
                    }
                    if (AuditingNotificationSubscriber.log.IsTraceEnabled)
                    {
                        AuditingNotificationSubscriber.log.Trace("ComposeDataContainers returned null.");
                    }
                }
                catch (Exception ex4)
                {
                    string text = string.Empty;
                    if (indicationProperties != null)
                    {
                        string newLine = Environment.NewLine;
                        Func <string, KeyValuePair <string, object>, string> func;
                        if ((func = < > 9__1) == null)
                        {
                            func = (< > 9__1 = ((string current, KeyValuePair <string, object> item) => current + this.FormatPropertyData("Indication Property: ", item.Key, item.Value)));
                        }
                        text = indicationProperties.Aggregate(newLine, func);
                    }
                    if (sourceInstanceProperties != null)
                    {
                        string seed = text;
                        Func <string, KeyValuePair <string, object>, string> func2;
                        if ((func2 = < > 9__2) == null)
                        {
                            func2 = (< > 9__2 = ((string current, KeyValuePair <string, object> item) => current + this.FormatPropertyData("SourceInstance Property: ", item.Key, item.Value)));
                        }
                        text = sourceInstanceProperties.Aggregate(seed, func2);
                    }
                    AuditingNotificationSubscriber.log.ErrorFormat("Auditing translation failed. IndicationType: {0}, {1} PluginName: {2}, subscriptionId: {3} Exception: {4}", new object[]
                    {
                        indicationType,
                        text,
                        auditing.PluginName,
                        subscriptionId,
                        ex4
                    });
                }
            }
        }
        public Task OnNotificationAsync(Notification notification)
        {
            Stopwatch stopwatch = new Stopwatch();

            try
            {
                stopwatch.Start();
                if (notification.get_SourceInstanceProperties() == null)
                {
                    throw new ArgumentNullException("sourceInstanceProperties");
                }
                if (DowntimeMonitoringNotificationSubscriber.log.get_IsDebugEnabled())
                {
                    DowntimeMonitoringNotificationSubscriber.log.Debug((object)this.DetailInfo(notification.get_SubscriptionId(), notification.get_IndicationType(), notification.get_IndicationProperties(), notification.get_SourceInstanceProperties()));
                }
                object obj1 = (object)null;
                notification.get_SourceInstanceProperties().TryGetValue("InstanceType", out obj1);
                if (obj1 == null)
                {
                    notification.get_SourceInstanceProperties().TryGetValue("SourceInstanceType", out obj1);
                }
                if (!(obj1 is string instanceType))
                {
                    DowntimeMonitoringNotificationSubscriber.log.Error((object)"Wrong PropertyBag data. InstanceType or SourceInstanceType are null");
                    return(Task.CompletedTask);
                }
                string columnForSwisEntity = this.GetNetObjectIdColumnForSwisEntity(instanceType);
                if (columnForSwisEntity == null)
                {
                    DowntimeMonitoringNotificationSubscriber.log.DebugFormat("Not a supported instance type: {0}", (object)instanceType);
                    return(Task.CompletedTask);
                }
                object obj2;
                if (!notification.get_SourceInstanceProperties().TryGetValue(columnForSwisEntity, out obj2))
                {
                    DowntimeMonitoringNotificationSubscriber.log.DebugFormat("Unable to get Entity ID. InstanceType : {0}, ID Field: {1}", (object)instanceType, (object)columnForSwisEntity);
                    return(Task.CompletedTask);
                }
                if (notification.get_IndicationType() == IndicationHelper.GetIndicationType((IndicationType)2) || notification.get_IndicationType() == IndicationHelper.GetIndicationType((IndicationType)0))
                {
                    object statusObject1;
                    notification.get_SourceInstanceProperties().TryGetValue("Status", out statusObject1);
                    if (statusObject1 == null)
                    {
                        DowntimeMonitoringNotificationSubscriber.log.DebugFormat("No Status reported for InstanceType : {0}", (object)instanceType);
                        return(Task.CompletedTask);
                    }
                    if (this._nodeNetObjectIdColumn == null)
                    {
                        this._nodeNetObjectIdColumn = this.GetNetObjectIdColumnForSwisEntity("Orion.Nodes");
                    }
                    object statusObject2;
                    notification.get_SourceInstanceProperties().TryGetValue(this._nodeNetObjectIdColumn, out statusObject2);
                    if (statusObject2 == null)
                    {
                        DowntimeMonitoringNotificationSubscriber.log.DebugFormat("SourceBag must include NodeId. InstanceType : {0}", (object)instanceType);
                        return(Task.CompletedTask);
                    }
                    INetObjectDowntimeDAL objectDowntimeDal = this._netObjectDowntimeDal;
                    NetObjectDowntime     netObjectDowntime = new NetObjectDowntime();
                    netObjectDowntime.set_EntityID(obj2.ToString());
                    netObjectDowntime.set_NodeID(this.ExtractStatusID(statusObject2));
                    netObjectDowntime.set_EntityType(instanceType);
                    netObjectDowntime.set_DateTimeFrom((DateTime)notification.get_IndicationProperties()[(string)IndicationConstants.IndicationTime]);
                    netObjectDowntime.set_StatusID(this.ExtractStatusID(statusObject1));
                    objectDowntimeDal.Insert(netObjectDowntime);
                }
                else if (notification.get_IndicationType() == IndicationHelper.GetIndicationType((IndicationType)1))
                {
                    this._netObjectDowntimeDal.DeleteDowntimeObjects(obj2.ToString(), instanceType);
                }
            }
            catch (Exception ex)
            {
                DowntimeMonitoringNotificationSubscriber.log.Error((object)string.Format("Exception occured when processing incoming indication of type \"{0}\"", (object)notification.get_IndicationType()), ex);
            }
            finally
            {
                stopwatch.Stop();
                DowntimeMonitoringNotificationSubscriber.log.DebugFormat("Downtime notification has been processed in {0} miliseconds.", (object)stopwatch.ElapsedMilliseconds);
            }
            return(Task.CompletedTask);
        }