private SystemInfoType GetSystemInfo(SystemInfo systemInfo) { SystemInfoType systemInfoType = new SystemInfoType(); if (systemInfo != null) { systemInfoType.architecture = systemInfo.Architecture; systemInfoType.os_name = systemInfo.SystemName; systemInfoType.os_version = systemInfo.SystemVersion; systemInfoType.primary_host_name = systemInfo.PrimaryHostName; systemInfoType.interfaces = new InterfaceType[systemInfo.NetworkInterfaces.Count()]; for (int i = 0; i <= (systemInfo.NetworkInterfaces.Count - 1); i++) { NetworkInfo networkInterface = systemInfo.NetworkInterfaces[i]; InterfaceType interfaceType = new InterfaceType(); interfaceType.interface_name = networkInterface.Name; interfaceType.ip_address = new EntityItemIPAddressStringType() { Value = networkInterface.IpAddress }; interfaceType.mac_address = networkInterface.MacAddress; systemInfoType.interfaces[i] = interfaceType; } } return(systemInfoType); }
public static void Startup(SystemInfoType logSystemInfo = SystemInfoType.All) { var asm = Assembly.GetCallingAssembly(); BuildInfo.Initialize(asm); Instance.Info( "===================================={0} - START====================================", Process.GetCurrentProcess().ProcessName); Instance.Info("Version: {0}", BuildInfo.Version); Instance.Info("Internal: {0} [{1}]", BuildInfo.InternalVersion, BuildInfo.Configuration); Instance.Info("Stamp: {0:s} UTC", BuildInfo.TimeStamp.ToUniversalTime()); Instance.Info("Entry: {0}", asm.FullName); Instance.Info("Runtime: {0}", Environment.Version); Instance.Info("OS Version: {0} {1}", Environment.OSVersion, Environment.Is64BitOperatingSystem ? "x64" : "x86"); Instance.Info("Machine Name: {0}", Environment.MachineName); Instance.Info("Process Type: {0}", Environment.Is64BitProcess ? "x64" : "x86"); Instance.Info("Command Line: {0}", Environment.CommandLine); Instance.Info("Identity: {0}", WindowsIdentity.GetCurrent().Name); if (logSystemInfo > SystemInfoType.None) { Instance.SystemInfo(logSystemInfo); } else { Instance.Info(string.Empty); } }
/// <summary> /// Gets the system info. /// The system info are informations about the station that was executed the collect. /// </summary> /// <param name="probeResult">The probe result.</param> /// <returns></returns> private SystemInfoType GetSystemInfo(ProbeResult probeResult) { SystemInfoType systemInfo = new SystemInfoType(); if (probeResult.SystemInformation != null) { systemInfo.architecture = probeResult.SystemInformation.Architecture; systemInfo.os_name = probeResult.SystemInformation.SystemName; systemInfo.os_version = probeResult.SystemInformation.SystemVersion; systemInfo.primary_host_name = probeResult.SystemInformation.PrimaryHostName; systemInfo.interfaces = new InterfaceType[probeResult.SystemInformation.Interfaces.Count()]; for (int i = 0; i <= (probeResult.SystemInformation.Interfaces.Count - 1); i++) { NetworkInterface networkInterface = probeResult.SystemInformation.Interfaces[i]; InterfaceType interfaceType = new InterfaceType(); interfaceType.interface_name = networkInterface.Name; interfaceType.ip_address = new EntityItemIPAddressStringType() { datatype = SimpleDatatypeEnumeration.ipv4_address, Value = networkInterface.IpAddress }; interfaceType.mac_address = networkInterface.MacAddress; systemInfo.interfaces[i] = interfaceType; } } return(systemInfo); }
private string GetResponse(SystemInfoType type) { var itemsStr = string.Join(",", items.Where(i => i.Type == type).Select(i => i.Content)); var str = "{\"prtg-version\":\"17.4.33.3283\",\"treesize\":6,\"sysinfo\":[" + itemsStr + "]}"; return(str); }
/// <summary> /// This method creates a new System Characteriscts with base in others system Characteristics. /// The generator and system_info of the new systemCharacteristics, will be based on the first element of the systemCharacteristics list. /// </summary> /// <param name="systemCharacteristics">The system characteristics.</param> /// <returns></returns> public oval_system_characteristics CreateSystemCharacteristicsBy(IEnumerable <oval_system_characteristics> systemCharacteristics) { if (systemCharacteristics.Count() > 0) { SystemInfoType systemInfoType = systemCharacteristics.ElementAt(0).system_info; return(this.CreateSystemCharacteristicsBySpecificSystemInfo(systemCharacteristics, systemInfoType)); } return(null); }
public void SystemInfo(SystemInfoType type) { if (type.HasFlag(SystemInfoType.IPAddress)) { this.Info("IP Address: {0}", GetLocalIPAddress()); } if (type.HasFlag(SystemInfoType.AvailableMemory)) { this.Info("Memory: {0} MB", GetAvailableMemory()); } if (type.HasFlag(SystemInfoType.IPAddress)) { TimeSpan upTime = TimeSpan.FromMilliseconds(Environment.TickCount); this.Info("Uptime: {0}", upTime.ToString(@"dd\.hh\:mm\:ss", CultureInfo.InvariantCulture)); } Instance.Info(string.Empty); }
public static string GetSystemInfo(SystemInfoType type) { string info = string.Empty; switch (type) { case SystemInfoType.Memory: info = GetPhysicalMemory(); break; case SystemInfoType.ProductName: info = GetProductNameInfo(); break; case SystemInfoType.CPU: info = GetCPUID(); break; default: break; } return(info); }
public oval_system_characteristics CreateSystemCharacteristicsBy(IEnumerable <oval_system_characteristics> systemCharacteristics, SystemInfo systemInfo) { SystemInfoType systemInfoType = this.GetSystemInfo(systemInfo); return(this.CreateSystemCharacteristicsBySpecificSystemInfo(systemCharacteristics, systemInfoType)); }
private oval_system_characteristics CreateSystemCharacteristicsBySpecificSystemInfo(IEnumerable <oval_system_characteristics> systemCharacteristics, SystemInfoType systemInfo) { SystemCharacteristicsBuilder builder = new SystemCharacteristicsBuilder(); var generator = (systemCharacteristics.Count() > 0) ? systemCharacteristics.ElementAt(0).generator : DocumentHelpers.GetDefaultGenerator(); return(builder.WithGenerator(generator) .WithSystemInfo(systemInfo) .WithCollectedObjectAndSystemDataByTheSystemCharacteristicList(systemCharacteristics) .Build()); }
private string GetInfoTypeDescription(SystemInfoType type) { return(Regex.Replace(type.ToString(), "[a-z][A-Z]", m => m.Value[0] + " " + m.Value[1])); }
public RefreshSystemInfoParameters(int deviceId, SystemInfoType type) : base(deviceId) { this[Parameter.Kind] = type; }
public SystemCharacteristicsBuilder WithSystemInfo(SystemInfoType systemInfo) { systemCharacteristics.system_info = systemInfo; return(this); }
public CategoryAttribute(SystemInfoType type) { Name = type; }
public SystemInfoRequest(SystemInfoType type) { Type = type; }
public RefreshSystemInfoParameters(Either <Device, int> deviceOrId, SystemInfoType type) : base(deviceOrId.ToPrtgObject()) { this[Parameter.Kind] = type; }