Ejemplo n.º 1
0
 public static IEnumerable<IHealthReporter> Reporters(bool includeGCStats, ServiceElementCollection services)
 {
     yield return new Cpu();
     yield return new Load();
     yield return new Memory();
     foreach (ServiceElement service in services)
     {
         yield return new Service(service.Name);
     }
     foreach (var drive in DriveInfo.GetDrives().Where(drive => drive.DriveType == DriveType.Fixed)) {
         yield return new Disk(drive.Name);
     }
     var interfaces = NetworkInterface.GetAllNetworkInterfaces()
         .GroupBy(network => network.NetworkInterfaceType)
         .Where(network => network.Key != NetworkInterfaceType.Loopback);
     foreach (var networkType in interfaces) {
         var nt = networkType.ToList();
         for (var i = 0; i < nt.Count; i++) {
             var name = Translate(networkType.Key) + i;
             yield return new NetworkSent(nt[i], name);
             yield return new NetworkReceived(nt[i], name);
         }
     }
     if (includeGCStats) {
         yield return new DotNetGCTime();
     }
 }
Ejemplo n.º 2
0
        public static IEnumerable <IHealthReporter> Reporters(bool includeGCStats, ServiceElementCollection services)
        {
            yield return(new Cpu());

            yield return(new Load());

            yield return(new Memory());

            foreach (ServiceElement service in services)
            {
                yield return(new Service(service.Name));
            }
            foreach (var drive in DriveInfo.GetDrives().Where(drive => drive.DriveType == DriveType.Fixed))
            {
                yield return(new Disk(drive.Name));
            }
            var interfaces = NetworkInterface.GetAllNetworkInterfaces()
                             .GroupBy(network => network.NetworkInterfaceType)
                             .Where(network => network.Key != NetworkInterfaceType.Loopback);

            foreach (var networkType in interfaces)
            {
                var nt = networkType.ToList();
                for (var i = 0; i < nt.Count; i++)
                {
                    var name = Translate(networkType.Key) + i;
                    yield return(new NetworkSent(nt[i], name));

                    yield return(new NetworkReceived(nt[i], name));
                }
            }
            if (includeGCStats)
            {
                yield return(new DotNetGCTime());
            }
        }