示例#1
0
        /// <inheritdoc />
        protected override List <IEvent> GetEventsImpl()
        {
            SystemInformationPayload payload = new SystemInformationPayload
            {
                OSName         = "Linux",
                OSVersion      = System.Runtime.InteropServices.RuntimeInformation.OSDescription,
                OsArchitecture = System.Runtime.InteropServices.RuntimeInformation.OSArchitecture.ToString(),
                HostName       = Environment.MachineName
            };

            SimpleLogger.Debug($"SystemInfoEventGenerator returns 1 payload");

            return(new List <IEvent> {
                new SystemInformation(Priority, payload)
            });
        }
        public void SystemInformation()
        {
            var payload = new SystemInformationPayload
            {
                BIOSVersion            = "1.2.3",
                BootDevice             = "x",
                FreePhysicalMemoryInKB = 123,
                FreeVirtualMemoryInKB  = 44,
                HostName                = "Bob",
                OsArchitecture          = "x64",
                OSName                  = "Windows",
                OSVendor                = "Microsoft",
                OSVersion               = "3.11",
                TotalPhysicalMemoryInKB = 45,
                TotalVirtualMemoryInKB  = 55
            };

            var obj = new SystemInformation(EventPriority.Operational, payload);

            obj.ValidateSchema();
        }
示例#3
0
        /// <inheritdoc />
        protected override List <IEvent> GetEventsImpl()
        {
            SystemInformationPayload payload = new SystemInformationPayload
            {
                OSName                  = _wmiUtils.GetSingleValue(WmiDataType.OsName),
                OSVersion               = _wmiUtils.GetSingleValue(WmiDataType.OsVersion),
                OSVendor                = _wmiUtils.GetSingleValue(WmiDataType.OsVendor),
                HostName                = Environment.MachineName,
                BIOSVersion             = _wmiUtils.GetSingleValue(WmiDataType.BiosVersion),
                BootDevice              = _wmiUtils.GetSingleValue(WmiDataType.BootDevice),
                TotalPhysicalMemoryInKB = int.Parse(_wmiUtils.GetSingleValue(WmiDataType.TotalPhysicalMemory)),
                FreePhysicalMemoryInKB  = int.Parse(_wmiUtils.GetSingleValue(WmiDataType.FreePhysicalMemory)),
                TotalVirtualMemoryInKB  = int.Parse(_wmiUtils.GetSingleValue(WmiDataType.TotalVirtualMemory)),
                FreeVirtualMemoryInKB   = int.Parse(_wmiUtils.GetSingleValue(WmiDataType.FreeVirtualMemory))
            };

            var ev = new SystemInformation(Priority, payload);

            return(new List <IEvent> {
                ev
            });
        }