Example #1
0
        internal void ProcessHealth(Action <ConsolidatedHealth> action)
        {
            int num = 0;

            foreach (KeyValuePair <string, Dictionary <string, List <MonitorHealthEntry> > > keyValuePair in this.serverHealthMap)
            {
                Dictionary <string, List <MonitorHealthEntry> > value = keyValuePair.Value;
                if (value != null)
                {
                    num += value.Count;
                }
            }
            foreach (KeyValuePair <string, Dictionary <string, List <MonitorHealthEntry> > > keyValuePair2 in this.serverHealthMap)
            {
                string key = keyValuePair2.Key;
                Dictionary <string, List <MonitorHealthEntry> > value2 = keyValuePair2.Value;
                foreach (KeyValuePair <string, List <MonitorHealthEntry> > keyValuePair3 in value2)
                {
                    string key2 = keyValuePair3.Key;
                    List <MonitorHealthEntry> value3 = keyValuePair3.Value;
                    string healthGroup = null;
                    MonitorServerComponentState state = MonitorServerComponentState.Unknown;
                    if (value3 != null && value3.Count > 0)
                    {
                        MonitorHealthEntry monitorHealthEntry = value3.First <MonitorHealthEntry>();
                        if (monitorHealthEntry != null)
                        {
                            healthGroup = monitorHealthEntry.HealthGroupName;
                            state       = monitorHealthEntry.CurrentHealthSetState;
                        }
                    }
                    int monitorCount            = 0;
                    int haImpactingMonitorCount = 0;
                    if (value3 != null)
                    {
                        monitorCount            = value3.Count <MonitorHealthEntry>();
                        haImpactingMonitorCount = value3.Count((MonitorHealthEntry che) => che.IsHaImpacting);
                    }
                    HealthReportHelper.HealthSetStatistics healthSetStats = this.GetHealthSetStats(value3);
                    MonitorAlertState  alertValue         = this.CalculatedConsolidatedHealthSetAlertValue(healthSetStats);
                    DateTime           lastTransitionTime = healthSetStats.LastTransitionTime;
                    ConsolidatedHealth obj = new ConsolidatedHealth(key, key2, healthGroup, alertValue, state, monitorCount, haImpactingMonitorCount, lastTransitionTime, value3);
                    action(obj);
                }
            }
        }
Example #2
0
        internal void ProcessEntry(MonitorHealthEntry healthEntry)
        {
            Dictionary <string, List <MonitorHealthEntry> > dictionary = null;

            if (!this.serverHealthMap.TryGetValue(healthEntry.Server, out dictionary))
            {
                dictionary = new Dictionary <string, List <MonitorHealthEntry> >();
                this.serverHealthMap[healthEntry.Server] = dictionary;
            }
            List <MonitorHealthEntry> list = null;

            if (!dictionary.TryGetValue(healthEntry.HealthSetName, out list))
            {
                list = new List <MonitorHealthEntry>();
                dictionary[healthEntry.HealthSetName] = list;
            }
            list.Add(healthEntry);
        }