https://www.chendd.cn/information/viewInformation/experienceShare/332.a
It has been two and a half months since I wrote a blog last time. I am also busy at work and lazy. I am also accumulating articles. Anyway, I haven’t written for a long time. This time I will share a component that uses Java to obtain cao operating system and hardware information. I was going to share it before the 11.11 holiday. However, there are many detailed parameters. The focus of this article is to list these parameters in detail, give personal understanding of the parameters and embarrassing translation results, and tap to spray.
This site has high expectations for the realization of blog 2.0, so the main management page in the background also plans to read and display some parameters of the server, which are not limited to Jdk and Web container parameters, but also include the cao operating system itself Some hardware parameters, this is the background.
Surrounding this background, we still collect related implementations. Among them, the implementations of Sigar and oshi seem to be more powerful, but the former needs to rely on the dynamic link library files of different cao operating systems to achieve. Whether the function is powerful or not is not shown for the time being. In my background here The next step is definitely to consider the implementation of oshi. Its implementation is cross-platform, and each parameter is implemented according to different cao operating systems. For some commonly used parameters, we do not need to call the underlying interface of the system. oshi is Java A free JNA-based (native) cao operating system and hardware repository. It does not require any other native libraries to be installed and aims to provide a cross-platform implementation to retrieve system information such as operating system version, processes, memory and CPU usage, disks and partitions, devices, sensors, etc., below All descriptions are around oshi .
support platform
-
Windows•Linux•Mac OS X•Unix(Solaris,FreeBSD)
Supported features
-
Computer system and firmware, backplane
-
cao operating system and version/build
-
Physical (Cores) and Logical (Hyperthreaded) CPUs
-
System and per-processor load percentages and tick counters
-
CPU uptime, processes and threads
-
Process uptime, CPU, memory usage
-
Used/available physical and virtual memory
-
Mounted filesystems (type, free and total space)
-
Disk drives (model, serial number, size) and partitions
-
Network interface (IP, bandwidth in/out)
-
Battery status (charge percentage, remaining time)
-
Connected display (with EDID information)
-
usb device
-
Sensors (temperature, fan speed, voltage)
Organize the parameters in detail (operatingSystemcao operating system, hardware motherboard), sorting out is too time-consuming, in fact, there are only a few useful ones, and then it is the most complete parameter sorting in all related articles you can see.
operatingSystem
bitness computer bitness
elevated whether administrator privileges
family family version
manufacturer manufacturer
processCount number of processes
processId process ID
systemBootTime system boot time (feels inaccurate)
systemUptime system running time (it feels inaccurate, there is normal running time in the CPU of the task manager)
threadCount number of threads
version version
buildNumber 17763
codeName Home/Standard/Ultimate
version version number
networkParams network parameters
dnsServers[0] dns servers
[0] 192.168.1.1
domainName computer domain name
hostName computer name
ipv4DefaultGateway IP4 default gateway
ipv6DefaultGateway IP6 default gateway
fileSystem file system
maxFileDescriptors maximum file descriptors
openFileDescriptors open file descriptors
fileStores[ ] file storage, including local disk and removable disk
[description] Disk drive description: local drive, removable boot drive (USB stick inserted)
[freeInodes] Available/free inodes on the disk drive
[freeSpace] The free space on the disk drive, the available size of the hard disk, such as "1.34G"
[logicalVolume] logical volume of the file system
[mount] disk symbol, such as: "C:\"
[name] drive letter name, such as: "local fixed disk (C:)"
[totalInodes] maximum/maximum number of integers for the filesystem
[totalSpace] total disk size, such as 5.20G
[type] disk type, NTFS and FAT32
[uUID] Disk unique identifier, the same every time you get it
[usableSpace] free space on the drive
[volume] file system volume
hardware
computerSystem computer system
baseboard computer motherboard
manufacturer motherboard manufacturer
model motherboard model
serialNumber motherboard serial number
version motherboard version
firmware computer firmware
description Firmware description
manufacturer Firmware manufacturer
name Firmware name
releaseDate release date
version version number
manufacturer computer manufacturer
model model
serialNumber Serialization
diskStores[] disk storage
currentQueueLength The length of the disk queue to be set
model Disk model: "SAMSUNG MZVLB256HAHQ-00000 (Standard Disk Drive)", "General USB Flash Disk USB Device (Standard Disk Drive)"
name name
partitions[] partition
[identification] disk #0, partition #1
[major] important
[minor] disk number
[mountPoint] drive letter
[name] name
[size] disk size
[type] Disk type: 'GPT:System', 'GPT:Basic Data'
[uuid] disk unique number
readBytes the number of bytes read
reads read
serial
size disk size
timeStamp timestamp
transferTime The number of milliseconds it took to read or write the setting
writeBytes the number of bytes written
writes
displays[]
[0]
array of display objects for edid monitors etc.
memory memory information
available available memory
pageSize display size per page
total total memory size
virtualMemory virtual memory information
swapPagesIn Number of pages to read from the paging/swap file to resolve hard page faults
swapPagesOut The number of pages written to the paging/swap file to free up physical memory space
swapTotal the current size of the paging/swap file
swapUsed the current memory committed to the paging/swap file
networkIFs[] network card device
[0]
bytesRecv bytes received
bytesSent bytes sent
displayName display name (network card, bluetooth, USB device)
iPv4addr[]
[0] ip4 address
iPv6addr[]
[0] ip6 address
inErrors the number of input errors
mTU
macaddr mac address
name NIC name, displayed by number
outErrors output error count
packetsRecv packet reception
packetsSent packet sent
speed Speed, Gigabit/100M
timeStamp timestamp
powerSources[] power sources
[0]
name System battery name
remainingCapacity remaining power
timeRemaining Remaining time (in seconds, such as 2 hours and 30 minutes, the corresponding value is: 2.50)
processor processor
contextSwitches context switch
cpu64bit Whether the CPU is 64-bit
currentFreq[] current frequency
[0] 8 core cpu
family family
identifier identifier
interrupts number of interrupts
logicalProcessorCount the number of processors
logicalProcessors[] logical processors
[0]
numaNode node
physicalPackageNumber actual package number
physicalProcessorNumber physical processor number
processorGroup processor group
processorNumber processor number
maxFreq maximum frequency
model model
name processor name
physicalPackageCount The number of physical packages
physicalProcessorCount The number of physical processors
processorCpuLoadTicks[] processor CPU load signal
[] 8 array elements with 8 array values per element
processorID Processor ID
stepping
systemCpuLoadTicks[] system CPU load signal
[] 8 array element values
vendor supplier
vendorFreq vendor frequency
sensors sensor
cpuTemperature cpu temperature (0.0)
cpuVoltage cpu voltage (0.0)
fanSpeeds[] fan speed([])
soundCards[] sound card
[0]
codec audio name encoding
driverVersion driver version
name audio name
Reference Code
<dependency>
<groupId>com.github.oshi</groupId>
<artifactId>oshi-core</artifactId>
<version>4.0.0</version>
</dependency>
@Test public void testSystem(){ System.out.println(SystemInfo.getCurrentPlatformEnum()); SystemInfo systemInfo = new SystemInfo(); System.out.println(JSONObject.toJSONString(systemInfo , true)); }
output result
Official website github project: https://github.com/oshi/oshi