public IEnumerable<MonitorEvent> Exec(IEnumerable<SNMPHost> hostList)
        {
            if (hostList == null)
                throw new ArgumentNullException("hostList");

            var eventosGerados = new Queue<MonitorEvent>();
            MonitorEvent ocorrencia = null;

            foreach (var host in hostList)
            {
                foreach (var evento in host.MonitoredEvents)
                {
                    switch (evento)
                    {
                        case MonitorKind.IsAlive:
                            if (!IsAlive(host))
                                ocorrencia = new MonitorEvent(host, evento);
                            break;
                        default:
                            break;
                    }
                    if (ocorrencia != null)
                    {
                        //host.EventQueue.Enqueue(ocorrencia);
                        eventosGerados.Enqueue(ocorrencia);
                    }
                    ocorrencia = null;
                }
            }

            return eventosGerados;
        }
Exemple #2
0
        public IEnumerable <MonitorEvent> Exec(IEnumerable <SNMPHost> hostList)
        {
            if (hostList == null)
            {
                throw new ArgumentNullException("hostList");
            }

            var          eventosGerados = new Queue <MonitorEvent>();
            MonitorEvent ocorrencia     = null;

            foreach (var host in hostList)
            {
                foreach (var evento in host.MonitoredEvents)
                {
                    switch (evento)
                    {
                    case MonitorKind.IsAlive:
                        if (!IsAlive(host))
                        {
                            ocorrencia = new MonitorEvent(host, evento);
                        }
                        break;

                    default:
                        break;
                    }
                    if (ocorrencia != null)
                    {
                        //host.EventQueue.Enqueue(ocorrencia);
                        eventosGerados.Enqueue(ocorrencia);
                    }
                    ocorrencia = null;
                }
            }

            return(eventosGerados);
        }